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

Christoph Gerstbauer christophgerstbauer at gmail.com
Tue Apr 26 11:38:07 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

Hell Dave,
thank you for the hint. I am testing now different videos with QC tools 
(based on ffmpeg) and using the integrated Y filter to show a graph on 
the timeline. That works good. Looks like in Davinci Resolve scene cut 
filter :) And the peaks in the timeline hit hardly all hard cuts. Some 
false positives when flashing happens in video, but this does not matter.

But what I need is a syntax which I can use in FFmpeg commandline which 
uses the ydif function from the singalstats filter and force ffmpeg to 
output jpgs at the video position where this big peaks happen. But as I 
said, I have no idea how I can do it :/
I need a working formular/syntax for that. Do you have any idea how I 
this yntax would look like?

Best Regards
Christoph




More information about the ffmpeg-user mailing list