FFmpeg SVT-AV1 Encoding with Custom Presets

This article provides a practical guide on how to transcode video files using the highly efficient SVT-AV1 encoder (libsvtav1) in FFmpeg. You will learn how to configure the encoder, use presets to balance speed and quality, set up rate control, and pass advanced custom parameters to optimize your video outputs.

Basic Command Syntax

To transcode a video using SVT-AV1, you must specify libsvtav1 as the video codec. The most basic command structure looks like this:

ffmpeg -i input.mp4 -c:v libsvtav1 -preset 6 -crf 26 -c:a libopus output.mkv

Choosing the Right Preset

SVT-AV1 uses a preset scale ranging from 0 to 13 to control the trade-off between encoding speed and compression efficiency. * Presets 0 to 3: Extremely slow. These are intended for research or maximizing compression efficiency at the cost of immense encoding time. * Presets 4 to 6: Recommended for high-quality archival encoding. They offer a great balance of high compression efficiency and reasonable encoding speeds. * Presets 7 to 10: Ideal for faster encoding or personal streaming projects where speed is prioritized over file size. * Presets 11 to 13: Ultra-fast, designed for real-time streaming, but with a noticeable reduction in compression efficiency.

You apply a preset using the -preset flag:

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

Controlling Quality and Bitrate

There are two primary ways to manage output size and quality in SVT-AV1: Constant Rate Factor (CRF) and Target Bitrate.

1. Constant Rate Factor (CRF)

CRF is the recommended rate control method for general encoding. It targets a consistent visual quality throughout the video. SVT-AV1 accepts CRF values from 0 to 63 (lower values mean higher quality and larger file sizes).

ffmpeg -i input.mp4 -c:v libsvtav1 -preset 6 -crf 24 output.mkv

2. Target Bitrate (ABR/VBR)

If you need to target a specific file size, you can specify a target average bitrate instead of CRF:

ffmpeg -i input.mp4 -c:v libsvtav1 -preset 6 -b:v 2M output.mkv

Advanced Tuning with -svtav1-params

For deeper customization, you can pass native SVT-AV1 encoder parameters directly through FFmpeg using the -svtav1-params flag. Multiple parameters are separated by colons.

Key parameters include: * tune=0 (visually optimized) or tune=1 (PSNR/SSIM optimized). * keyint=X (sets the maximum GOP size / keyframe interval). * film-grain=X (applies synthetic film grain synthesis to save bitrate on noisy videos, values ranging from 1 to 50).

Example with Custom Parameters:

ffmpeg -i input.mp4 -c:v libsvtav1 -preset 5 -crf 26 -svtav1-params tune=0:keyint=240:film-grain=8 -c:a copy output.mkv