<p>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.</p>

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

<pre><code>ffmpeg -i out.mp4 -vf "format=gbrp,lenscorrection=cx=0.5:cy=0.5:k1=0.4:k2=0.4,format=yuv420p" sss.mp4
</code></pre>

CC BY-SA 4.0
2019-01-25T03:51:52.380Z
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
CC BY-SA 4.0
2019-01-24T08:34:29.740Z
2019-01-24T08:34:29.740Z
Gyan
<p>I'm using lenscorrection filter on a video and the result contains green background as canvas!</p>

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

<pre><code>ffmpeg -i out.mp4 -vf "lenscorrection=cx=0.5:cy=0.5:k1=0.4:k2=0.4" sss.mp4
</code></pre>

<p><a href="https://i.sstatic.net/YlZJj.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YlZJj.jpg" alt="result"></a></p>

<ffmpeg>
How to replace background green color
salem
# How to replace background green color

(Asked by: username_0 on 2019-01-24)

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

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2019-01-24. Score: 3 | Accepted answer

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

> **Comments:**
> **username_0**: 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.  

---

