I am using ffmpeg to turn a sequence of images (img001.png, img002.png, and so on) into a video (output.mp4) using the following command:
ffmpeg -r 1/5 -i img%03d.png -r 25 -qscale:v 2 -shortest -codec:a copy output.mp4
The result is a video that displays every input image for five (5) seconds.
- Is it possible to have ffmpeg parse the filename paths and timings from a file? I tried the slideshow tutorial on the official ffmpeg website but the output displayed only the last image, briefly, at the end of the video.
- Is it possible to bundle audio files with those settings?
For example:
file 'image001.png'
file 'sound001.wav'
duration 5
file 'image002.png'
file 'sound002.wav'
duration 2
file 'image003.png'
file 'sound003.wav'
duration 3
Image001 is displayed for five(5) seconds while sound001 is being played back and so on.
Answer
The concat demuxer method in the slideshow tutorial is the way to do this. Did you repeat the last image entry once, as mentioned?
Concat demuxer text files specify serial inputs, so can't be used to specify paired or parallel inputs. However, you can always use two text files.
Text file for images:
file 'image001.png'
duration 5
file 'image002.png'
duration 2
file 'image003.png'
duration 3
file 'image003.png'
Text file for sounds:
file 'sound001.wav'
outpoint 5
file 'sound002.wav'
outpoint 2
file 'sound003.wav'
outpoint 3
(For video or audio files, inpoint/outpoint have to be specified to use a trimmed portion of the file)
And with both those files,
ffmpeg -f concat -i images.txt -f concat -i sounds.txt -r 25 -pix_fmt yuv420p out.mp4
Comments
Post a Comment