<p>Assume you have an audio file, which is named as &quot;audio.mp3&quot;;
you have images file pattern as &quot;Picture01.jpg&quot;, &quot;Picture02.jpg&quot;, ... &quot;Picture30.jpg&quot;; and you want 4.5s image duration. Then the command is</p>
<pre><code>ffmpeg -y -loop 1 -framerate 1/4.5 -i Picture%2d.jpg -i audio.mp3 -shortest -acodec copy -vcodec mjpeg result.mp4
</code></pre>
<p>Good luck!</p>

CC BY-SA 4.0
2020-11-05T05:22:36.787Z
2020-11-05T05:22:36.787Z
xer-rex
<p>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.</p>
<p>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?</p>
<p>I'm using ffmpeg on Linux Mint 20.</p>
<pre><code>ffmpeg -version
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers

ffmpeg -i &quot;/home/ron/fftest/Overture.mp3&quot; \
           -loop 1 -i &quot;/home/ron/fftest/Picture1.jpg&quot; \
           -loop 1 -i &quot;/home/ron/fftest/Picture2.jpg&quot; \
           -filter_complex \
             &quot;[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]&quot; \
           -shortest -movflags +faststart -map 0:a -map [v] -c:a copy \
           /home/ron/fftest/Overture.mp4
</code></pre>

<ffmpeg><video><audio>
Loop images until the audio ends
RonSMeyer
# Loop images until the audio ends

(Asked by: username_0 on 2020-11-03)

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

**Tags:** ffmpeg, video, audio


---

## 1 answers

### Answer by username_1 on 2020-11-05. Score: 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!


---

