-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathhstack_side_by_side
37 lines (28 loc) · 1.64 KB
/
hstack_side_by_side
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Sitting 2 videos side by side using hstack - youtube example https://youtu.be/B0tNDgHJ_no
ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4
# just found the command above from a comment here https://unix.stackexchange.com/questions/233832/merge-two-video-clips-into-one-placing-them-next-to-each-other
# I think this could come in handy sometime. I tried to get it working on 2 videos with different sizes and other things,
# but there was a whole bunch of errors. But if you are using 2 videos with same formats and size it works fine.
# Even if 1 video is of shorter length than the other. You can see the one on the right is shorter than the one on the left
# and so it just keeps the last frame while the other video keeps going.
# I'm not sure what is happening with the sound because both videos have similar background noise.
ffmpeg -i top.mp4 -i bottom.mp4 -filter_complex vstack output.mp4
ffmpeg \
-i topleft.MOV -i middleleft.MOV -i bottomleft.MOV \
-i topright.MOV -i middleright.MOV -i bottomright.MOV \
-filter_complex \
"[0:v][1:v][2:v]vstack=inputs=3[left];\
[3:v][4:v][5:v]vstack=inputs=3[right]; \
[left][right]hstack=inputs=2[v]" \
-map "[v]" 2x3grid_output.MOV
# just found a really good link about using hstack and vstack and then combining them all https://ottverse.com/stack-videos-horizontally-vertically-grid-with-ffmpeg/
# 3x2 grid of videos:
ffmpeg \
-i topleft.MOV -i topmiddle.MOV \
-i topright.MOV -i bottomleft.MOV \
-i bottommiddle.MOV -i bottomright.MOV \
-filter_complex \
"[0:v][1:v][2:v]hstack=inputs=3[top];\
[3:v][4:v][5:v]hstack=inputs=3[bottom];\
[top][bottom]vstack=inputs=2[v]" \
-map "[v]" 3x2_Output.MOV