Skip to main content

Encode

vv_media::Encoder writes the export: H.264 video plus optional AAC audio, muxed into MP4. It receives frames already composited and converted to I420 on the GPU, and audio already mixed; it only adapts the audio to the encoder's sample format and frame size. The export pipeline that feeds it is described in chapter 6.

encoder.png

Video encoders

CodecQuality control (default)
libx264CRF (20), preset superfast
h264_nvencVBR with cq (20), preset p5
h264_vulkanconstant QP (23), NV12 GPU frames
h264_videotoolboxconstant quality 1–100 (65), macOS only

Output is always tagged BT.709 limited range. NVENC is preselected when it is available; otherwise x264.

Availability check

An encoder compiled into FFmpeg may still be unusable (NVENC without an NVIDIA GPU, a Vulkan driver without an encode queue, an encoder that drops a chroma plane). VideoCodec::is_available therefore encodes five frames of a known color, decodes them back and compares Y/U/V within ±4. The result is cached; availability() runs the check on a thread so the export dialog never blocks.

Audio

Native aac (optionally the faster "fast" coder) or libfdk_aac when FFmpeg has it, 128 kbps by default. Samples are buffered until a full encoder frame is available.