<p>Use</p>

<pre><code>ffmpeg -i file1.avi -i file2.avi -filter_complex "[0][1]vstack" -t 10 joined.avi
</code></pre>

<p>This will stack the videos vertically and play the first 10 seconds of each. Remove the <code>-t</code> option if the videos are longer and you wish to extend the output. This command also uses the default parameters to encode the video i.e. codec will be MPEG4 Part 2 (Xvid..). If there's any audio, the track from the first video will be used and encoded as MP3.</p>

CC BY-SA 3.0
2016-05-12T19:13:07.383Z
2016-05-12T19:13:07.383Z
Gyan
<p>Let's say that I have a <code>file1.avi</code> and a <code>file2.avi</code>. Each one of these files is the same size, for instance 300x100.</p>

<p>How could I join them, so that both of them would play the first 10 seconds of each video at the same time, one on top of the other, in a 300x200 video?</p>

<ffmpeg>
Join 2 videos to play at the same time
Enrique Moreno Tent
# Join 2 videos to play at the same time

(Asked by: username_0 on 2016-05-12)

Let's say that I have a `file1.avi` and a `file2.avi`. Each one of these files is the same size, for instance 300x100.

How could I join them, so that both of them would play the first 10 seconds of each video at the same time, one on top of the other, in a 300x200 video?

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2016-05-12. Score: 4 | Accepted answer

Use
ffmpeg -i file1.avi -i file2.avi -filter_complex "[0][1]vstack" -t 10 joined.avi

This will stack the videos vertically and play the first 10 seconds of each. Remove the -t option if the videos are longer and you wish to extend the output. This command also uses the default parameters to encode the video i.e. codec will be MPEG4 Part 2 (Xvid..). If there's any audio, the track from the first video will be used and encoded as MP3.


---

