35 releases
0.16.1+ffmpeg.7.0 | Aug 25, 2024 |
---|---|
0.15.0+ffmpeg.7.0 | Aug 23, 2024 |
0.14.1+ffmpeg.7.0 | Apr 13, 2024 |
0.13.3+ffmpeg.6.1 | Dec 31, 2023 |
0.2.5 | Jul 14, 2020 |
#44 in Multimedia
2,757 downloads per month
Used in 4 crates
(3 directly)
1.5MB
26K
SLoC
Rusty FFmpeg
Cross platform FFI bindings for FFmpeg internal libraries. This is a crate that:
- Links FFmpeg libraries for you.
- Generates Rust binding for FFmpeg libraries.
Getting started:
To use this crate, you need to set several environment variables.
The simplest usage:
Linux, macOS..(*nix)
If you have FFmpeg installed with package manager, import rusty_ffmpeg
with feature link_system_ffmpeg
. Then it should work.
If you built FFmpeg from source, set FFMPEG_PKG_CONFIG_PATH
to the path of the generated FFmpeg pkg-config
directory. Then it should work.
Windows
rusty_ffmpeg
can link FFmpeg using vcpkg
:
- Install
vcpkg
, check documentation of the vcpkg crate for the environment variables to set. - Import
rusty_ffmpeg
with featurelink_vcpkg_ffmpeg
, Then it should work.
Fine-grained usage:
You need to set several environment variables for both the linking and binding generating procedures.
To link prebuilt libraries:
-
Dynamic linking with pre-built dylib: Set
FFMPEG_DLL_PATH
to the path ofdll
orso
files. (Windows: Put corresponding.lib
file next to the.dll
file.) -
Static linking with pre-built staticlib: Set
FFMPEG_LIBS_DIR
to the path of FFmpeg pre-built libs directory.
To generate bindings:
-
Compile-time binding generation(requires the
Clang
dylib): SetFFMPEG_INCLUDE_DIR
to the path of the header files for binding generation. -
Use your prebuilt binding: Set
FFMPEG_BINDING_PATH
to the pre-built binding file. The pre-built binding is usually copied from theOUT_DIR
of the compile-time binding generation, using it will prevent the need to regenerate the same binding file repeatedly.
Linking FFmpeg installed by package manager on (*nix)
You can link FFmpeg libraries installed by package manager by enabling feature link_system_ffmpeg
(which uses pkg-config underneath).
Linking FFmpeg installed by vcpkg
You can link FFmpeg libraries installed by vcpkg by enabling feature link_vcpkg_ffmpeg
on Windows, macOS, and Linux.
Use a specific FFmpeg version
- Do nothing when you are using FFmpeg
4.*
- Enable
ffmpeg5
feature when you are using FFmpeg5.*
- Enable
ffmpeg6
feature when you are using FFmpeg6.*
- Enable
ffmpeg7
feature when you are using FFmpeg7.*
Attention
FFI is not that easy, especially when you are dealing with a big old C project. Don't get discouraged if you encounter some problems. The CI check already has some typical ffmpeg compilation and use cases for you to check. File an issue if you still have any problems.
Dependencies
~0–2MB
~38K SLoC