FFMPEG Version: 3.2.1-1
UBUNTU 04.16.1
Suppose you have an mp3 file called wow.mp3. In this case, the following command will get the mp3 duration in seconds.
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 wow.mp3
Once you have the duration in seconds (imagine I got 11.36 seconds). Now that I have 3 images, I want to run each image for (11.36 / 3 = 3.79), then please use the following:
ffmpeg -y -framerate 1/3.79 -start_number 1 -i ./swissGenevaLake_%d.jpg -i ./akib.mp3 -c:v libx264 -r 25 -pix_fmt yuv420p -c:a aac -strict experimental -shortest output.mp4
Pictured here. / swissGenevaLake _1.jpg,. / swissGenevaLake_2.jpg, and. / swissGenevaLake_3.jpg.
Fragment 1 / 3.784 means that each image is executed within 3,784 seconds.
-start_number 1 means starts with image number one, which means. / swissGenevaLake _1.jpg
-c: v libx264: H.264 video codec
-r 25: video output frame rate 25
-pix_fmt yuv420p: output video stream format.
-c: a aac: encode audio using aac
-shortest: end the video as soon as the sound is completed.
output.mp4: output file name
Disclaimer: I have not tested merging images of several sizes.
References:
https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images
https://trac.ffmpeg.org/wiki/Encode/AAC
http://trac.ffmpeg.org/wiki/FFprobeTips