1

I have an audio file 2 hours long and 30 still images related to the audio. I would like to display each image consecutively for about 45 seconds while the audio is playing in a repeating fashion. When the last image has been displayed, I want to just start over from the top and keep repeating the images in a circle until the audio ends.

For testing the technique purposes I am using this command with shorter audio, only 2 images, and shorter durations. The music plays, the images display and transition as desired but how do I get them to repeat? It just displays the two images and stops. How do I get the images to loop continuously until the audio ends?

I'm using ffmpeg on Linux Mint 20.

ffmpeg -version
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers

ffmpeg -i "/home/ron/fftest/Overture.mp3" \
           -loop 1 -i "/home/ron/fftest/Picture1.jpg" \
           -loop 1 -i "/home/ron/fftest/Picture2.jpg" \
           -filter_complex \
             "[1:v]trim=duration=6,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v1]; \
              [2:v]trim=duration=6,fade=t=in:st=0:d=1,fade=t=out:st=5:d=1[v2]; \
              [v1][v2]concat=n=2:v=1:a=0[v]" \
           -shortest -movflags +faststart -map 0:a -map [v] -c:a copy \
           /home/ron/fftest/Overture.mp4

1 Answer 1

2

Assume you have an audio file, which is named as "audio.mp3"; you have images file pattern as "Picture01.jpg", "Picture02.jpg", ... "Picture30.jpg"; and you want 4.5s image duration. Then the command is

ffmpeg -y -loop 1 -framerate 1/4.5 -i Picture%2d.jpg -i audio.mp3 -shortest -acodec copy -vcodec mjpeg result.mp4

Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.