ff-sys
Low-level FFmpeg FFI bindings for Rust.
Overview
ff-sys provides raw FFI bindings to FFmpeg libraries, generated by bindgen. This crate is intended as a building block for higher-level safe wrappers.
Features
- Complete FFmpeg bindings: Auto-generated bindings via bindgen
- Wrapper modules: Thin Rust wrappers for common operations
avcodec- Codec operations (encode/decode)avformat- Container format I/Oswscale- Video scaling and color conversionswresample- Audio resampling
- Error handling utilities:
av_error_string()andcheck_av_error!macro - Cross-platform: Windows (VCPKG), Linux, macOS
Supported Platforms
| Platform | FFmpeg Source | Build Method |
|---|---|---|
| Windows | VCPKG | MSVC toolchain |
| Linux | System package (apt/yum) | pkg-config |
| macOS | Homebrew | pkg-config |
Prerequisites
FFmpeg development libraries must be installed on your system.
Windows
# Install via VCPKG (recommended)
vcpkg install ffmpeg:x64-windows
# Set environment variables
$env:VCPKG_ROOT = "C:\vcpkg"
Linux (Debian/Ubuntu)
macOS
Minimum Supported Rust Version
Rust 1.93.0 or later (edition 2024).
Usage
Note: This crate provides unsafe FFI bindings. Consider using higher-level wrappers from the ff-* crate family for safe abstractions.
Basic Example
use ;
Using Wrapper Modules
use ;
use ;
unsafe
Module Structure
ff-sys/src/
├── lib.rs # Crate root, bindgen include, utilities
├── avcodec.rs # Codec context, packet handling
├── avformat.rs # Format context, stream handling
├── swscale.rs # Video scaling context
└── swresample.rs # Audio resampling context
Related Crates
This crate is part of the ff-* crate family:
- ff-format - Type-safe pixel/sample formats, timestamps, stream info
- ff-probe - Media metadata extraction
- ff-decode - Video/audio decoding
- ff-encode - Video/audio encoding
- ff-filter - Filter graph operations (planned)
License
MIT OR Apache-2.0