Rusty FFmpeg

CI Crates.io Doc

Cross platform FFI bindings for FFmpeg inner libraries. This is a crate that: 1. Generates Rust binding for FFmpeg libraries which can be used directly. 2. Emits specific cargo metadata for linking FFmpeg libraries.

Building

Generate and build the bindings:

Library linking is static by default, setting environment variable FFMPEG_DYNAMIC_LINKING will make rusty_ffmpeg link dynamic libraries.

Linux & MacOS

  1. Start to prepare FFmpeg libraries:
  2. After the FFmpeg libraries are ready, the build script will take advantage of the package-config(*.pc) files to:
    1. Probe paths of the header files for binding generation and generate the binding.
    2. Probe library dependencies as project dependencies to ensure this project can be built successfully.

So there are three ways for developers to provide FFmpeg libraries for this crate to generate bindings:

  1. Provide self compiled FFmpeg by setting FFMPEG_PKG_CONFIG_PATH
  2. Install FFmpeg libraries via system package manager.(Make sure they can be found by pkg-config)
  3. Doesn't provide FFmpeg, waiting for this crate cloning and building a FFmpeg with some default configuration from scratch.

Windows

  1. Install vcpkg.
  2. Install FFmpeg using it with specific triplet according to your building target and rustflags. (Check here).
  3. build with VCPKG_ROOT set to the vcpkg path, and VCPKG_DEFAULT_TRIPLET set to the triplet you used.

Testing

You can use cargo test to test the generated bindings. Want to see it works? There is a small example for you. Run cargo run --example slice.