I have a video with green screen. Unfortunately there is a shadow on the green screen. Increasing the tolerance got side effects. Thus I thought of the obvious, just apply colorkey twice.

I tried this, but it only applies the last colorkey. If I switch the two colorkeys then it either removes the shadowed area or the light area.

ffmpeg -i bacground.jpg -i green.mp4 -filter_complex '[1:v]colorkey=0x32AB57:0.25:[ckout1];[ckout1]colorkey=0x016733:0.2:[ckout];[0:v][ckout]overlay[out]' -map '[out]' -map '1:a:?' -y output.mp4

What Am I doing wrong here?

1 Answer 1


You could apply the colorkey to the input twice then blend the alpha channels

-filter_complex "[1:v]colorkey=0x32AB57:0.25[ck1];[1:v]colorkey=0x016733:0.2[ck2];[ck1][ck2]blend=c3_mode=and"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.