[FFmpeg-user] Treating video frame-based instead of time-based

Gyan ffmpeg at gyani.pro
Tue Jan 22 10:54:55 EET 2019

On 22-01-2019 02:19 PM, Wolfgang Hugemann wrote:
>> As Carl mentioned, the select filter with an appropriate expression will
>> do this e.g.  select='not(mod(n-1,5))' to select every 5th frame. Frame
>> count begins with 0.
> The select filter keeps the framerate, such that the above code will
> show every 5th frame for a 5 frame time interval. However this approach
> may help to control rounding errors when using the fps filter.

You mentioned that you wished to extract these selected frames as 
images. As long as you use -vsync 0, there will be no frame duplication, 
and the result is the extraction of every 5th frame. If you want to keep 
the selected frames in a video and compact them, then setpts + fps 
should be used afterwards to generate a regular CFR video.

Oh, and the correct expression is    select='not(mod(n+1,5))'


More information about the ffmpeg-user mailing list