[FFmpeg-user] Output a sequence of images with known timings

adam smith adamsmith79 at icloud.com
Thu Nov 19 16:29:58 EET 2020

> On 19 Nov 2020, at 10:42, Moritz Barsnick <barsnick at gmx.net> wrote:
> Do take a look at the documentation of the select filter. It even has
> an example on how to extract certain frames, e.g. by number:
> https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect <https://ffmpeg.org/ffmpeg-filters.html#select_002c-aselect>
>    Select one frame every 100:
>        select='not(mod(n\,100))’

I have been playing with this filter to select frames but it to keep the frame rate of the source and hold the selected image.

For example If I was creating an mp4, it would have the first image held for ten seconds, then the image from 10 seconds held for ten seconds, then the image from 20 seconds etc. which is very useful for a video output to be fair ;)

When jpeg is selected, if the source was 25fps, I get a jpeg 250 of each selected frame.

When I used the tile filter in the following command it was able to show me all of the images I want combined into a single tile…
ffmpeg -y -i /data/temporary/localised_20201119-219-cniqnj/2minclock.m4v -vf select='not(mod(n\,1000))',scale=160:120,tile -frames:v 1 -pix_fmt yuvj420p -c:v mjpeg /data/temporary/transcode_20201119-219-kbzyx4/2minclockte

I have tested with a large range of intervals and so far this looks to be working fine…
ffmpeg -y -i /data/temporary/localised_20201119-219-cniqnj/2minclock.m4v -vf select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)',fps=1/10 -s 283x159 -pix_fmt yuvj420p -c:v mjpeg /data/temporary/transcode_20201119-2

adding the fps filter after the select and setting it to the same value has so far given me the results I wanted.
Image 1 from very start
Image 2 from 10 second
Image 3 from 20 second

Thanks very much for your help Moritz

More information about the ffmpeg-user mailing list