-2

Can ffmpeg combine images to a video with a specific duration for each image? For example, i want 1.jpg to be displayed for 100 ms, and 2.jpg to be displayed for 120 ms, and 3.jpg to be displayed for 115 ms, and so on.. can ffmpeg do this?

I have a bunch of images, each image has their own timestamp, and the timestamps decides how long each image should be in the video..

This is similar to question Conversion of images to video with variable fps using FFmpeg , but unlike that post, I do not need a gradual increase, but I rather need to specify the duration of each image.

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
hanshenrik
  • 19,904
  • 4
  • 43
  • 89

1 Answers1

0

first make a input.txt file looking like

file '1.jpg'
duration 0.1
file '2.jpg'
duration 0.12
file '3.jpg'
duration 0.115

(where duration is number of seconds, and 0.115 seconds is 115 milliseconds~) then simply do

ffmpeg -f concat -i input.txt -vsync vfr output.mp4

this works on all frames except the last frame, which will just be displayed for a fraction of a second regardless of duration specification. (i have no idea why ffmpeg fails on the last frame, perhaps it is a bug?)

Edit: seems like on Chrome it works correctly on all frames except the last frame. On VLC it works correctly on all frames except the last 2 frames? Well that is confusing.

hanshenrik
  • 19,904
  • 4
  • 43
  • 89