Configure VP9 tile-columns and tile-rows in FFmpeg
This article explains how to configure multi-threading in the FFmpeg
libvpx-vp9 encoder using the -tile-columns and
-tile-rows parameters. You will learn how these settings
work, how to calculate the correct values for your video resolution, and
how to apply them in your FFmpeg commands to speed up your encoding
process.
Understanding VP9 Tiles
The VP9 video codec allows you to split a video frame into a grid of independent “tiles.” Because these tiles are independent of each other, the encoder can process them in parallel using multiple CPU threads, significantly reducing encoding time.
The parameters used to control this grid are
-tile-columns and -tile-rows. These values are
set on a log2 scale: * Number of columns = \(2^{\text{tile-columns}}\) * Number
of rows = \(2^{\text{tile-rows}}\)
For example, setting -tile-columns 2 and
-tile-rows 1 creates a grid of 4 columns (\(2^2\)) and 2 rows (\(2^1\)), resulting in 8 independent
tiles.
Recommended Values by Resolution
VP9 has strict limitations on tile sizes to maintain compression efficiency. A single tile cannot be narrower than 256 pixels or wider than 4096 pixels.
Here are the standard recommended settings for common resolutions:
- 720p (1280x720):
-tile-columns 2(4 columns)-tile-rows 0(1 row)- Total tiles: 4
- 1080p (1920x1080):
-tile-columns 2(4 columns)-tile-rows 1(2 rows)- Total tiles: 8
- 4K (3840x2160):
-tile-columns 3(8 columns)-tile-rows 1(2 rows)- Total tiles: 16
FFmpeg Command Example
To utilize tiling effectively, you must also enable multi-threading
using the -threads parameter. The number of threads should
ideally equal the total number of tiles you have created.
Here is a practical FFmpeg command for encoding a 1080p video:
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M -tile-columns 2 -tile-rows 1 -threads 8 output.webmIn this command: * -tile-columns 2 splits the frame
width into 4 columns. * -tile-rows 1 splits the frame
height into 2 rows. * The total number of tiles is 8 (\(4 \times 2\)). * -threads 8
tells the encoder to spawn 8 threads to process the 8 tiles
simultaneously.
Using more tiles than you have available CPU threads will not yield additional performance benefits. Additionally, using an excessive number of tiles can slightly degrade compression efficiency and visual quality, so only configure as many tiles as your hardware can actively process in parallel.