[FFmpeg-user] Scene detection

Dave Rice dave at avpreserve.com
Mon Aug 8 15:31:39 CEST 2011


On Aug 7, 2011, at 10:16 AM, lovelove wrote:

> Hi, can someone please help a desperate soul like me?
> 
> I am in the same situation as Fori Pepe
> 
> 
> Fori Pepe wrote:
>> 
>> I would like to export/extract images from videos at every scene changes.
>> Is it possible to use ffmpeg to create images on scene changes?
>> It would be the most comfortable to use it like this: 
>> ffmpeg -i test.mpg --detect_scene_changes newscene[00-99].png
>> 
> 
> ... i.e. export first frame of each new scene as an image. This effectively
> generates a storyboard.
> It also would be an enormous help in identifying added and deleted scenes
> when comparing 2 videos.

I don't know how to do this in ffmpeg along, but you could pipe yuv4mpegpipe output from ffmpeg to yuvdiff. See: http://www.silicontrip.net/~mark/view.php/lavtools/20100906-yuvdiff

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.

Dave Rice
avpreserve.com


More information about the ffmpeg-user mailing list