Transcode Video to AV1 with Native FFmpeg Encoder

This guide provides a straightforward walkthrough on how to transcode video files into the AV1 format using FFmpeg’s native, experimental AV1 encoder. You will learn the exact command-line syntax, the necessary flags to unlock experimental codecs, and how to adjust quality and audio settings for optimal results.

The Basic Command

FFmpeg includes a native AV1 write-encoder (simply named av1). Because it is still classed as experimental, you must explicitly instruct FFmpeg to allow experimental features using the -strict -2 or -strict experimental flag.

The most basic command to transcode a video using the native AV1 encoder is:

ffmpeg -i input.mp4 -c:v av1 -strict -2 output.mkv

Here is what each parameter does: * -i input.mp4: Specifies your input video file. * -c:v av1: Selects the native AV1 video encoder. * -strict -2 (or -strict experimental): Bypasses the safety block for experimental encoders. * output.mkv: The name of your output file (MKV or MP4 containers are recommended for AV1).

Controlling Output Quality

To get the best balance between file size and visual quality, you should control the bitrate or use Constant Rate Factor (CRF) mode.

Method 1: Using Constant Rate Factor (CRF)

CRF is the recommended method for 1-pass encoding. It maintains a constant quality throughout the video. The scale for the native AV1 encoder typically ranges from 0 to 63, where lower values mean higher quality.

ffmpeg -i input.mp4 -c:v av1 -strict -2 -crf 30 output.mkv

Method 2: Setting a Target Bitrate

If you need your file to target a specific size, you can set a target average bitrate instead of CRF.

ffmpeg -i input.mp4 -c:v av1 -strict -2 -b:v 2M output.mkv

Handling Audio

By default, FFmpeg will attempt to transcode the audio stream. To ensure compatibility with modern AV1 video, it is common to either copy the audio stream directly or transcode it to a highly efficient format like Opus.

Copying Audio (No Transcoding)

If you want to keep the original audio track without losing quality:

ffmpeg -i input.mp4 -c:v av1 -strict -2 -c:a copy output.mkv

Encoding Audio to Opus

If you want to compress the audio to Opus to save space:

ffmpeg -i input.mp4 -c:v av1 -strict -2 -c:a libopus -b:a 128k output.mkv