using ffmpeg overlay short overview

Published: 24 November 2020
on channel: A Forum
420
6

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    • make lip-sync with Wav2lip in google ...  

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

00:00 intro
00:09 other videos about overlay
01:03 first overlay with explanation
04:14 output video
04:33 command using gte
05:14 output video
05:43 command using lte
06:07 output video
06:19 command using between
06:46 output video
07:00 command using PTS+2/TB and 'between'
07:52 output video
08:26 side by side with background
09:30 output video
10:03 PTS+2/TB notice not syncronised
10:41 output video
11:28 thankyou :)


Watch video using ffmpeg overlay short overview online without registration, duration hours minute second in high quality. This video was added by user A Forum 24 November 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 420 once and liked it 6 people.