[FFmpeg-user] Grab stills on scene change math question

Moritz Barsnick barsnick at gmx.net
Tue Aug 25 13:45:51 CEST 2015

Hi Bouke,

On Tue, Aug 25, 2015 at 13:00:40 +0200, Bouke (VideoToolShed) wrote:
> assuming that gt(scene\,0.4) will return a number that I could do math on, 
> but this fails.

ffmpeg's expressions give the select filter a true/false (take or don't
take this frame) decision. In this case: scene detection shows a change
of 0.4 or more, principally.

> And to make it more complex, can I also grab a shot out of the middle
> of a scene? (that would require to get the current and next
> framenumber, subtract and divide by two to an integer and add to the
> first...)

I wish I knew. I don't think such a filter exists. Part of the issue is
that ffmpeg would need to look ahead, and buffer a lot of data (which
it does for other filters as well).

What you could do is to parse the video for scene changes first,
calculate the images you want, and present them to the select filter in
the second run.


More information about the ffmpeg-user mailing list