FFmpeg Select Filter: Export Scene Change Frames

Detecting and exporting frames where a scene transition occurs is a highly efficient way to analyze video content, create storyboards, or generate preview thumbnails. This article provides a concise guide on how to use FFmpeg’s select filter with the scene evaluation parameter to identify these transitions and export only the exact frames where a scene change happens.

The FFmpeg Command

To extract scene changes, you use the video filter (-vf) with the select filter. Here is the standard command:

ffmpeg -i input.mp4 -vf "select='gt(scene,0.4)'" -fps_mode vfr frame_%04d.png

(Note: If you are using an older version of FFmpeg, replace -fps_mode vfr with -vsync vfr or -vsync 0).

Command Breakdown

Adjusting Sensitivity

The 0.4 threshold works well for most standard videos, but you can adjust this value to change the sensitivity of the detection: