I want to concat several pictures into a video. Each picture must have its own duration. I use the most recent windows build for ffmpeg (20170204) and the guide from http://trac.ffmpeg.org/wiki/Slideshow/

Here is my text file:

file path/to/001.png
duration 5
file path/to/002.png
duration 6

I try using the following command:

ffmpeg.exe -f concat -safe 0 -i path/to/input.txt output.mp4

In the resulting video, the first pictures hangs for 5 seconds but the second picture only hangs for 0 seconds (I only see a glimpse of it). What am I doing wrong?

  • @LordNeckbeard the demuxer example at Wiki doesn't work. Reproduced by me. Adding a duplicate entry of the last image alters total duration unpredictably. – Gyan Feb 5 '17 at 7:49
  • 1
    No. There is a concat filter which is different from the fps filter. In any case, neither of those are used here. Filters are processors invoked by -vf, -af or -filter_complex. Here, the concat demuxer is used, which is a different process. – Gyan Feb 5 '17 at 8:20
  • Doesn't work here. Supply a different duration for the duplicated entry and check. – Gyan Feb 5 '17 at 8:53
  • Bug report filed. – Gyan Feb 5 '17 at 10:41

Based on the discussion at the bug tracker, this should be a workaround:

file path/to/001.png
duration 5
file path/to/002.png
duration 5.96
file path/to/002.png


ffmpeg.exe -f concat -safe 0 -i path/to/input.txt -vsync vfr output.mp4

The idea is to duplicate the entry of the last image. If you need the duration to be precise, then decrease the duration of the now 2nd-last entry by 1/fps seconds. For 25 fps video, that's 0.04s. If you don't do this, the output duration will be 0.04s longer.

  • 2
    Make sure to add -pix_fmt yuv420p for broad player compatibility. – Gyan Feb 5 '17 at 11:40

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.