[FFmpeg-user] How can chromakey ignore shadows ?

smoothgroove smoothgroove at gmx.net
Sat Oct 23 13:52:56 EEST 2021

Thanks for your clear response, I see the problem.

I'm wondering if there is any way to somehow lower the threshold for dark
green areas in order to reduce/suppress shadows in the foreground stream?
For example to somehow preprocess the foreground to reduce the contrast of
the green content?

In general, since there are different applications of chromakey, it would be
very useful to be able to control the threshold of darker green content with
a "shadow" parameter to the chromakey filter.

1) using for example a brick wall as a background image -> shadow from
foreground image is desired
2) using a landscape as a background image -> shadow from foreground image
is not desired

thanks, roman

-----Original Message-----
From: ffmpeg-user <ffmpeg-user-bounces at ffmpeg.org> On Behalf Of Paul B Mahol
Sent: Sunday, 12 September 2021 20:56
To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>
Subject: Re: [FFmpeg-user] How can chromakey ignore shadows ?

On Sun, Sep 12, 2021 at 8:34 PM smoothgroove <smoothgroove at gmx.net> wrote:

> Using chromakey=0x00ff00:0.24:0.14
> Is there any way to completely knock out the chromakey background, i.e.
> ignorning the lighting level, shadows and structure of the chroma
> background?
> In the examples:
> - The arm is casting a shadow on the greenscreen which is reflected in
> the result.
> - the face being near to the light automatically causes the chroma
> background to darken, which causes the replaced image to unnaturally
> darken.
> - a fold in the greenscreen fabric shows up in the replaced background
> What is required is chromakey being insenstitive to the chroma
> brightness, that is to totally punch out the background. How could
> this be accomplished?

chromakey operates in YUV colorspace and use only U and V component to set
And as such it will only set to transparent color some radius around UV
point as can be seen with this command:

ffplay -f lavfi -i

Notice how very dark green and very bright green are not set to transparent
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org

To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org
with subject "unsubscribe".

More information about the ffmpeg-user mailing list