How to green screen with FFMPEG | Chroma key a transparent video | FFMPEG tutorial

Published: 22 May 2023
on channel: The FFMPEG guy
2,160
55

Today, we show how to green screen / chroma key transforming a video shot in front of a green screen into a transparent one that we will add on a background video. All parameters can be of course customized to suit your needs.

ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
EXAMPLE
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ ffmpeg -i bg.mp4 -i fg.mp4 -filter_complex "[1:v]colorkey=57c273:0.3:0.01[tmp];[0:v][tmp]overlay" output01.mp4

with:
-i bg.mp4 = Reads background video file «bg.mp4», …
-i fg.mp4 = … and foreground video file «fg.mp4» …
-filter_complex = … and starts a series of complex filters…
[1:v]colorkey = … starting by calling the colorkey filter to define the transparent color for fg.mp4 ([1:v])…
57c273 = … as 57c273 (GREEN)… Note: update to match your color
0.3:0.01[tmp] = … with a similarity of 0.3 and a blending of 0.01 (Note: You may need to experiment with those values), calling the result [tmp]…
[0:v][tmp]overlay = … and overlays thereafter, [tmp] on top of the background video [0:v]
output01.mp4 = … outputting the final result to file «output01.mp4»

ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Catch up with the FFMPEG guy Channel
   • ALL THE VIDEOS FROM THE CHANNEL  
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
MUSIC
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
→ Joker - Causmic
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ
An FFMPEG question?
Ask the FFMPEG guy
ꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷꟷ


Watch video How to green screen with FFMPEG | Chroma key a transparent video | FFMPEG tutorial online without registration, duration hours minute second in high quality. This video was added by user The FFMPEG guy 22 May 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 2,160 once and liked it 55 people.