Codec Comparisons
Table of contents
Ffmpeg supports over 100 video codecs, but only a fraction of those are really worth a deeper dive.
We are going to focus on codecs that match one of the following conditions:
- Supported by common web browsers.
- Have good compression ratios with good color fidelity.
- Supported by common apps, e.g. Resolve, RV, AVID.
- Commonly requested as a delivery format by studios or clients.
Codecs reviewed
Codec Family | ffmpeg codec | Bit depth | Pixel format supported | Web Support | HDR |
---|---|---|---|---|---|
h264 | x264 | 8 10 | YUV-4:4:4 yuv-4:2:2 YUV-4:2:0 | All Browsers | HLG |
VP9 | libvpx-vp9 | 8 10 12 | yuv-4:2:0 yuv-4:2:2 yuv-4:4:4 rgb rgb-10 rgb-12 | All Browsers | Yes |
HEVC/H265 | libx265 | 8 10 12 | yuv-4:2:0 yuv-4:2:2 yuv-4:4:4 rgb rgb-10 rgb-12 | All browsers | Yes |
HEVC/H265 | hevc_videotoolbox | 8 10 | yuv-4:2:0 yuv-4:2:2 yuv-4:4:4 rgb rgb-10 rgb-12 | All browsers | Yes |
AV1 | libsvtav1 | 8 10 | yuv-4:2:0 | Chrome Firefox Edge | Yes |
Prores | prores_ks | 10 | yuv-4:4:4 yuv-4:2:2 | Safari | ? |
DNxHD | dnxhd | 8 10 | yuv-4:2:2 yuv-4:4:4 rgb | no | ? |
Mjpeg | mjpeg | 8 | yuv-4:2:2 yuv-4:4:4 | no | no |
For a high level comparison we have encoded 4 sets of media using our recommended settings, all with the aim of getting the VMAF score > 98. libx264 libstvav1 and vp9 were all encoded 4:2:0 and DNxHD and Prores were at 10-bit 4:2:2.
For details on codec flags, and how we picked the parameters, do goto the page for each codec.
Comparing encoding time for codecs applied to different media. |
Comparing filesize for codecs applied to different media. |
Comparing VMAF score for codecs applied to different media. |
Comparing PSNR-Y harmonic mean for codecs applied to different media. |
Uncompressed containers
Y4m is a terrific container for uncompressed media. It allows uncompressed raw YCrCb data to be stored with a simple header.
Uncompressed Codecs.
Ffmpeg has support for a small number of uncompressed codecs that are worth using for testing. We don’t recommend any of them for day-to-day use.
Codec | Description | Pix Fmt | Notes |
---|---|---|---|
v410 | 444 10-bit | yuv444p10le | |
v408 | 4444 8-bit with alpha | yuva444p | Quicktime compatible |
v308 | 444 8-bit packed | yuv444p | |
v210 | 422 10-bit | yuv422p10le | |
r210 | RGB 10-bit | ||
png | PNG inside a Quicktime, either 8 or 16-bit with or without alpha | rgb24 rgba rgb48be rgba64be pal8 gray ya8 gray16be ya16be monob |
Other codecs worth considering.
Below are other codecs that may be worth considering at some point.
Codec | Profile description | Pix Fmt | Notes |
---|---|---|---|
jpeg2000 | jpeg2000 codec | ||
libopenjpeg | jpeg2000 codec using the libopenjpeg library | ||
hap | HAP and HAPQ codec | rgba | HAP - Fast GPU decompression, at the expense of file-size |
LCEVC | Low Complexity Enhancement Video Coding |
See:
- https://blog.frame.io/2017/02/13/compare-50-intermediate-codecs/
HTJ2K
HTJ2K is a modification of the JPEG2000 codecs, where it has been modified to be more scalable, and significantly faster than the original jpeg2000 codec at the expense of a slight increase in file-size. The modification is now part of the JPEG2000 spec, and the decoder is now built into ffmpeg.
The codec is royalty free, and there are several open source implementations with non-GPL licenses.
TODO Investigate.
See:
- https://htj2k.com/
- https://www.frontiersin.org/articles/10.3389/frsip.2022.885644/full
- https://github.com/osamu620/OpenHTJ2K
See Also
- Another good reference for encoding options is here: https://trac.ffmpeg.org/wiki/Encode/VFX although the page is a little out of date.