How to Set Tile Rows and Columns in Libaom?

When encoding video with the AV1 codec using libaom, managing how a frame is split into grids—known as tiles—is crucial for multi-threaded performance and hardware decoding efficiency. This article explains how to explicitly specify the number of tile columns and rows using FFmpeg command-line flags. We will cover the standard parameters (-tile-columns and -tile-rows), how their values are calculated exponentially, and the practical trade-offs between encoding speed and video quality.

Understanding AV1 Tiles and Log2 Scaling

Unlike older codecs where you might specify the exact number of rows or columns directly, libaom uses a \(log_2\) scale for its tiling arguments. This means the value you pass to the encoder is the exponent of a power of 2.

The mathematical relationship is defined as:

\[\text{Number of Tiles} = 2^{\text{parameter}}\]

For example, if you want a specific number of subdivisions, you must pass the corresponding exponent:

FFmpeg Command Syntax for Libaom Tiling

To set these configurations in FFmpeg, use the -tile-columns and -tile-rows flags. Below is a practical example of a complete FFmpeg command configuring a 4x2 tile grid (4 columns and 2 rows, resulting in 8 total independent tiles):

ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -b:v 0 -tile-columns 2 -tile-rows 1 output.mkv

In this command:

Why Tile Specifications Matter

Adjusting your tile layout directly impacts two major areas of video processing:

For standard 1080p video, a setting of -tile-columns 2 -tile-rows 1 (a 4x2 grid) is generally considered the sweet spot for balancing multi-threading benefits without noticeably degrading compression efficiency. For 4K video, you can safely scale up to -tile-columns 3 -tile-rows 2 to accommodate the larger resolution.