Create Video Grids with FFmpeg Tile Filter

This guide explains how to use the FFmpeg tile video filter to automatically arrange a sequence of video frames into a custom grid collage image. You will learn the core syntax of the filter, how to define the grid dimensions, how to control frame selection so your collage covers the entire video duration, and how to customize the layout with padding, margins, and background colors.

Understanding the Tile Filter Syntax

The tile filter takes consecutive frames from an input video and arranges them into a single, grid-formatted image. The most basic syntax for the filter is:

tile=columnsxrows

For example, tile=3x2 will create a grid with 3 columns and 2 rows, containing a total of 6 frames.

Basic Command to Generate a Grid

If you run the tile filter on a standard video without limiting the input frames, FFmpeg will simply grab the first few frames of the video (which are often identical or black) and put them into the grid. To create a meaningful collage, you must scale the frames down and choose which frames to capture.

Here is a standard command to create a 3x3 grid collage from a video:

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

How this command works:

Customizing the Grid Layout

The tile filter offers several optional parameters to customize the visual appearance of your collage, such as adding borders and changing the background color.

The extended syntax is:

tile=layout:margin:padding:color

Example with Custom Styling:

To create a 4x4 grid with a 10-pixel outer margin, 5-pixel gaps between the images, and a white background, use the following command:

ffmpeg -i input.mp4 -vf "select='not(mod(n,50))',scale=240:-1,tile=4x4:margin=10:padding=5:color=white" -vsync vfr collage.png

Creating Collages by Time Intervals

If you prefer to capture frames at specific time intervals (for example, one frame every 10 seconds) rather than by frame count, you can use the fps filter before the tile filter:

ffmpeg -i input.mp4 -vf "fps=1/10,scale=300:-1,tile=5x2" -vsync vfr timeline_collage.png

In this command, fps=1/10 extracts one frame every 10 seconds, which are then scaled and arranged into a 5x2 grid.