[FFmpeg-user] Scene detection -- numerical output?

Clément Bœsch ubitux at gmail.com
Thu Nov 8 07:40:51 CET 2012

On Wed, Nov 07, 2012 at 08:04:59PM -0800, David Liontooth wrote:
> The scene detection feature is a great addition:
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72868144e5862168a4f829557b7a41f686b8b12d
> Example:
> ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
> Set a threshold value between 0 and 1 for detecting a new scene.
> Increase the value to lower the number of detected scenes; sane
> values are typically between 0.3 and 0.5.
> Is it possible to get a numerical output (say, frame numbers)
> instead of the montage?

Random suggestions:
  ffmpeg -i input.avi -vf 'select=gt(scene\,.4),showinfo' -f null -
  ffprobe -show_frames -of compact=p=0 -f lavfi 'movie=video.avi,select=gt(scene\,.4)'

You'll get various information about the frames, such as timestamps.

If you absolutely need the frame number you can try to:
 - take the first example and add another showinfo at the beginning of the
   filtergraph; check if for a given frames it reaches the second showinfo
   (if so you can use the "n" value from the first showinfo)
 - take the second example, and replace the select with select=scene+1 (to
   call the scene detection but make sure all the frames are transmitted)
   and then look yourself at the last lavfi.scene_score meta information
   in what is printed to see if the score is a good enough one

I'm sure you can find various other simpler combinations.

Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20121108/188fe498/attachment.asc>

More information about the ffmpeg-user mailing list