[FFmpeg-user] Scene detection
Stefano Sabatini
stefano.sabatini-lala at poste.it
Tue Aug 9 00:25:57 CEST 2011
On date Monday 2011-08-08 16:12:54 +0200, Peter B. encoded:
> 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:
> http://shotdetect.nonutc.fr/
>
> (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?
Scene-detection looks like a much requested feature, please file a
feature request on the issue tracker. I'll hope we'll be able to find
some mechanisms for allowing users to (micro?)fund and vote on the
issues/features they want to be fixed.
On the technical side: this has been already discussed on
ffmpeg-devel, an underkill solution may be as simple as tweaking the
select filter and adopt a simple pixel-per-pixel average difference as
metric.
For images with moving objects that's not a proper solution, and you
need motion estimation code, which is already integrated in
libavcodec, so the ideal solution would be to refactor the ME code in
libavcodec and move it to libavutil. By doing this you may also
improve the code itself, and thus improve the codecs using it at the
same time.
--
ffmpeg-user random tip #19
X11 session recording with ffmpeg:
ffmpeg -f oss -i /dev/audio -f x11grab -s $WIDTHx$HEIGHT -r 5 -i :0.0 \
x11-session.avi
Use xdpyinfo to get WIDTH and HEIGHT values.
More information about the ffmpeg-user
mailing list