Expand description
Video filters — per-frame transforms applied to decoded frames before per-rung scaling and encoding.
The canonical representation is a list of VideoFilter values. Two
kinds:
- Stateless filters (
applyruns them directly): crop, pad, hflip, vflip, rotate, grayscale (geometry, any bit depth) + invert, brightness, contrast, saturation (colour, 8-bit). - Resource filters need a one-time setup before they can run per frame —
overlayloads its PNG and converts it to YUV + alpha. Build aFilterChainwithFilterChain::prepare(loads overlays once) and callFilterChain::applyper frame.
Two interchangeable serializations (they round-trip:
parse_chain(&chain_to_string(c)) == c):
- Structured objects (serde feature) — a YAML/JSON DSL writes a chain as
a list of objects:
[{crop: {w,h}}, hflip, {overlay: {image: "logo.png"}}]. - Textual ffmpeg-
-vfstyle —parse_chain/ [Display]:crop=1280:720,hflip,overlay=logo.png:24:24.
Geometric ops are pure sample rearrangement (run on raw bytes, any bit
depth). Colour + overlay ops work on 8-bit Yuv420p (the default SDR output).
Structs§
- Filter
Chain - A filter chain with its resources prepared (overlay PNGs loaded + converted).
Build once with
prepare, thenapplyper frame.
Enums§
- Video
Filter - One video-filter step. The canonical, code-interpreted representation.
Functions§
- apply
- Apply one stateless filter. (
Overlayerrors here — useFilterChain.) - apply_
chain - Apply a whole stateless chain to a frame, in order. Returns an error if
the chain contains an
overlay(useFilterChainfor that). - chain_
to_ string - A whole chain as a comma-separated textual string (the inverse of
parse_chain). - parse_
chain - Parse an ffmpeg-
-vf-style chain, e.g."crop=1280:720,hflip".