How to Encode 10-bit Video with libaom?
Encoding high-quality 10-bit AV1 video using the
libaom-av1 encoder requires explicitly defining the bit
depth, pixel format, and profile to ensure the encoder doesn’t default
to standard 8-bit output. This article covers the essential FFmpeg
command-line arguments needed to trigger 10-bit encoding, explains the
key parameters, and provides a complete, production-ready command
example.
Required Command-Line Arguments
To achieve a true 10-bit encode using libaom within
FFmpeg, you must specify three primary arguments:
-pix_fmt yuv420p10le: This is the most crucial argument. It forces FFmpeg to use a 10-bit planar pixel format (YUV 4:2:0, 10-bit little-endian). Without this, FFmpeg will likely downsample your source to 8-bit (yuv420p).-strict -2(or-strict experimental): Depending on your FFmpeg build version,libaomsupport may still be flagged as experimental for certain advanced configurations, so including this guardrail ensures the encoder initializes properly.-profile:v 0: AV1 Profile 0 supports 8-bit and 10-bit video with 4:2:0 chroma subsampling. Explicitly declaring it ensures compatibility across hardware decoders.
Example FFmpeg Command
Below is a standard command-line configuration that combines these required arguments with optimal quality settings for a 10-bit AV1 encode:
ffmpeg -i input.mp4 -c:v libaom-av1 -strict -2 -pix_fmt yuv420p10le -profile:v 0 -crf 24 -b:v 0 -cpu-used 4 output.mkvKey Parameter Breakdown
-c:v libaom-av1: Specifies the Alliance for Open Media (AOM) reference encoder.-crf 24: Sets the Constant Rate Factor. For 10-bit AV1, values between 20 and 30 offer an excellent balance between visual fidelity and file size.-b:v 0: Required when using CRF mode withlibaomto turn off default bitrate constraints, allowing the encoder to focus entirely on the target quality.-cpu-used 4: Controls the encoding speed-versus-quality tradeoff. Values range from 0 to 8. A value of 4 or 5 is recommended for a practical balance, as lower numbers are extremely slow.