I'm currently running two FFmpeg commends:

[1] Looping a video for the entire duration of an audio file.

ffmpeg  -stream_loop -1 -i 1min-loop.mp4 -i 2min-song.mp3 -shortest -map 0:v:0 -map 1:a:0 -y looped-video.mp4

[2] Taking the resulting file add overlaying image files.

ffmpeg -i looped-video.mp4 -i overlay.png -i art.jpeg -filter_complex "\
  [vid-and-artwork][1:v]overlay=0:0" final-video.mp4

Is it possible to combine these into one command? Thx

1 Answer 1


Use the main input with stream loop, and add -shortest

ffmpeg -stream_loop -1 -i 1min-loop.mp4 -i overlay.png -i art.jpeg \
-i 2min-song.mp3 -filter_complex "\
  [vid-and-artwork][1:v]overlay=0:0[v]" \
  -map [v] -map 3:a -shortest final-video.mp4

Use ffmpeg v5.0 or newer.

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.