Expand description
H.264 / AVC video codec, backed by the pure-Rust
rusty_h264 encoder + decoder.
This is the default H.264 implementation: register is wired into the
rff facade unconditionally, so -c:v h264 decodes and encodes through
rusty_h264 with no C and no FFI. (The C openh264 path still exists behind
the opt-in h264-openh264 feature and overrides this when enabled.)
Bitstream is Annex-B, pixels are YUV 4:2:0 — the same shape the
openh264 path uses, so the MP4 demuxer’s AVCC→Annex-B conversion upstream
feeds this decoder directly. rusty_h264’s default-features are off here
(no process-wide allocator, the portable scalar kernels); turn on this
crate’s asm feature for its portable Rust SIMD (SSE2/AVX2/NEON — no
assembler, no C).
§Encoder options
configure reads the FFmpeg-shaped options the CLI forwards:
-preset fast|medium|slow— x264’s ladder collapses ontorusty_h264’s three:ultrafast..fast→Fast,medium→Balanced,slow..placebo→Quality.-profile baseline|main|high.baselineis Constrained Baseline: CAVLC, no 8×8 transform, no B-frames, one reference, no lookahead, no scene cut — the configuration a chip runs (rusty_esp_video’schip_config), so anrffencode on the host reproduces a device’s stream byte for byte at the same preset, GOP, bitrate and QP.-g N(keyframe interval, also the minimum),-b:v RATE,-qp Q.
§Buffering
rusty_h264 0.12 runs a lookahead by default (mb-tree over a GOP): an
encode call may return nothing, then a whole GOP of access units at once,
and flush returns the tail. The adapter splits those into one packet per
access unit and carries each frame’s pts through the delay in order (no
B-frames, so coding order is presentation order). Baseline turns the
lookahead off, so it is one packet per frame with no delay.
Functions§
- register
- Register the pure-Rust H.264 codec into a
CodecRegistry.