-
Notifications
You must be signed in to change notification settings - Fork 9
/
side_by_side
35 lines (25 loc) · 1.84 KB
/
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
# Videos placed side by side - youtube example https://youtu.be/0Bv6FDD94M0
# https://ffmpeg.org/ffmpeg-all.html#Examples-126
# Carrying on from my last video these are more commands adapted from the ffmpeg documentation about overlay
# Play an original video and a filtered version (here with the deshake filter) side by side using the ffmpeg tool (both commands do the same thing):
ffmpeg -i input1.MOV -vf "split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w" output.MOV
ffmpeg -i input1.MOV -vf "split[b], pad=iw*2[src], [b]deshake, [src]overlay=w" output.MOV
# Make a sliding overlay appearing from the left to the right top part of the screen starting since time 2:
ffmpeg -i input1.MOV -i input2.MOV -filter_complex "[0:v][1:v]overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0[out]" -map '[out]' -y output.MOV
# Compose output by putting two input videos side to side:
ffmpeg -i input2.MOV -i input1.MOV -filter_complex "
nullsrc=size=1000x500 [background];
[0:v] setpts=PTS-STARTPTS, scale=500x500 [left];
[1:v] setpts=PTS-STARTPTS, scale=500x500 [right];
[background][left]overlay=shortest=1 [background+left];
[background+left][right] overlay=shortest=1:x=500
" output.MOV
# if you want to add an overlayed video for a specified period of time change the details
# from overlay=shortest=1 to overlay=enable='between(t,5,10)'
# where the 5 is the start time the 10 is the end time
# you can also use overlay=enable='lte(t,10)'
# lte is less than or equal to and in this example 10 seconds so it will show for the first 10 seconds
# or overlay=enable='gte(t,10)'
# gte is greater than or equal to and in this example it will start overla after 10 seconds till the end of the video.
# if you want to delay the video change setpts=PTS-STARTPTS to setpts=PTS+2/TB
# where 2 is the 2 seconds delay before that overlayed video will start playing.