Adjust FFmpeg scdet Scene Change Threshold

This article explains how to adjust the scene change detection threshold using FFmpeg’s scdet filter. You will learn the specific command-line syntax, how the threshold parameter affects detection sensitivity, and how to apply these settings to customize your video processing workflow.

Understanding the scdet Threshold Parameter

The scdet (scene detection) filter in FFmpeg detects scene changes by comparing the intensity differences between consecutive frames. The primary parameter used to control this sensitivity is threshold (which can also be abbreviated as t).

  • Default Value: 10.0
  • Range: 0 to 100

How the Threshold Value Affects Sensitivity

  • Lowering the Threshold (e.g., 5.0): Makes the filter more sensitive. FFmpeg will trigger a scene change for minor visual variations, resulting in more detected cuts.
  • Raising the Threshold (e.g., 20.0): Makes the filter less sensitive. FFmpeg will only register a scene change during drastic visual shifts, resulting in fewer detected cuts.

FFmpeg Command Examples

To adjust the threshold, pass the threshold or t option to the scdet filter.

To set the threshold to 15.0 and print the detected scene change metadata to the console, use the following command:

ffmpeg -i input.mp4 -vf "scdet=threshold=15.0,metadata=print" -f null -

To use the shorthand t and output the results directly to a text file instead of the terminal, use this command:

ffmpeg -i input.mp4 -vf "scdet=t=12.5,metadata=print:file=scenes.txt" -f null -

Tips for Fine-Tuning

  • For Action Videos: High-motion videos with fast camera panning can trigger false positives. Raise the threshold to 15.0 or 20.0 to ensure only actual camera cuts are detected.
  • For Talking Head/Slow Videos: Videos with minimal motion may require a lower threshold, such as 5.0 to 8.0, to capture subtle transitions between scenes.