FFmpeg AV1 Encoding: Standard Command Guide

This guide details the standard command-line parameters required to encode video using the modern AV1 codec in FFmpeg. It focuses on using the recommended SVT-AV1 encoder (libsvtav1), breaking down the essential flags for rate control, encoding presets, pixel formats, and audio handling to help you achieve an optimal balance between file size, visual quality, and encoding speed.

Standard Encoding Command

The default and most widely supported production encoder for AV1 in modern FFmpeg builds is SVT-AV1. The standard command for a typical Constant Rate Factor (CRF) encode is:

ffmpeg -i input.mp4 -c:v libsvtav1 -crf 30 -preset 5 -pix_fmt yuv420p10le -c:a libopus -b:a 128k output.mkv

Essential Parameter Breakdown

  • -c:v libsvtav1: Specifies the video encoder. SVT-AV1 is significantly faster and more practical for consumer use than the reference encoder libaom-av1.
  • -crf [0–63]: Sets the Constant Rate Factor for variable bitrate encoding targeting a specific visual quality.
    • Lower values mean higher quality and larger files.
    • Recommended range: 24 to 35. A value of 28 to 32 is considered the standard sweet spot for standard-definition to 4K content.
  • -preset [0–13]: Controls the trade-off between encoding speed and compression efficiency.
    • Lower numbers yield better compression and higher quality per bit but encode much slower.
    • Higher numbers encode faster at the cost of larger file sizes.
    • Recommended range: 4 to 6 for high-quality archiving; 7 to 8 for faster everyday encodes.
  • -pix_fmt yuv420p10le: Sets the pixel format to 10-bit YUV 4:2:0. Even when your source material is 8-bit, encoding AV1 in 10-bit is strongly recommended because it reduces color banding and compression artifacts with minimal performance penalty.
  • -c:a libopus -b:a 128k: Encodes audio using the Opus codec at 128 kbps, which pairs natively with modern AV1 workflows. If you prefer to keep original audio without re-encoding, replace this with -c:a copy.

Alternative: Two-Pass Target Bitrate

If you need a specific target file size rather than variable quality, use a two-pass approach with a specified average bitrate:

Pass 1:

ffmpeg -i input.mp4 -c:v libsvtav1 -b:v 2500k -preset 5 -pass 1 -an -f null /dev/null

Pass 2:

ffmpeg -i input.mp4 -c:v libsvtav1 -b:v 2500k -preset 5 -pass 2 -c:a libopus -b:a 128k output.mp4

(On Windows systems, replace /dev/null with NUL.)

Reference Encoder Alternative: libaom-av1

If your FFmpeg installation lacks libsvtav1 and relies on the reference libaom-av1 encoder, use the following syntax:

ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -b:v 0 -cpu-used 4 -pix_fmt yuv420p10le -c:a copy output.mkv
  • -b:v 0: Required when using -crf with libaom-av1 to enable true constant quality mode.
  • -cpu-used [0–8]: The speed preset flag for AOM (values 4 to 6 are typical for general use).