How to select range of an image sequence with sequential suffixes in ffmpeg

Viewed 20

I have 100 images (001.png ... 100.png) in my img folder and I want to create 2 gif files with different frame ranges for specific uses from there.

The first case uses all 100 images. I use the code below and it works fine.
ffmpeg -f image2 -framerate 30 -i %003d.png -vf scale=-2:480 myAnim.gif

But in the second case, we want to use only 50 images from 20 to 70. What code should I use to select this specific range?

1 Answers

For the starting image, see the documentation, specifically:

start_number
Set the index of the file matched by the image file pattern to start 
to read from. Default value is 0.

For the end, you need to use the -t duration input option to control it. If you have 50 images at 30 fps, it'll take 1-2/3 seconds, so put down -t 1.67 (round up to be on the safe side).

Related