Rusty FFmpeg
Cross platform FFI bindings for FFmpeg inner libraries. This is a crate that:
- Linking FFmpeg libraries for you.
- Generates Rust binding for FFmpeg libraries.
Usage
To use this crate, you need to set several environment variables.
Simplest:
Build ffmpeg staticly and set FFMPEG_PKG_CONFIG_PATH
to the path of the generated FFmpeg package-config files. And you don't need to set other environment variables for static linking.
More complex
You need to set environment variable for both linking and generating bindings.
To link:
-
Dynamic linking with prebuilt dylib: Set
FFMPEG_DLL_PATH
to the path ofdll
orso
. (Windows: Put corresponding.lib
file next to the.dll
file.) -
Static linking with prebuilt staticlib: or set
FFMPEG_LIB_DIR
to the path of the FFmpeg prebuilt libs directory.
To generate bindings:
-
Compile-time binding generation(requires clang dylib): Set
FFMPEG_INCLUDE_DIR
to the path to the header files for binding generation. -
Use pre-built binding: Set
FFMPEG_BINDING_PATH
to the prebuilt binding file.
Attention
FFI is not that easy, especially when you are dealing with a big old C project. Don't feel depressed when there are some problems. The CI check already have some typical use cases, you can check it. File an issue if you still have some problem.