Documentation Index Fetch the complete documentation index at: https://mintlify.com/charliethomson/libffmpeg/llms.txt
Use this file to discover all available pages before exploring further.
Async Rust wrapper for ffmpeg Built on tokio with tracing, graceful shutdown, and progress parsing. Three execution modes, full cancellation support, and automatic binary discovery.
Quick start Get up and running with libffmpeg in minutes
Add to your Cargo.toml
Add libffmpeg as a dependency to your project: [ dependencies ]
libffmpeg = { git = "https://github.com/charliethomson/libffmpeg" }
tokio = { version = "1" , features = [ "rt" , "process" , "macros" ] }
tokio-util = { version = "0.7" }
Set up tracing support
Copy the Cargo config to enable tracing’s unstable valuable support: mkdir -p .cargo && curl -o .cargo/config.toml https://raw.githubusercontent.com/charliethomson/libffmpeg/refs/heads/main/.cargo/config.toml
Run your first transcode
Use the slim mode for simple transcoding tasks: use libffmpeg :: ffmpeg :: ffmpeg_slim;
use tokio_util :: sync :: CancellationToken ;
#[tokio :: main]
async fn main () -> Result <(), Box < dyn std :: error :: Error >> {
let token = CancellationToken :: new ();
ffmpeg_slim ( token , | cmd | {
cmd . arg ( "-i" ) . arg ( "input.mp4" )
. arg ( "-c:v" ) . arg ( "libx264" )
. arg ( "output.mp4" );
}) . await ? ;
Ok (())
}
Explore by topic Learn core concepts and discover advanced features
Execution modes Choose between slim, standard, and graceful execution modes
Progress parsing Parse structured progress updates from ffmpeg output
Cancellation Use CancellationToken for responsive shutdown
Binary discovery Automatic ffmpeg/ffprobe detection with env var overrides
ffprobe Extract media metadata and duration information
Monitoring Stream stdout/stderr with CommandMonitor
Key features Built for production use with Rust async patterns
Async-first design Built on tokio with full async/await support and CancellationToken integration
Graceful shutdown Send ‘q’ to ffmpeg stdin before SIGKILL for clean transcoding termination
Progress parsing Structured Progress type from ffmpeg’s -progress pipe:1 output
Tracing integration All functions instrumented with tracing spans and valuable support
Ready to get started? Follow our quickstart guide to build your first ffmpeg application with Rust
View Quickstart