ffmpegchromakey

ffmpeg chromakey filter: blend parameter does not what it should


I want to remove greenscreen background and am not completely satisfied with what I have achieved because I still have green borders (especially on semi-transparent areas like hair, when I move my head).

The documentation for the blend-parameter of chromakey filter says

blend

Blend percentage.

0.0 makes pixels either fully transparent, or not transparent at all.

Higher values result in semi-transparent pixels, with a higher transparency the more similar the pixels color is to the key color.

So I reckoned, I could use this to minimise greenscreen bleeding (is this the term?) when removing the background with a command like this:

ffmpeg -i DSCN0015.MOV -vf "[in] hqdn3d=4:4:8:8 [dn]; [dn] scale=iw*3:-1 [sc]; [sc] chromakey=0x005d0b:0.125:0.0 [out]" -r 24 -an -c:v ffvhuff 4.mov

But when I use anything else than 0.0 for blend, it seems to determine some kind of MINIMUM transparency and the entire frame is affected.

Here are some pics to visualize: the first is the raw material from the camera. the 2nd shows what I get with blend=0.0 and the last one shows the problem: blend=0.5, but the whole frame is almost completely transparent.

[Raw material as from camera]

[blend=0.0]

[blend=0.5]


Solution

  • The solution ultimately was to drop the similarity value as indicated by Mulvya and use very low values in the blend parameter. 0.06 for both worked fine for the lighting situation in my clips.