[FFmpeg-user] Cut detection with dynamic threshold possible?

Dave Rice dave at dericed.com
Mon Apr 25 22:17:28 CEST 2016

> On Apr 25, 2016, at 11:25 AM, Christoph Gerstbauer <christophgerstbauer at gmail.com> wrote:
> Hello,
> I want to make shotdetections (scene cut) with ffmpeg. (a shot is the video between 2 cuts)
> My syntax knowledge at this time offers to generate only the FIRST FRAME of each shot. NO LAST FRAME. It would be nice to find also the last frame of a shot, but anyway this ticket should focus on the threshold itself.
> Actual Syntax to generate shotdetection thumbnails with ffmpeg:
> ffmpeg -i <inputvideo> -vf select='gt(scene\,0.7)' -vsync 0 -an keyframes%03d.jpg
> the value "0.7" is the threshold.
> A higher one will lead to less scenes thumbails - low sensitivity
> A lower one will lead to much more thumbnails - high senisitivity
> I mentioned that shotdetection algorythms generally has problems with to dark scenes, so it would be fine to have a threshold which is DYNAMIC to find every cut in the video. But my "FFmpeg-Fu" is to weak to find a solution on my own.
> So, is it possible to use a dynamic threshold within ffmpeg scene detection, and  if yes -> how can I do that?

You could also consider using the YDIF values from the signalstats filter. It will quantify the visual difference in the Y plane from one frame to the next and thus spike on scene cuts.
Dave Rice

More information about the ffmpeg-user mailing list