This question already has an answer here:
I have a set of images from which I try to create a slide show. On this website I found the following command to do so:
ffmpeg -framerate 1/5 -start_number 126 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
I got it working fine. But in my case I need to have each images to be displayed a different period of time. How can I achieve this?
You can try the concat demuxer and provide the duration for each frame.
Make text file containing the path to your inputs and the duration for each:
file '/path/to/image0.png' duration 2 file '/path/to/image1.png' duration 5 file '/path/to/image2.png' duration 1.5 file '/path/to/image3.png' duration 4Then run
ffmpeg:ffmpeg -f concat -i input.txt -pix_fmt yuv420p -movflags +faststart output.mp4
Notes:
See the concat demuxer documentation for more info.
The example won't work with an old
ffmpeg, so make sure to download a recent build first since FFmpeg development is so active.
So it is some time ago I asked this question an there is no answer yet. I also did not find one by myself. I solved the task in my case by creating simbolic links for each frame pointing to the correct image. Then I set the framerate to 1. So for each second I want to display an image I have a symbolic link pointing to it.
One can of course also just copy the files accordingly. Depending on the total number of frames of the video this can result in a lot of disk space used. So I went with the links.
来源:https://stackoverflow.com/questions/29729069/using-ffmpeg-to-join-images-with-different-timly-distance