I'm using lenscorrection filter on a video and the result contains green background as canvas!

How Can i replace this color with different one or an image? This is the command i used:

ffmpeg -i out.mp4 -vf "lenscorrection=cx=0.5:cy=0.5:k1=0.4:k2=0.4" sss.mp4


1 Answer 1


This is a byproduct of the lenscorrection algorithm, originally meant to work on RGB pixels only. If the output pixel has no corresponding input pixel mapped, it is populated with 0, but in a YUV format, that's a shade of green.

As a workaround, you'll have to force manual format conversion before and after the filter.

ffmpeg -i out.mp4 -vf "format=gbrp,lenscorrection=cx=0.5:cy=0.5:k1=0.4:k2=0.4,format=yuv420p" sss.mp4
  • Thank you, It's working. Just a question, is there a way to directly replace the black color with background image or video? I think i can do this through specially designed background with blend option.
    – salem
    Jan 25, 2019 at 3:51

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.