Skip to main content

Crate rff_filter

Crate rff_filter 

Source
Expand description

rff-filter — frame filters, the libavfilter equivalent.

A FilterChain is the engine’s -vf graph: an ordered list of filters that each transform a raw VideoFrame into another. Built from an FFmpeg-style spec string (scale=320:240,crop=100:100:0:0) and applied between decode and encode in the transcode loop.

Filters operate on 8-bit planar YUV (4:2:0 / 4:2:2 / 4:4:4) for now; other layouts return Error::Unsupported. Each filter is a 1-in/1-out transform.

Structs§

AudioFilterChain
An ordered -af chain plus the resample target it requests, if any.
FilterChain
An ordered chain of filters (the -vf graph).
FilterComplex
A -filter_complex graph. For now it models the most-used multi-input operation: overlay — compositing a second input over the first (logo / watermark / picture-in-picture). The labels ([0:v][1:v]...) are parsed but the wiring is fixed: input 0 is the base, input 1 the overlay.

Traits§

Filter
One frame transform. Implementors map a video frame to a new video frame.

Functions§

overlay
Composite over onto a copy of base at (x, y), both 8-bit planar YUV of the same format. Overlay pixels replace the base (YUV carries no alpha); the overlay is clipped to the base bounds and (x, y) snaps down to the chroma grid so the planes stay aligned.
trim_audio_frame
Sample-accurate trim: keep the intersection of this frame with [start, end). The frame’s start time t must be known. Public because the engine’s -ss/-t window uses the same slice for audio — an audio “frame” can be arbitrarily large (a WAV decodes as one), so keep/drop at frame granularity would cut wildly wrong.