How to Use the FFmpeg Tile Filter

The FFmpeg tile filter is a powerful tool used to combine multiple consecutive video frames into a single grid-like image or video. This article provides a clear, step-by-step guide on how to use the tile filter, explaining its core parameters, basic syntax, and practical command-line examples to help you create custom video contact sheets and thumbnail grids.

Basic Syntax of the Tile Filter

The most basic implementation of the tile filter requires you to define the grid layout using columns and rows. The syntax is:

tile=columnsxrows

For example, tile=3x2 will arrange six consecutive video frames into a grid of 3 columns and 2 rows.

Key Parameters

To customize your grid, you can append several optional parameters to the filter:

Practical Examples

Here are common ways to use the tile filter in your terminal.

Example 1: Creating a Video Contact Sheet (Thumbnail Grid)

To create a single image containing a 3x3 grid of frames taken at regular intervals, you can combine the select filter, the scale filter, and the tile filter:

ffmpeg -i input.mp4 -vf "select='not(mod(n,100))',scale=320:-1,tile=3x3" -frames:v 1 output.png

Example 2: Adding Padding and Custom Background Color

To make the grid easier to read, you can add spacing between the images and change the background color to white:

ffmpeg -i input.mp4 -vf "scale=200:-1,tile=4x4:padding=10:color=white" -frames:v 1 output.png

In this command, tile=4x4:padding=10:color=white creates a 16-frame grid with 10 pixels of white space separating each thumbnail.

Example 3: Creating a Continuous Tiled Video

If you do not limit the output to one frame using -frames:v 1, FFmpeg will continuously generate grids for the entire duration of the video, creating a new grid video:

ffmpeg -i input.mp4 -vf "scale=160:120,tile=2x2" output.mp4

This command outputs a new video file where every frame is a 2x2 grid containing 4 frames from the original video playing in sequence.