[FFmpeg-user] Extracting one image every n-th frame

Nicolas George nicolas.george at normalesup.org
Sun May 13 01:15:11 CEST 2012

Le quartidi 24 floréal, an CCXX, ffmpeg at afkbio.de a écrit :
> >ffmpeg -i movie.avi -vf select="not(mod(n\,<n>))","scale=640:-1"  -an export%d.jpeg
> The issue however is, that this call does export N images from the SAME
> frame, so if I set n=100 I would end up with 100 similar images from the
> first frame, then 100 similar images from the 100th frame and so on.

Your problem is that the select filter produces a variable framerate output,
which just happens to be constant in your case but ffmpeg can not know it.
The image2 muxer does not support variable framerate. You need to use the
-vsync option.

> 1 Image of Frame N
> 1 Image of Frame N*1

That is the same.
> >ffmpeg -i movie.avi -r <X> -vf select="not(mod(n\,<n>))","scale=640:-1"  -an export%d.jpeg
> This seems to work, however I don’t think that this is a very elegant
> approach + there might be small shifts due to round errors..

This is perfectly correct, but then the select filter becomes redundant and
useless. And of course, it can not replace different select formulas.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20120513/96540b21/attachment.asc>

More information about the ffmpeg-user mailing list