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

ffmpeg at afkbio.de ffmpeg at afkbio.de
Sat May 12 23:34:31 CEST 2012


I am trying to extract single frames from movies every n-th frame.

What I am currently using is:
>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. Obviously this is not what I want to achieve.

What I would like to end up with is:
1 Image of Frame N
1 Image of Frame N*1
1 Image of Frame N*2
And so on

I have tried the following as workaround, where X=<source fps> / <n>:
>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.. Is there any way of improving this? 



More information about the ffmpeg-user mailing list