1

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.

3

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

geq=r='if(gt(g(X,Y),145),255,p(X,Y))':g='if(gt(g(X,Y),145),255,p(X,Y))':b='if(gt(g(X,Y),145),255,p(X,Y))'

| improve this answer | |
  • Mulvya, thank you very much. This works exactly as it was intended. – Jay Jul 29 '17 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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