Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-25T03:51:52.380Z
Answers.Text: 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.
Answers.UserDisplayName: salem
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-24T08:34:29.740Z
Answers.LastActivityDate: 2019-01-24T08:34:29.740Z
Answers.UserDisplayName: Gyan
Body: <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>
  
Tags: <ffmpeg>
Title: How to replace background green color
UserDisplayName: salem
ThreadText: # 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
  
  ```
  
  [![result](https://i.sstatic.net/YlZJj.jpg)](https://i.sstatic.net/YlZJj.jpg)
  
  **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.  
  
  ---
  
  