32 releases

0.14.1+ffmpeg.7.0 Apr 13, 2024
0.13.3+ffmpeg.6.1 Dec 31, 2023
0.13.1+ffmpeg.6.0 Mar 21, 2023
0.10.0+ffmpeg.5.1 Sep 12, 2022
0.2.5 Jul 14, 2020

#39 in Multimedia

Download history 367/week @ 2024-02-05 373/week @ 2024-02-12 516/week @ 2024-02-19 345/week @ 2024-02-26 1005/week @ 2024-03-04 1178/week @ 2024-03-11 858/week @ 2024-03-18 802/week @ 2024-03-25 1689/week @ 2024-04-01 1443/week @ 2024-04-08 1197/week @ 2024-04-15 825/week @ 2024-04-22 964/week @ 2024-04-29 765/week @ 2024-05-06 715/week @ 2024-05-13 1086/week @ 2024-05-20

3,660 downloads per month
Used in 2 crates (via rsmpeg)

MIT license

33K SLoC

Rusty FFmpeg

Doc Crates.io Downloads CI

Cross platform FFI bindings for FFmpeg inner libraries. This is a crate that:

  1. Links FFmpeg libraries for you.
  2. Generates Rust binding for FFmpeg libraries.

Getting started:

To use this crate, you need to set several environment variables.

The simplest usage:


Build ffmpeg statically and set FFMPEG_PKG_CONFIG_PATH to the path of the generated FFmpeg pkg-config files. And you don't need to set other environment variables for static linking.

(Hint: setting FFMPEG_PKG_CONFIG_PATH to some placeholder value will leave a rusty_ffmpeg probing system library.)


rusty_ffmpeg can link FFmpeg using vcpkg. Install vcpkg, check documentation of the vcpkg crate for the environment variables to set, then it works.

Fine-grained usage:

You need to set several environment variables for both linking and binding generating procedures.

  1. Dynamic linking with pre-built dylib: Set FFMPEG_DLL_PATH to the path of dll or so. (Windows: Put corresponding .lib file next to the .dll file.)

  2. Static linking with pre-built staticlib: Set FFMPEG_LIBS_DIR to the path of the FFmpeg pre-built libs directory.

To generate bindings:

  1. Compile-time binding generation(requires the Clang dylib): Set FFMPEG_INCLUDE_DIR to the path to the header files for binding generation.

  2. Use your pre-built binding: Set FFMPEG_BINDING_PATH to the pre-built binding file. The pre-built binding is usually copied from the OUT_DIR of the compile-time binding generation, by using it you don't need to regenerate the same binding file again and again.

Linking FFmpeg installed by package manager on (*nix)

You can enable system-wide FFmpeg linking by enabling feature link_system_ffmpeg.

Use specific FFmpeg version

  • Do nothing when you are using FFmpeg 4.*
  • Enable ffmpeg5 feature when you are using FFmpeg 5.*
  • Enable ffmpeg6 feature when you are using FFmpeg 6.*
  • Enable ffmpeg7 feature when you are using FFmpeg 7.*


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 has some typical ffmpeg compilation and use cases for you to check. File an issue if you still have any problem.


~38K SLoC