[FFmpeg-user] Scene detection

Peter B. pb at das-werkstatt.com
Mon Aug 8 16:12:54 CEST 2011

Quoting Dave Rice <dave at avpreserve.com>:
> For instance:
> ffmpeg -i input_file.mov -pix_fmt yuv420p -f yuv4mpegpipe - |  
> yuvdiff -g > frame_difference_values.txt
> You'll get a two column output of frame number and a number  
> representing the difference between the current frame and the prior.  
> Then determine a threshold for what is a scene cut, parse the output  
> to get the frame numbers of cuts, then use those to cut the desired  
> frames out.

For getting a list of detected scene cut offsets, I can also suggest  
using "shotdetect" by Johan Mathe:

(NOTE: The current release is quite old and contains some issues, but  
I've fixed some of them and Johan agreed to merge them back upstream -  
there's no official release containing those changes, but if you need  
them, let me know)

...you could take its output XML with the frame offset numbers, and  
use a XSLT stylesheet to generate the necessary ffmpeg commands which  
actually perform the cuts. However, that's just some implementation  
idea from the top of my head :)

Or is there any way to feed some sort of "edit list" to ffmpeg?

Peter B.

More information about the ffmpeg-user mailing list