ff-sys 0.15.0

Low-level FFmpeg FFI bindings for Rust
Documentation

ff-sys

Low-level FFmpeg FFI bindings generated by bindgen. Not intended for direct use; use the higher-level ff-* crates instead.

Project status (as of 2026-06-04): The library foundation is in place. Development continues through avio-editor-demo, a real-world video editing application built on avio, which surfaces bugs and drives API improvements. Pull requests, bug reports, and feature requests are welcome — see the main repository for full context.

Installation Prerequisites

Before building any crate in this workspace, FFmpeg 7.x development libraries must be available on your system. FFmpeg 6.x is not supported (the SWS_* flags differ in API shape), and FFmpeg 8.x is detected separately via the SwsFlags enum.

Windows

Install FFmpeg via vcpkg:

vcpkg install ffmpeg:x64-windows

The build script reads VCPKG_ROOT to locate the installation (defaulting to C:\vcpkg) and expects FFmpeg under <VCPKG_ROOT>\installed\x64-windows. bindgen also requires libclang: set LIBCLANG_PATH to your LLVM bin directory (containing libclang.dll) if it is not in a standard location such as C:\Program Files\LLVM\bin.

Linux

Detected via pkg-config:

sudo apt install libavcodec-dev libavformat-dev libavutil-dev \
                 libavfilter-dev libswscale-dev libswresample-dev

If FFmpeg is installed in a non-standard location, set PKG_CONFIG_PATH to its lib/pkgconfig directory.

macOS

brew install ffmpeg

Platform Support

Platform Detection Notes
Windows vcpkg (VCPKG_ROOT) ffmpeg:x64-windows triplet; LIBCLANG_PATH for bindgen
Linux pkg-config Dev packages (-dev) must be installed
macOS Homebrew → pkg-config Auto-detects /opt/homebrew or /usr/local, falls back to pkg-config

Wrapper Modules

In addition to the raw bindgen output, ff-sys ships thin safe-wrapper modules that isolate the most error-prone FFmpeg call sequences:

Module Wraps
avcodec AVCodecContext, codec open/close
avformat AVFormatContext, demux/mux lifecycle
swscale SwsContext, pixel format conversion
swresample SwrContext, sample format / channel layout conversion

These modules are public (pub mod) but are intended for use by the higher-level ff-* crates rather than for direct consumption.

MSRV

Rust 1.93.0 (edition 2024).

License

MIT OR Apache-2.0