Answers.Body: <p>Use the main input with stream loop, and add -shortest</p>
  <pre><code>ffmpeg -stream_loop -1 -i 1min-loop.mp4 -i overlay.png -i art.jpeg \
  -i 2min-song.mp3 -filter_complex &quot;\
    [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]&quot; \
    -map [v] -map 3:a -shortest final-video.mp4
  </code></pre>
  <p>Use ffmpeg v5.0 or newer.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-06T04:37:43.890Z
Answers.LastActivityDate: 2022-06-06T04:37:43.890Z
Answers.UserDisplayName: Gyan
Body: <p>I'm currently running two FFmpeg commends:</p>
  <p>[1] <a href="https://stackoverflow.com/a/55841289/266435">Looping a video for the entire duration of an audio file.</a></p>
  <pre class="lang-bash prettyprint-override"><code>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
  </code></pre>
  <p>[2] Taking the resulting file add overlaying image files.</p>
  <pre class="lang-bash prettyprint-override"><code>ffmpeg -i looped-video.mp4 -i overlay.png -i art.jpeg -filter_complex &quot;\
    [2:v]scale=400:400[resized-artwork];\
    [0][resized-artwork]overlay=100:100[vid-and-artwork];\
    [vid-and-artwork][1:v]overlay=0:0&quot; final-video.mp4
  </code></pre>
  <p>Is it possible to combine these into one command? Thx</p>
  
Tags: <ffmpeg>
Title: FFmpeg combine Stream Loop and Filter into one command
UserDisplayName: Ace
ThreadText: # FFmpeg combine Stream Loop and Filter into one command
  
  (Asked by: username_0 on 2022-06-06)
  
  I'm currently running two FFmpeg commends:
  
  [1] [Looping a video for the entire duration of an audio file.](https://stackoverflow.com/a/55841289/266435)
  
  ```bash
  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.
  
  ```bash
  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
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-06-06. Score: 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.
  
  
  ---
  
  