ffmpeg-pipeline provides composable Rust APIs for common media-processing workflows on top of ffmpeg-next. It operates directly through FFmpeg libraries and never invokes the ffmpeg command-line program.
- Decode audio and video streams as packets or frames.
- Encode audio and video with configurable codec parameters and metadata.
- Resample, reformat, and buffer audio for encoder frame requirements.
- Scale decoded video frames.
- Remux selected streams while preserving or replacing stream metadata.
- Read from files, byte buffers, or custom
Read + Seeksources. - Write to files, byte buffers, or custom
Write + Seekdestinations. - Inspect stream metadata and calculate video frame counts.
[dependencies]
ffmpeg-pipeline = "0.2"
log = "0.4"The crate links FFmpeg statically. Provide a compatible FFmpeg 7.1 installation through FFMPEG_DIR, or enable source compilation:
[dependencies]
ffmpeg-pipeline = { version = "0.2", features = ["build-from-source"] }The available codecs and formats are determined by the linked FFmpeg build. Platform system libraries and frameworks may still be required; third-party FFmpeg dependencies must be linked statically.
use ffmpeg_pipeline::{initialize, input_file, parse_stream_info};
fn main() -> Result<(), Box<dyn std::error::Error>> {
initialize(log::Level::Error)?;
let input = input_file("sample.mkv")?;
for stream in input.streams() {
let info = parse_stream_info(&stream)?;
println!("{}: {} ({})", stream.index(), info.get_title(), info.format);
}
Ok(())
}Call initialize once before creating FFmpeg contexts. See the API documentation for decoding, encoding, remuxing, scaling, and custom I/O types.
The crate is under active development. The public API may change before version 1.0.
Copyright © 2023–2026 DarkSky.
Licensed under the GNU Affero General Public License, version 3 only.