The most simple slideshow is just a sequence of pictures with each being displayed for the same amount of time.

I would also like to make a sequence, but more complicated with respect to the duration:

I want the first picture to have a duration of 1 second, the next a little bit less than a second, the next even a little shorter, so that the sequence starts slow and gets faster towards the end.

I do not know how to do it, the only thing I can guess is, that the duration for each picture could be calculated by a function like

duration = 1/picture_number
duration = 1 - (picture_number/picture_total)

or in a script:

while [duration > 0]

1 Answer 1


This can be done in a single command. Basic method is to start with a slideshow where each image has the same duration and then use the select filter to trim out greater amounts from the display time of each successive image.

ffmpeg -framerate 1 -i img%d.jpg \
       -vf fps=25,select='lt(mod(t,1),1-floor(t)/25)',setpts=N/25/TB \

-framerate 1 --> this controls how fast the images originally turn over.

fps=25 --> we set the final framerate. Also, need to do this to have frames to work with.

select='lt(mod(t,1),1-floor(t/1)/25)' --> From each second, keep one frame less.

setpts=N/25/TB --> make the timestamps of the selected frames continuous, else ffmpeg will duplicate frames to fill gaps and defeat our goal.

To start with an initial duration of 3 seconds, you would change framerate to 1/3 and change select to lt(mod(t,3),3-floor(t/3)/25). You would need to change the 25 to control the speed at which t he duration is reduced. Higher values will reduce duration at a slower speed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.