Transcode AV1 with libaom and Custom Tiles in FFmpeg
This guide explains how to transcode video files into the AV1 format
using FFmpeg’s libaom-av1 encoder while configuring custom
tile columns and rows. By leveraging custom tiling, you can
significantly improve encoding speed through multi-threading and
optimize the video for parallel decoding.
Understanding AV1 Tiles
AV1 tiles divide a video frame into a grid of independent regions. This separation allows the encoder and decoder to process different parts of the frame simultaneously using multiple CPU threads.
In libaom-av1, tile parameters are defined using \(\log_2\) values. This means the value you
input represents the exponent of 2: *
-tile-columns: A value of 1
creates \(2^1\) (2) columns. A value of
2 creates \(2^2\) (4)
columns. * -tile-rows: A value of
1 creates \(2^1\) (2)
rows. A value of 2 creates \(2^2\) (4) rows.
For example, setting -tile-columns 2 and
-tile-rows 1 creates a grid of 4 columns and 2 rows,
resulting in 8 independent tiles.
The FFmpeg Command
To transcode a video using the libaom-av1 encoder with
custom tiles, run the following command in your terminal:
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -b:v 0 -tile-columns 2 -tile-rows 1 -threads 8 -strict experimental output.mkvParameter Breakdown
-i input.mp4: Specifies your source video file.-c:v libaom-av1: Selects the reference AV1 encoder (libaom).-crf 30: Sets the Constant Rate Factor. Lower values result in higher quality and larger file sizes. A range of 24 to 34 is standard for AV1.-b:v 0: Required when using CRF mode withlibaom-av1to ensure the encoder targets quality rather than a specific bitrate.-tile-columns 2: Splits the frame into 4 vertical columns (\(2^2\)).-tile-rows 1: Splits the frame into 2 horizontal rows (\(2^1\)).-threads 8: Dictates the number of CPU threads FFmpeg should use. To maximize encoding speed, ensure your thread count is equal to or greater than the number of tiles created (in this case, 8 tiles require at least 8 threads).-strict experimental: Enables the use of the encoder if you are running an older version of FFmpeg where AV1 support is still flagged as experimental.
Recommended Tile Configurations by Resolution
To maintain coding efficiency, use tile layouts that match your video resolution:
- 1080p (Full HD):
-tile-columns 2 -tile-rows 1(8 tiles) - 4K (Ultra HD):
-tile-columns 3 -tile-rows 2(32 tiles) - 720p (HD):
-tile-columns 1 -tile-rows 1(4 tiles)