[FFmpeg-user] extract frames every n frames

Moritz Barsnick barsnick at gmx.net
Thu Apr 25 01:57:26 EEST 2019


Hi Francesco,

On Wed, Apr 24, 2019 at 16:14:56 +0200, Francesco Piasentini wrote:
> I need to extract frames every n frames.
> Is there an option in ffmpeg?

Sure. There's the "select" filter, which can take any kind of complex
expression. Your requirement is even documented among the examples:

https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect

Every 100th frame:
$ ffmpeg -i input -vf select='not(mod(n\,100))' output

(Note that this will usually not speed up a video, because the
timestamps are retained.)

If the output muxer decides to force the same framerate as the input,
and thereby duplicates your extracted frames, you can avoid that by
using the "-vsync vfr" option. It might depend on your use case. Try
with the above command first. :)

Moritz


More information about the ffmpeg-user mailing list