What are the differences between the HuffYUV and ffvhuff codecs in FFmpeg?

Doing ffmpeg -codecs | grep -i huffyuv shows that my FFmpeg build supports three different versions of the HuffYUV lossless video codec:

DEVI.S ffvhuff Huffyuv FFmpeg variant
DEVI.S huffyuv HuffYUV
D.VI.S hymt HuffYUV MT

I understand that HuffYUV MT is multi-threaded, and that my build only seems to support decoding it, but what are the differences between the standard HuffYUV codec and ffvhuff, FFmpeg's version of it? Is this documented anywhere?

1

2 Answers

On the ffmpeg encoding side of things there are two main differences.

Pixel formats

ffvhuff supports many more pixel formats (44 vs 3).

Refer to ffmpeg -h encoder=ffvhuff and ffmpeg -h encoder=huffyuv for the list of supported pixel formats for each encoder.

Per-frame Huffman tables

ffvhuff supports per-frame (context-adaptive) Huffman tables which can result in a smaller output file size. But it is slower to encode because it forces the thread count to 1.

Default is not to use per-frame Huffman tables. It can be enabled with -context 1.

Other than pixel formats and per-frame Huffman tables they are pretty much identical.

7

What are the differences between the HuffYUV and ffvhuff codecs?

HuffYUV

HuffYUV was proposed by Ben Rudiak-Gould as an alternative to uncompressed Y CbCr video. It combines an intra-frame prediction with a consecutive Huffman entropy coding of the residuals. The intra-frame prediction selects between three different prediction models: left, gradient and median.

  • The first model, left, only uses the pixel l to predict the pixel x as x = l,

  • the second model, gradient, predicts x as x = l + a -d and

  • the median model selects the median value from the model left, the model gradient and from the pixel a above x

Note, that the model selection is not adaptive, but rather one model is selected a-priori to the encoding and then used for the complete video sequence. Also only a fixed table for the Huffmann code entropy encoding is used.

Added for context:

FFvYUV is an extension of HuffYUV developed by the FFmpeg project to address some of HuffYUV’s short-comings: instead of a fixed Huffman table, context-adaptive Huffman tables are used for the entropy encoding.

Source COMPARISON OF LOSSLESS VIDEO CODECS FOR CROWD-BASED QUALITY ASSESSMENT ON TABLETS (pdf) authored by Christian Keimel, Christopher Pangerl and Klaus Diepold.

The paper linked above includes a lot more information, images, and links to further resources.


ffvhuff

This codec was developed by ffmpeg.

It is a huffyuv like codec except it is not backwards compatible with huffyuv. However, it compresses better than huffyuv, supports yv12 colorspace, and is about as fast as huffyuv

Source ffvhuff? [Archive] - Doom9's Forum

6

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like