Configure libaom AV1 Bit Depth in FFmpeg
This article provides a quick guide on how to configure the target
bit depth when encoding AV1 video using the libaom-av1
library in FFmpeg. It covers the essential pixel format parameters
needed to output 8-bit, 10-bit, or 12-bit color depths for your video
projects.
Setting Bit Depth via Pixel Format
In FFmpeg, the target bit depth for the libaom-av1
encoder is controlled by setting the output pixel format using the
-pix_fmt option. The encoder automatically detects this
setting and configures its internal bit depth to match.
The most common pixel formats for AV1 encoding are:
- 8-bit:
-pix_fmt yuv420p - 10-bit:
-pix_fmt yuv420p10le - 12-bit:
-pix_fmt yuv420p12le
10-Bit AV1 Encoding (Recommended)
Encoding in 10-bit is highly recommended for AV1, even if your source material is 8-bit. It significantly reduces compression artifacts like color banding and improves overall encoding efficiency.
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 28 -b:v 0 -pix_fmt yuv420p10le output.mkv8-Bit AV1 Encoding
If you require strict compatibility with older, 8-bit-only hardware players, you can force 8-bit output.
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 28 -b:v 0 -pix_fmt yuv420p output.mkv12-Bit AV1 Encoding
For professional mastering or high-dynamic-range (HDR) archiving, 12-bit encoding is supported by the AV1 High and Professional profiles.
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 28 -b:v 0 -pix_fmt yuv420p12le output.mkvVerifying the Bit Depth
After the encoding process is complete, you can verify that the file
was written with the correct bit depth by running
ffprobe:
ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt output.mkvThis command will output the pixel format (e.g.,
yuv420p10le for 10-bit), confirming the target bit depth
was successfully applied.