forked from afrum/my_ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overlay
85 lines (77 loc) · 4.24 KB
/
overlay
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# overlay multiple videos - youtube example https://youtu.be/i-yWKUVENqg
# the characters I used are not real people for more information see https://thispersondoesnotexist.com/
# I used wav2lip for the lip syncing which I show in my previous video https://youtu.be/iQeWwd-LnLs
# here are the commands I used:
ffmpeg -i topleft.mkv -i topright.mkv -i bottomleft.mkv -i bottomright.mkv -filter_complex "\
nullsrc=size=640x640 [base];\
[0:v] setpts=PTS-STARTPTS, scale=320x320 [upperleft];\
[1:v] setpts=PTS-STARTPTS, scale=320x320 [upperright];\
[2:v] setpts=PTS-STARTPTS, scale=320x320 [lowerleft];\
[3:v] setpts=PTS-STARTPTS, scale=320x320 [lowerright];\
[base][upperleft] overlay=shortest=1 [tmp1];\
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];\
[tmp2][lowerleft] overlay=shortest=1:y=320 [tmp3];\
[tmp3][lowerright] overlay=shortest=1:x=320:y=320"\
-c:v libx264 output.mkv
ffmpeg -i topleft.mkv -i topright.mkv -i bottomleft.mkv -i bottomright.mkv -filter_complex "\
nullsrc=size=640x480 [base];\
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];\
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];\
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];\
[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];\
[base][upperleft] overlay=shortest=1 [tmp1];\
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];\
[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];\
[tmp3][lowerright] overlay=enable='gte(t,2)':x=320:y=240"\
-c:v libx264 output_with_delay.mkv
ffmpeg -i topleft.mkv -i topright.mkv -i bottomleft.mkv -i bottomright.mkv -filter_complex "\
nullsrc=size=640x480 [base];\
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];\
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];\
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];\
[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];\
[base][upperleft] overlay=shortest=1 [tmp1];\
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];\
[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];\
[tmp3][lowerright] overlay=enable='lte(t,3)':x=320:y=240"\
-c:v libx264 output_with_early_finish.mkv
ffmpeg -i topleft.mkv -i topright.mkv -i bottomleft.mkv -i bottomright.mkv -filter_complex "\
nullsrc=size=640x480 [base];\
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];\
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];\
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];\
[3:v] setpts=PTS-STARTPTS, scale=320x240 [lowerright];\
[base][upperleft] overlay=shortest=1 [tmp1];\
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];\
[tmp2][lowerleft] overlay=shortest=1:y=240 [tmp3];\
[tmp3][lowerright] overlay=enable='between(t,2,4)':x=320:y=240"\
-c:v libx264 output_with_set_time.mkv
ffmpeg -i topleft.mkv -i topright.mkv -i bottomleft.mkv -i bottomright.mkv -filter_complex "\
nullsrc=size=640x480 [base];\
[0:v] setpts=PTS-STARTPTS, scale=320x240 [upperleft];\
[1:v] setpts=PTS-STARTPTS, scale=320x240 [upperright];\
[2:v] setpts=PTS-STARTPTS, scale=320x240 [lowerleft];\
[3:v] setpts=PTS+2/TB, scale=320x240 [lowerright];\
[base][upperleft] overlay=shortest=1 [tmp1];\
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2];\
[tmp2][lowerleft] overlay=enable='between(t,2,4)':y=240 [tmp3];\
[tmp3][lowerright] overlay=enable='between(t,2,4)':x=320:y=240"\
-c:v libx264 output_with_set_times.mkv
ffmpeg -i background.mkv -i leftperson.mkv -i rightperson.mkv -filter_complex "\
nullsrc=size=1920x1080 [base];\
[0:v] setpts=PTS-STARTPTS, scale=1920x1080 [background];\
[1:v] setpts=PTS-STARTPTS, scale=600x600 [left];\
[2:v] setpts=PTS-STARTPTS, scale=600x600 [right];\
[base][background] overlay=shortest=1 [tmp1];\
[tmp1][left] overlay=shortest=1:x=100:y=200 [tmp2];\
[tmp2][right] overlay=enable='between(t,2,6)':x=1010:y=200"\
-c:v libx264 output_two_people.mkv
ffmpeg -i background.mkv -i leftperson.mkv -i rightperson.mkv -filter_complex "\
nullsrc=size=1920x1080 [base];\
[0:v] setpts=PTS-STARTPTS, scale=1920x1080 [background];\
[1:v] setpts=PTS+2/TB, scale=600x600 [left];\
[2:v] setpts=PTS-STARTPTS, scale=600x600 [right];\
[base][background] overlay=shortest=1 [tmp1];\
[tmp1][left] overlay=shortest=1:x=100:y=200 [tmp2];\
[tmp2][right] overlay=shortest=1:x=1010:y=200"\
-c:v libx264 output_two_people_PTS2.mkv