FFvHuff

From wiki.selur.net
Jump to navigation Jump to search

FFvHuff is ffmpeg's extended variant of the lossless codec Huffyuv. Every frame is stored without any loss; it compresses less than FFV1, but encodes and decodes very fast. Compared to the original Huffyuv it adds more color formats and bit depths. Hybrid encodes it with ffmpeg's ffvhuff encoder.

Base → Video: FFvHuff, then the FFvHuff tab

FFvHuff tab in Hybrid
FFvHuff tab in Hybrid

What it does

FFvHuff predicts every sample from its neighbour and stores the difference with Huffman codes. There is no quantization, so decoding gives back exactly the encoder's input, and no quality or bit rate setting. Every frame is coded on its own, which makes the format well suited as an intermediate for editing and for capturing.

Lossless refers to what the encoder receives. If the source has to be converted first (for example 10-bit 4:2:0 to 8-bit 4:4:4), that conversion is not lossless; set Color space and Bit depth to what the source has.

Requirements

ffmpeg, which is part of Hybrid on every system. FFvHuff is an ffmpeg format: it plays in ffmpeg-based players and tools, and goes into Matroska, AVI, MOV and NUT.

Settings

Control ffmpeg option Range / values Hybrid default Meaning
non-deterministic -non_deterministic on/off on Lets ffmpeg use several threads also where that makes the output depend on the thread timing (for example with Context large). The video stays lossless, but two encodes of the same source are not necessarily bit-identical. Switch it off when files have to be reproducible.
Context -context small, large small small (-context 0) uses one set of Huffman tables for the whole stream. large (-context 1) builds tables per frame and stores them with the frame, which gives smaller files and is slower.
Color space -pix_fmt rgb, i444, i422, i420 i444 Color format of the output: RGB, or YUV with 4:4:4, 4:2:2 or 4:2:0 chroma subsampling.
Bit depth -pix_fmt 8-bit, 10-bit, 16-bit 8-bit Bit depth of the output. Together with Color space it gives the pixel format, e.g. yuv444p or yuv420p10le. It should match the source: a higher depth wastes space, a lower one drops information.
Interlacing -flags +ildct+ilme on/off off Encode the output as interlaced.
(field order) -vf setfield auto, top field first, bottom field first auto Field order that is flagged in the output. auto takes the scan order of the video that Hybrid feeds to the encoder. Only available with Interlacing on.

The Configuration row at the bottom saves, loads and deletes named sets of these settings.

Example

Color space i444, Bit depth 8-bit, Context small and non-deterministic on, with a 10-bit YUV 4:2:0 source (640x352, 25 fps); Hybrid converts the video to 8-bit 4:4:4 in the script, because that is what is set:

vspipe "encodingTempSynthSkript.vpy" - --outputindex 0 -c y4m --progress | ffmpeg -y -noautorotate -nostdin -threads 8 -color_primaries bt470bg -color_trc smpte170m -colorspace bt470bg -color_range tv -f yuv4mpegpipe -i - -an -sn -color_primaries bt470bg -color_trc smpte170m -colorspace bt470bg -color_range tv -pix_fmt yuv444p -fps_mode auto -r 25/1 -vcodec ffvhuff -context 0 -non_deterministic true -metadata encoding_tool="Hybrid 2026.11.22.1" "test.mkv"

How Hybrid calls it

  • The filter script (Vapoursynth or AviSynth) is piped into ffmpeg; without a script ffmpeg reads the source itself.
  • The script already delivers the color format and bit depth chosen on the tab, so ffmpeg does not convert again.
  • -context is always written; -non_deterministic true only when the checkbox is set.
  • The prediction method of the encoder (-pred) is not set; ffmpeg uses left.
  • With Interlacing on Hybrid adds -flags +ildct+ilme and sets the field order with -vf setfield=tff or setfield=bff. Progressive input is then turned into interlaced video at half the frame rate, see Interlace.
  • Color matrix, transfer, primaries and range of the video are passed to ffmpeg as -colorspace, -color_trc, -color_primaries and -color_range.
  • The number of ffmpeg threads follows Hybrid's general thread setting.

Sources