I am using ffmpeg and trying to change the color of certain pixels in a video stream using the lutrgb filter. The aim is to change any pixel with a green value greater than 145 to a white pixel. So far I have tried the following commands:

-vf lutrgb=r='if((g > 145),255,val)':g='if(val > 145, 255, val)':b='if(g > 145, 255, val)'

-vf lutrgb=g='if(val>145,255,val)':r=255:b=255

-vf lutrgb=r='if(gt(val,145),255,val)':g='if(val>145,255,val)':b='if(gt(val,145),255,val)'

However, these are not delivering the desired result. Is it possible to have ffmpeg use a 1D LUT where the input values for r, g and b can be set based on a condition, for example, if r=ANY, g>145 and b=ANY, then r=255, g=255 and b=255? Any insight to whether this is possible is much appreciated.

1 Answer 1


The LUT filters don't have cross-referencing of channels. Use geq instead


  • Mulvya, thank you very much. This works exactly as it was intended.
    – Jay
    Jul 29, 2017 at 17:12

Your Answer

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

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