0

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 "\
  [2:v]scale=400:400[resized-artwork];\
  [0][resized-artwork]overlay=100:100[vid-and-artwork];\
  [vid-and-artwork][1:v]overlay=0:0" final-video.mp4

Is it possible to combine these into one command? Thx

1 Answer 1

0

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 "\
  [2:v]scale=400:400[resized-artwork];\
  [0][resized-artwork]overlay=100:100[vid-and-artwork];\
  [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, privacy policy and cookie policy

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