Vertically or horizontally stack (mosaic) several videos using ffmpeg?

Viewed 63839

I have two videos of the same exact length, and I would like to use ffmpeg to stack them into one video file.

How can I do this?

3 Answers

For 2 videos:

ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex hstack out.mp4

For more videos(3 in this example):

ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -filter_complex hstack=3 out.mp4
Related