Expand description
avio is a safe, high-level video-editing engine for Rust: assemble a
Timeline of Clips, edit it through an Editor, and render it to a file.
The engine owns the editing model (timeline / clips / tracks, the model-to-scene
derivation, and edit history) and speaks in ff-format value types (VideoCodec,
AudioCodec, PixelFormat, Color, TextSpec, …) plus the ff-filter
authoring types (FilterStep, BlendMode, AnimationTrack, …). The
lower-level ff-* primitives (standalone decoders, encoders, pipelines, stream
outputs, the GPU compositor) live in their own crates; depend on those directly when
you need a primitive. See docs/adr/0004-avio-engine-not-facade.md.
§Feature flags
| Feature | Default | Effect |
|---|---|---|
hwaccel | yes | hardware-accelerated export (ff-encode/hwaccel) |
preview | no | real-time TimelinePlayer + Scene types |
serde | no | serde (de)serialization of the model |
gpu | no | GPU compositing for preview and export (wgpu) |
gpl | no | GPL-only codecs (x264 / x265) |
The editing model, render, probe (open), and media analysis are always present.
§Quick start
Build a Timeline of Clips and render it with an
EncoderConfig; the timeline_render example is a complete end-to-end flow.
use avio::{Clip, EncoderConfig, Timeline, VideoCodec, AudioCodec, BitrateMode};
let timeline: Timeline = /* build from clips */ Timeline::default();
timeline.render("output.mp4", EncoderConfig::builder()
.video_codec(VideoCodec::H264)
.audio_codec(AudioCodec::Aac)
.bitrate_mode(BitrateMode::Crf(23))
.build())?;Edit through an Editor with Commands (undo/redo), inspect a source with
open before importing it, and - with the preview feature - play a timeline in
real time via TimelinePlayer.
§Projects using avio
avio-editor-demo is a non-linear
video editor and the primary driver of this API: multi-track composition with
per-clip colour correction and transitions, a real-time preview that matches the
exported result, and scene / silence / loudness analysis.
Structs§
- Animation
Track - A sorted collection of keyframes with interpolated
value_at(t)lookup. - Audio
Frame - A decoded audio frame.
- Audio
Stream Info - Information about an audio stream within a media file.
- Audio
Stream Info Builder - Builder for constructing
AudioStreamInfo. - Black
Frame Detector - Detects black intervals in a video file and returns their start timestamps.
- BpmResult
- Result of BPM (beats-per-minute) detection over an audio stream.
- Chapter
Info - Information about a chapter within a media file.
- Chapter
Info Builder - Builder for constructing
ChapterInfo. - Clip
- A single media clip on a timeline.
- Clip
Effect - One typed effect in a
Clip’s ordered effect list. - ClipId
- Stable identity of a
Clipwithin aTimeline. - Color
- An 8-bit-per-channel RGBA color value.
- Container
Info - Container-level metadata extracted from
AVFormatContext. - Container
Info Builder - Builder for
ContainerInfo. - Draw
Text Options - Options for the
drawtextfilter. - Editor
- A stateful editing session: an undo/redo history of
Timelineversions. - Effect
Descriptor - A host-facing description of an effect kind and its editable parameters, returned
by
EffectKind::descriptor. Lets a UI render a parameter panel generically, without hard-coding eachEffectKindvariant. - Effect
Id - Stable identity of a
ClipEffectwithin aClip. - Encoder
Config - Codec and quality configuration for the pipeline output.
- Encoder
Config Builder - Consuming builder for
EncoderConfig. - Frame
Histogram - Per-channel color histogram for a single video frame.
- GpuCompositor
- Composites derived layers on the GPU, returning
None(CPU fallback) on unsupported content or any GPU error. - GpuLayer
Plan - One layer of a
GpuScenePlan: the transform / blend / opacity theff_render::Compositorneeds, plus the per-layer effect nodes to run before compositing. The transform is stored as scalars (evaluated at the frame time); Br3/Br4 build theff_render::LayerTransformfrom them. - GpuPreview
Compositor - Preview adapter over
GpuCompositor: composites the runner’s layers on the GPU, falling back toNone(the runner’s CPU path) on unsupported content or a GPU error. - GpuScene
Plan - A whole frame’s GPU compositing plan: the output canvas and the z-ordered layers.
- GroupId
- Stable identity of a clip group within a
Timeline. - Hdr10
Metadata - HDR10 static metadata (
MaxCLL+MaxFALL+ mastering display). - Histogram
- 256-bin luminance and per-channel RGB histogram.
- Histogram
Extractor - Extracts per-channel color histograms at configurable frame intervals.
- Keyframe
- A single keyframe in an animation track.
- Keyframe
Enumerator - Enumerates the timestamps of all keyframes in a video stream.
- Marker
- A labelled point on the timeline.
- Marker
Id - Stable identity of a
Markerwithin aTimeline. - Mastering
Display - Mastering display colour volume (SMPTE ST 2086).
- Media
Info - Information about a media file.
- Media
Info Builder - Builder for constructing
MediaInfo. - Network
Options - Shared network configuration for network-backed decoders and live outputs.
- Param
Descriptor - A host-facing description of one effect parameter (see
EffectDescriptor). - Player
Handle - Shared, cloneable handle to a running
PlayerRunner. - Progress
- Progress information delivered to the caller on each processed frame.
- Rational
- A rational number represented as a fraction (numerator / denominator).
- Realtime
Layer - One layer in a
RealtimeComposer, composited bottom-up inVecorder (index0is the base; later layers blend on top). - Realtime
Layer Descriptor - The dimension-independent part of a
RealtimeLayer: every field exceptwidth/height/pixel_format, which are only known once a frame has been decoded. - Rgb
- An RGB colour value used by the three-way colour corrector.
- RgbParade
- Per-channel waveform monitor data (RGB parade).
- Rgba
Frame - A decoded video frame as contiguous RGBA bytes.
- Rgba
Sink - Reference
FrameSinkimplementation that stores the latest frame in a sharedArc<Mutex<Option<RgbaFrame>>>. - Scene
- A whole timeline’s worth of playback work, described without the editing model.
- Scene
Audio Placement - One audio-only clip placed on the timeline.
- Scene
Audio Track - One dedicated audio-only track (A1, A2, …).
- Scene
Detector - Detects scene changes in a video file and returns their timestamps.
- Scene
Placement - One video clip placed on the timeline.
- Scene
Runner - Exclusive owner of the timeline decode pipeline.
- Scene
Video Track - One video track: an ordered list of clip placements along the timeline. The
track’s index in
Scene::video_tracksis its compositing order (0= base). - Scope
Analyzer - Scope analysis utilities for decoded video frames.
- Silence
Detector - Detects silent intervals in an audio file and returns their time ranges.
- Silence
Range - A detected silent interval in an audio stream.
- Subtitle
Event - A single subtitle event (cue).
- Subtitle
Stream Info - Information about a subtitle stream within a media file.
- Subtitle
Stream Info Builder - Builder for constructing
SubtitleStreamInfo. - Subtitle
Track - A parsed subtitle track containing ordered events.
- Text
Spec - A text/title layer: the string, its placement, and its styling.
- Text
Style - Visual styling for a text layer.
- Timeline
- An ordered layout of
Clipinstances across video and audio tracks. - Timeline
Builder - Builder for
Timeline. - Timeline
Player - Thin builder for a (
SceneRunner,PlayerHandle) pair backed by aTimeline. - Timestamp
- A timestamp representing a point in time within a media stream.
- Track
- An ordered list of
Clips and its editorial state. - Track
Automation - Typed, per-property track-level automation.
- TrackId
- Stable identity of a
Trackwithin aTimeline. - Video
Effect Renderer - Reusable single-frame renderer for a
Clip’s video effect chain. - Video
Frame - A decoded video frame.
- Video
Stream Info - Information about a video stream within a media file.
- Video
Stream Info Builder - Builder for constructing
VideoStreamInfo. - Waveform
Analyzer - Computes peak and RMS amplitude per time interval for an audio file.
- Waveform
Sample - A single waveform measurement over a configurable time interval.
Enums§
- Alpha
Mode - Alpha modes.
- Analysis
Error - Errors that can occur during media analysis (scene / silence / BPM / histogram / keyframe / black-frame / waveform).
- Anchor
- Where a text layer is anchored within its canvas.
- Animated
Value - A value that is either constant or animated over time.
- Audio
Codec - Audio codec identifier.
- Audio
Property - An audio-track property that a
TrackAutomationcan animate. - Bitrate
Mode - Bitrate control mode for video encoding.
- Blend
Mode - Specifies how two video layers are combined during compositing.
- Channel
Layout - Audio channel layout representing the speaker configuration.
- Clip
Property - A per-clip property that
Command::SetClipPropertycan set. - Clip
Source - The origin of a clip’s frames.
- Color
Primaries - Color primaries defining the color gamut (the range of colors that can be represented).
- Color
Range - Color range defining the valid range of color values.
- Color
Space - Color space (matrix coefficients) for YUV to RGB conversion.
- Color
Transfer - Color transfer characteristic (opto-electronic transfer function).
- Command
- A single, value-based edit to a
Timeline. Apply it withapply. - Composite
Op - Porter-Duff compositing operator for combining two video layers.
- Decode
Error - Errors that can occur during decoding operations.
- Easing
- Easing function applied to a keyframe interval.
- Edit
Error - An edit that could not be applied to a
Timeline. - Effect
Domain - Which of a clip’s media streams an
EffectKindapplies to (#1712). - Effect
Kind - A typed effect that a clip can carry.
#[non_exhaustive]: more kinds are added over time, so external matchers must include a_arm. - Encode
Error - Encoding error type.
- EqBand
- A single band for the parametric equalizer.
- Error
Severity - Severity class of a media error: whether the failing operation can be retried without rebuilding the component that raised it.
- Filter
Error - Errors that can occur during filter graph construction and processing.
- Filter
Step - A single step in a filter chain.
- FitMode
- How a clip’s source frame is framed against the project canvas.
- Format
Error - Error type for format-related operations.
- Frame
Error - Error type for frame operations.
- GpuEffect
- A per-layer effect the GPU path can apply, mapped from a
FilterStep.#[non_exhaustive]: more kinds are added as node coverage grows. - GpuFallback
- Why a frame cannot composite on the GPU and falls back to the CPU compositor.
#[non_exhaustive]: more reasons appear as coverage changes. - GpuMapping
- The result of mapping a frame: a GPU plan, or a whole-frame CPU fallback.
- GpuTransition
- The
ff-rendertransition node anXfadeTransitionrenders as. - HwAccel
- Hardware acceleration backend for filter graph operations.
- Pacing
- How
SceneRunner::runpaces frame delivery. - Param
- One parameter of an
EffectKind: a constant value or a keyframe track. - Param
Value - The type, editable metadata, and current value of an effect parameter. The variant tells a host which editor to render (slider / checkbox / number field / colour picker / file picker / curve editor).
- Pitch
Algo - Backend algorithm for the
PitchShiftandTimeStretchsteps. - Pixel
Format - Pixel format for video frames.
- Preview
Error - Errors that can occur during preview and proxy operations.
- Probe
Error - Error type for media probing operations.
- Sample
Format - Audio sample format for audio frames.
- Scale
Algorithm - Resampling algorithm for the
scalefilter. - Scene
Source - The video source backing a
ScenePlacement: a decoded media file, or a generated (solid-colour / text) source rendered without a file — the preview counterpart of the engine’sClipSource. Generated sources are produced byff-filter’sSolidSource/TextSource(the samecolor/drawtextfilters the export path uses), so preview matches export. - Subtitle
Codec - Subtitle codec identifier.
- Subtitle
Error - Error type for subtitle parsing operations.
- Timeline
Error - Errors from building or rendering the editing model.
- Timeline
Issue - A single problem found by
Timeline::validate. - ToneMap
- Tone-mapping algorithm for HDR-to-SDR conversion.
- Track
Kind - Which track list a
TrackIdrefers to. - Video
Codec - Video codec identifier.
- Video
Property - A video-layer property that a
TrackAutomationcan animate. - Xfade
Transition - Transition type for the
xfadecross-dissolve filter. - Yadif
Mode - Deinterlacing mode for the
yadiffilter.
Traits§
- Frame
Sink - A sink that receives decoded video frames as contiguous RGBA bytes.
- GpuLayer
Source - A derived layer the GPU mapping can read. Implemented for the export
VideoLayer, the previewRealtimeLayerDescriptor, the runner’s realizedRealtimeLayer, and&Tfor any of them (so a&[&RealtimeLayer]maps like a&[RealtimeLayer]), keeping the mapping one shared implementation. - IoSink
- A byte sink FFmpeg can mux into.
- IoSource
- A byte source FFmpeg can demux from.
- Media
Error - Shared classification for the
ff-*crate error types. - Preview
Compositor - An external compositor the preview runner can use in place of its built-in CPU
compositor. Implemented by
aviooverff-render; see the module docs.
Functions§
- apply
- Applies
commandtotimeline, returning a newTimeline. - map_
scene - Maps a derived layer set (bottom to top) at frame time
tto aGpuMapping. - map_
transition - The GPU node for
kind, orNonewhen it has no equivalent and must stay on the CPU path. - open
- Opens a media file and extracts its metadata.