Version 2 (modified by slhck, 2 years ago) (diff)

improve AV1 guide (only based on documentation, but the previous content was not correct anyway)

FFmpeg and libaom AV1 Encoding Guide


libaom-av1 is the AOMedia video encoder for AV1, an open, royalty-free media file format. libaom-av1 can save about 30% bitrate compared to VP9 and H.265 / HEVC while retaining the same visual quality.

To install FFmpeg with support for llibaom-av1, look at the Compilation Guides and compile FFmpeg with the --enable-libaom option.

The default audio encoder for AV1 is libopus.

libaom offers different rate control modes, which determine the quality and file size:

  • 1-pass average bitrate
  • 2-pass average bitrate
  • Constant quality

For a list of options, run ffmpeg -h encoder=libaom-av1.

Note: AV1 encoding is very slow in comparison to VP9 or H.264, and considered experimental at this stage.

Average Bitrate (ABR)

libaom-av1 offers a simple "Average Bitrate" or "Target Bitrate" mode. In this mode, it will simply try to reach the specified bit rate on average, e.g. 2 MBit/s.

ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M -c:a opus -strict -2 av1_test.mkv

Only use this option if you do not care about acheiving the best possible quality.

Constant Quality

In addition to the "default" VBR mode, there's a constant quality (CQ) mode (like CRF in the x264 encoder) that will ensure that every frame gets the number of bits it deserves to achieve a certain (perceptual) quality level, rather than forcing the stream to have an average bit rate. This results in better overall quality. If you do not care about the file size, this should be your method of choice.

ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -c:a opus -strict -2 av1_test.mkv

The CRF value can be from 0–63. Lower values mean better quality.

Controlling Speed / Quality

-cpu-used sets how efficient the compression will be. The default is 1. Lower values mean slower encoding with better quality, and vice-versa.