avio
avio is the unified facade for the ff-* crate family. Depend on a single crate and opt in
to only the capabilities you need via feature flags.
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
[]
# Default: probe + decode + encode + hwaccel
= "0.15"
# Add filtering
= { = "0.15", = ["filter"] }
# Full streaming stack (implies pipeline, which implies filter)
= { = "0.15", = ["stream"] }
# Async decode/encode (requires tokio runtime)
= { = "0.15", = ["tokio"] }
Feature Flags
| Feature | Enables | Default | Implies |
|---|---|---|---|
probe |
ff-probe — read-only media metadata |
yes | — |
decode |
ff-decode — video and audio decoding |
yes | — |
encode |
ff-encode — video and audio encoding |
yes | — |
hwaccel |
hardware-accelerated encoders (ff-encode/hwaccel) |
yes | — |
filter |
ff-filter — filter graph operations |
no | — |
pipeline |
ff-pipeline — decode → filter → encode |
no | filter |
stream |
ff-stream — HLS / DASH / live streaming output |
no | pipeline |
preview |
ff-preview — real-time playback and seek |
no | — |
preview-proxy |
proxy generation (ff-preview/proxy) |
no | preview |
render |
ff-render — GPU compositing pipeline |
no | preview |
render-gpu |
wgpu backend (ff-render/wgpu) |
no | render |
tokio |
async wrappers for decode, encode, and preview | no | decode + encode |
gpl |
GPL-licensed encoders (ff-encode/gpl) |
no | — |
srt |
SRT input/output (ff-decode/srt, ff-stream/srt) |
no | — |
serde |
serde derives for filter types (ff-filter/serde) |
no | — |
Quick Start
Probe
use open;
let info = open?;
if let Some = info.primary_video
Decode
use ;
// Video — request RGB24 output (FFmpeg converts internally)
let mut vdec = open
.output_format
.build?;
while let Some = vdec.decode_one?
// Audio — resample to f32 at 44.1 kHz
let mut adec = open
.output_format
.output_sample_rate
.build?;
while let Some = adec.decode_one?
Image Sequences
A %-pattern path (e.g. frame%04d.png) automatically selects the image2
demuxer for decode and muxer for encode:
use ;
// Decode numbered PNGs → video
let mut decoder = open
.hardware_accel
.frame_rate
.build?;
// Encode video → numbered PNGs
let mut encoder = create
.video
.video_codec
.build?;
Encode
use ;
let mut encoder = create
.video
.video_codec
.bitrate_mode
.audio
.audio_codec
.build?;
for frame in &video_frames
encoder.finish?;
Per-Codec Options
VideoCodecOptions and AudioCodecOptions provide typed, per-codec
configuration applied before the codec is opened:
use ;
let opts = H264;
let mut encoder = create
.video
.video_codec
.bitrate_mode
.codec_options
.build?;
Available option structs: H264Options, H265Options, Av1Options,
SvtAv1Options, Vp9Options, ProResOptions, DnxhdOptions,
OpusOptions, AacOptions, Mp3Options, FlacOptions.
Professional Formats
use ;
let mut encoder = create
.video
.video_codec
.pixel_format
.codec_options
.build?;
HDR Metadata
use ;
// HDR10 — PQ transfer + MaxCLL/MaxFALL side data
let mut encoder = create
.video
.video_codec
.bitrate_mode
.pixel_format
.codec_options
.hdr10_metadata
.build?;
// HLG — broadcast HDR without MaxCLL/MaxFALL
use ;
let mut encoder = create
.video
.video_codec
.pixel_format
.color_transfer
.color_space
.color_primaries
.build?;
Async (tokio feature)
use ;
use StreamExt;
let mut encoder = from_builder?;
let stream = open.await?.into_stream;
pin!;
while let Some = stream.next.await
encoder.finish.await?;
Pipeline (pipeline feature)
use ;
builder
.input
.output
.build?
.run?;
Crate Family
| Crate | Purpose |
|---|---|
ff-sys |
Raw bindgen FFI — internal use only |
ff-common |
Shared buffer-pooling abstractions |
ff-format |
Pure-Rust type definitions (no FFmpeg linkage) |
ff-probe |
Read-only media metadata extraction |
ff-decode |
Video and audio decoding |
ff-encode |
Video and audio encoding |
ff-filter |
Filter graph operations |
ff-pipeline |
Decode → filter → encode pipeline |
ff-stream |
HLS / DASH adaptive streaming output |
ff-preview |
Real-time preview and proxy workflow |
ff-render |
GPU compositing pipeline (wgpu) |
avio |
Unified facade (this crate) |
MSRV
Rust 1.93.0 (edition 2024).
License
MIT OR Apache-2.0