<p>You can use the LUT or GEQ filters for this.</p>

<p>e.g. with LUT </p>

<pre><code>ffmpeg -i myVideo.avi
       -vf
       "yadif,format=rgb24,
        lutrgb=r='if(eq(val,0),3,val)':g='if(eq(val,0),3,val)':b='if(eq(val,0),3,val)'"
image%d.png
</code></pre>

CC BY-SA 4.0
2023-06-01T01:39:06.627Z
That code looks like it doesn't do as asked. For example a pixel with 0, 100, 0 is changed to 3, 100, 3
pete
CC BY-SA 4.0
2016-10-30T17:56:37.013Z
2019-10-30T05:47:40.987Z
2019-10-30T05:47:40.987Z
Gyan
<p>I want to extract all video frames as images and change every black (pure black) pixel of the images to a special color. (R=3,G=3,B=3)</p>

<p>I used this command to extract video frames :</p>

<pre><code>ffmpeg -I myVideo.avi -f image2 -vf yadif -vcodec png image%d
</code></pre>

<p>Please tell me how to change every black pixel of the images to color that I want? (I want R=3,G=3,B=3)</p>

<p>Thanks.</p>

<video><ffmpeg><color>
How to change every black pixel to a special color?
Maria
# How to change every black pixel to a special color?

(Asked by: username_0 on 2016-10-30)

I want to extract all video frames as images and change every black (pure black) pixel of the images to a special color. (R=3,G=3,B=3)
I used this command to extract video frames :
ffmpeg -I myVideo.avi -f image2 -vf yadif -vcodec png image%d

Please tell me how to change every black pixel of the images to color that I want? (I want R=3,G=3,B=3)
Thanks.

**Tags:** video, ffmpeg, color


---

## 1 answers

### Answer by username_1 on 2016-10-30. Score: 2 | Accepted answer

You can use the LUT or GEQ filters for this.
e.g. with LUT 
ffmpeg -i myVideo.avi
       -vf
       "yadif,format=rgb24,
        lutrgb=r='if(eq(val,0),3,val)':g='if(eq(val,0),3,val)':b='if(eq(val,0),3,val)'"
image%d.png

> **Comments:**
> **username_2**: That code looks like it doesn't do as asked. For example a pixel with 0, 100, 0 is changed to 3, 100, 3  

---

