Installation
This guide walks you through adding libffmpeg to your Rust project and configuring the required tracing features.Add to Cargo.toml
Add libffmpeg as a dependency in yourCargo.toml:
Cargo.toml
libffmpeg is currently distributed via GitHub. A crates.io release may be available in the future.
Additional Dependencies
Depending on your use case, you may want to add:Configure Tracing Support
libffmpeg uses tracing’s unstablevaluable feature for structured logging. To enable this, you need to add a Cargo config file to your workspace.
Configure Binary Discovery
libffmpeg automatically discoversffmpeg and ffprobe binaries. The lookup order is:
- Environment variables (highest priority)
- System PATH (fallback)
Option 1: Use System Binaries
Ifffmpeg and ffprobe are in your system PATH, no additional configuration is needed:
Option 2: Custom Binary Paths
Set environment variables to override the default lookup:.bashrc, .zshrc, etc.) or set them in your application:
libffmpeg validates that the path points to an executable file. If the binary is not found or not executable, you’ll receive a
NotFound error at runtime.Install FFmpeg
If you don’t have ffmpeg installed on your system:Verify Your Setup
Create a minimal example to verify everything is configured correctly:main.rs
Common Installation Issues
Compilation error: 'valuable' feature not found
Compilation error: 'valuable' feature not found
Problem: Missing
.cargo/config.toml with tracing_unstable flag.Solution: Follow the “Configure Tracing Support” section above to create the config file.Runtime error: FfmpegError::NotFound
Runtime error: FfmpegError::NotFound
Problem: ffmpeg binary not found in PATH or environment variable.Solution:
- Install ffmpeg on your system
- Verify with
which ffmpeg - Or set
LIBFFMPEG_FFMPEG_PATHenvironment variable
Git fetch fails during cargo build
Git fetch fails during cargo build
Problem: Git authentication issues or network problems.Solution: The
.cargo/config.toml includes git-fetch-with-cli = true which helps with authentication. Ensure you have git credentials configured.Permission denied when running ffmpeg
Permission denied when running ffmpeg
Problem: Binary path is not executable.Solution:
Next Steps
Now that libffmpeg is installed, follow the quickstart guide to build your first transcoding application:Quickstart Guide
Build a complete transcoding application with progress monitoring