2
votes

I am trying to generate video from images using ffmpeg concat demuxer.I am creating a text file with image file path. Since images can be of different duration, i am using duration filter to specify the duration of each image. Sample text file is like :

file 1.jpg

duration 3

file 2.jpg

duration 3

file 3.jpg

duration 5

1.jpg and 2.jpg both are displayed for specified 3 sec each but 3.jpg comes for just 2 seconds.

FFMPEG command:

ffmpeg -f concat -i D:/textfile.txt -y -r 10 -crf 22 -threads 2 -preset veryfast D:/video.mp4

1
The duration directive doesn't work for the last entry, so add a single frame at the end i.e.file 3.jpgGyan
i added file 3.jpg at end. total video duration came as 13 seconds. 3.jpg was there for 7 seconds instead of desired 5hack

1 Answers

1
votes

Use

ffmpeg -f concat -i textfile -y -vf fps=10 -crf 22 -threads 2 -preset veryfast video.mp4

where textfile is

file 1.jpg
duration 3
file 2.jpg
duration 3
file 3.jpg
duration 5
file 3.jpg