How to Configure CRF in FFmpeg libsvtav1

This guide explains how to set the Constant Rate Factor (CRF) for the SVT-AV1 encoder (libsvtav1) in FFmpeg. You will learn the exact command-line syntax, recommended CRF values for balancing quality and file size, and how to combine CRF with encoding presets to achieve optimal compression.

The Basic Command Syntax

To set the CRF value in FFmpeg using the libsvtav1 encoder, use the -crf flag followed by your desired quality number.

Here is the standard command structure:

ffmpeg -i input.mp4 -c:v libsvtav1 -crf 26 -preset 5 output.mkv

Parameter Breakdown:

  • -c:v libsvtav1: Specifies the Scalable Video Technology AV1 (SVT-AV1) encoder.
  • -crf 26: Sets the Constant Rate Factor.
  • -preset 5: Adjusts the encoding speed-to-compression ratio (ranges from 0 to 13, with lower numbers being slower but more efficient).

The CRF scale for libsvtav1 ranges from 0 to 63. Unlike older encoders like x264, SVT-AV1 is highly efficient at higher CRF values. Lower numbers yield higher quality at the expense of larger file sizes.

  • Ultra-High Quality (Archival): CRF 18 - 22
    • Best for 4K source material where visual fidelity is critical and file size is not a concern.
  • High Quality (Recommended Standard): CRF 24 - 28
    • The sweet spot for 1080p and 1440p video. It offers an excellent balance between visual transparency and highly compressed file sizes.
  • Medium Quality (Streaming/Web): CRF 30 - 35
    • Ideal for sharing videos online or archiving large libraries where saving storage space is the priority.

Pairing CRF with Presets

For the best results, you must pair your CRF value with an appropriate -preset. SVT-AV1 presets dictate how hard the encoder works to compress the video.

  • Presets 1 to 3: Extremely slow. Use only if you require absolute maximum compression efficiency.
  • Presets 4 to 6: The recommended range for high-quality personal encoding.
  • Presets 7 to 10: Fast encoding speeds suitable for real-time streaming or quick drafts.

For example, a highly optimized encode for a 1080p movie would look like this:

ffmpeg -i input.mp4 -c:v libsvtav1 -crf 24 -preset 4 -c:a libopus -b:a 128k output.mkv