user37924: I have a 10 seconds video clip and 60 seconds audio clip, so when I mux it with
mkvmerge --output video.mkv ./a.mp3 ./a.mp4
The output file shows the video only for the first 10 seconds, and then the last frame is displayed for 50 seconds.
How can I loop the video in automatic mode so that it repeats for the whole 60 seconds with mkvmerge or any other command line tool (I need to automate it as I have to do it for 400 files)?

user31818: To merge an audio stream with a repeated video stream
ffmpeg -stream_loop -1 -i 20s.ts -i 120s.mp3 -map 0:v:0 -map 1:a:0 -shortest -c copy output.mp4


-stream_loop -1 : to loop infinity of video input stream
-map 0:v:0 : pick the video of the first input stream
-map 1:a:0 : pick the audio of the second input stream
-shortest : select the shortest length of input streams, which is the audio stream since the video will be looped infinity
-c copy : no video and audio transcodes.


37924: <p>I have a 10 seconds video clip and 60 seconds audio clip, so when I mux it with</p>
<p><code>mkvmerge --output video.mkv ./a.mp3 ./a.mp4</code></p>
<p>The output file shows the video only for the first 10 seconds, and then the last frame is displayed for 50 seconds.</p>
<p>How can I loop the video in automatic mode so that it repeats for the whole 60 seconds with mkvmerge or any other command line tool (I need to automate it as I have to do it for 400 files)?</p>
 31818: <p>To merge an audio stream with a repeated video stream</p>
<pre><code>ffmpeg -stream_loop -1 -i 20s.ts -i 120s.mp3 -map 0:v:0 -map 1:a:0 -shortest -c copy output.mp4
</code></pre>
<ul>
<li>-stream_loop -1 : to loop infinity of video input stream</li>
<li>-map 0:v:0 : pick the video of the first input stream</li>
<li>-map 1:a:0 : pick the audio of the second input stream</li>
<li>-shortest : select the shortest length of input streams, which is the audio stream since the video will be looped infinity</li>
<li>-c copy : no video and audio transcodes.</li>
</ul>
