Configure FFmpeg Thumbnail Filter Search Window
This article explains how to configure the search window size in the
FFmpeg thumbnail filter. By adjusting this parameter, you
can control the number of consecutive frames FFmpeg analyzes to select
the most representative image for your video thumbnail.
The FFmpeg thumbnail filter works by analyzing a
sequence of frames and choosing the one that best represents the entire
batch based on color histogram analysis. The size of this
sequence—referred to as the search window—is determined by a single
option within the filter.
The Search Window Parameter
To configure the search window size, you use the n
option (or simply pass a single numeric argument to the filter). This
number defines the frame cluster size.
The basic syntax is:
thumbnail=batch_sizeOr explicitly:
thumbnail=n=batch_sizeHow to Use It in a Command
By default, if you do not specify a value, FFmpeg uses a default search window size of 100 frames.
To change this window size, apply the video filter (-vf)
in your FFmpeg command. For example, to expand the search window to 300
frames to find a representative image from a wider selection, use the
following command:
ffmpeg -i input.mp4 -vf "thumbnail=300" -frames:v 1 output.pngChoosing the Right Window Size
- Smaller Window (e.g.,
thumbnail=50): Reduces memory usage and processing time. This is ideal for short clips or videos with frequent scene cuts where you want a quick, localized thumbnail. - Larger Window (e.g.,
thumbnail=500): Increases the analysis range, allowing FFmpeg to pick a higher-quality, more globally representative frame from a longer segment. Note that larger window sizes require FFmpeg to buffer more frames in memory, which increases RAM consumption during processing.