FFmpeg libaom-av1 Encoder Configurations
This article provides a comprehensive guide to the standard
configurations for the libaom-av1 encoder in FFmpeg. You
will learn the essential parameters for controlling quality, encoding
speed, bitrate, and hardware utilization to optimize your AV1 video
compression workflow.
Constant Quality (CRF) Encoding
Constant Rate Factor (CRF) is the recommended encoding mode for general file storage and playback when you want to maintain a consistent visual quality throughout the video.
To use CRF mode with libaom-av1, you must set the video
bitrate to 0 (-b:v 0) and specify a CRF value using the
-crf flag.
- CRF Range: 0 to 63.
- Recommended Range: 24 to 34 (where 24 is high quality and 30+ is standard web quality).
- Command Example:
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 28 -b:v 0 -cpu-used 4 output.mkvSpeed vs. Quality Presets
(-cpu-used)
The -cpu-used parameter controls the trade-off between
encoding speed and compression efficiency.
- Range: 0 to 8 (some newer versions support up to 9).
- Lower values (0–3): Produce the best compression and smallest file sizes, but are extremely slow.
- Higher values (4–6): Offer the best balance of encoding speed and compression efficiency for standard use.
- Maximum values (7–8): Ideal for fast encoding or real-time streaming, though they result in larger file sizes.
The default value is usually 1 if not specified, which
is highly impractical for most users due to slow speeds. It is highly
recommended to explicitly set -cpu-used 4 or
-cpu-used 6.
Bitrate-Targeted Encoding (Two-Pass)
If you need your output video to fit a specific file size, you should use two-pass encoding with a target bitrate instead of CRF.
- First Pass Command:
ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M -cpu-used 4 -pass 1 -f null /dev/null- Second Pass Command:
ffmpeg -i input.mp4 -c:v libaom-av1 -b:v 2M -cpu-used 4 -pass 2 output.mp4(On Windows, replace /dev/null with
NUL)
Color Depth and Pixel Formats
AV1 strongly benefits from 10-bit color depth, even when the input source is only 8-bit. Encoding in 10-bit reduces color banding in gradients and improves overall compression efficiency.
- Standard 8-bit:
-pix_fmt yuv420p - Recommended 10-bit:
-pix_fmt yuv420p10le
To force 10-bit encoding, append the pixel format flag to your command:
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 26 -b:v 0 -pix_fmt yuv420p10le -cpu-used 4 output.mkvMulti-Threading and Performance Options
To ensure libaom-av1 utilizes modern multi-core
processors effectively, use the following parameters:
- Row-based Multithreading (
-row-mt 1): Enabled by default in modern FFmpeg builds, this switch allows the encoder to process rows of tiles in parallel, significantly speeding up execution on multi-core CPUs. - Tiles (
-tiles): Splitting the video frame into columns and rows allows for better parallel processing. A common configuration for 1080p video is-tiles 2x2(which splits the frame into 4 tiles).
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 28 -b:v 0 -pix_fmt yuv420p10le -cpu-used 4 -row-mt 1 -tiles 2x2 output.mkv