<p>It's a rendering artifact, not an actual error.</p>

<p>See</p>

<pre><code>ffplay test444.mp4 -vf scale=iw*16:-1:flags=neighbor
</code></pre>

<p>and</p>

<pre><code>ffmpeg -i test444.mp4 roundtrip.png
</code></pre>

<p>You should see no black pixels.</p>

<p><strong>Update</strong>: ffplay downsamples YUV inputs to 420 before final conversion to RGB.</p>

<pre><code>[swscaler @ 0000000005a82800] bicubic scaler, from yuv444p to yuv420p using MMXEXT
</code></pre>

<p>You can avoid artifacts by directly calling pixel format filter.</p>

<pre><code>ffplay test444.mp4 -vf format=bgra
</code></pre>

CC BY-SA 3.0
2017-11-15T09:34:35.597Z
How weird - I wonder why the player would possibly decide to add those dark pixels.
g491
CC BY-SA 3.0
2017-11-15T12:52:39.277Z
I think decoder/display uses yuv420
bukkojot
CC BY-SA 3.0
2017-11-15T13:00:50.040Z
That's right. See workaround.
Gyan
CC BY-SA 3.0
2017-11-15T08:18:55.670Z
2017-11-15T13:00:33.293Z
2017-11-15T13:00:33.293Z
Gyan
<p>I have a PNG file with white on red and no antialiasing at all - each pixel is either white or red, but when I encode it to MP4 using <code>ffmpeg -i test.png  -profile:v high444 -pix_fmt yuv444p  -loop 1 -crf 0 -framerate 30 -c:v libx264 -t 15  test444.mp4</code> the output gets dark pixels added and the white color gets changed.  See zoomed in screenshot below for before and after.  I played the mp4 file with <code>ffplay</code> btw.</p>

<p><a href="https://i.sstatic.net/NNqfk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/NNqfk.png" alt="enter image description here"></a></p>

<p>Original PNG below:</p>

<p><a href="https://i.sstatic.net/byjNh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/byjNh.png" alt="enter image description here"></a></p>

CC BY-SA 3.0
2017-11-13T09:28:22.977Z
Can you share the original PNG?
Gyan
CC BY-SA 3.0
2017-11-13T10:05:54.510Z
@Mulvya added original PNG - thx
g491
CC BY-SA 3.0
2017-11-13T10:33:10.883Z
This appears to be a scaler issue, not the encoder. I'll look into it.
Gyan
CC BY-SA 3.0
2017-11-14T19:51:02.883Z
@Mulvya is there a way to disable or change the scaler to see if that resolves it? I tried using bitexact in light of your comment but it didn't solve it. Thanks
g491
CC BY-SA 3.0
2017-11-15T04:52:21.343Z
How did you view and take the screenshot of the output?
Gyan
CC BY-SA 3.0
2017-11-15T07:59:34.373Z
@Mulvya Viewed using `ffplay test444.mp4` and screenshot taken using Greenshot (note that a screenshot of the PNG file has no issues - only of the resulting MP4 file). Thanks
g491
<ffmpeg><encoding><h.264><libx264>
H.264 adding dark anti-aliasing even on high444 yuv444p
g491
# H.264 adding dark anti-aliasing even on high444 yuv444p

(Asked by: username_0 on 2017-11-13)

I have a PNG file with white on red and no antialiasing at all - each pixel is either white or red, but when I encode it to MP4 using `ffmpeg -i test.png -profile:v high444 -pix_fmt yuv444p -loop 1 -crf 0 -framerate 30 -c:v libx264 -t 15 test444.mp4` the output gets dark pixels added and the white color gets changed. See zoomed in screenshot below for before and after. I played the mp4 file with `ffplay` btw.

[![enter image description here](https://i.sstatic.net/NNqfk.png)](https://i.sstatic.net/NNqfk.png)

Original PNG below:

[![enter image description here](https://i.sstatic.net/byjNh.png)](https://i.sstatic.net/byjNh.png)

**Tags:** ffmpeg, encoding, h.264, libx264

> **Comments:**
> **username_1**: Can you share the original PNG?  
> **username_0**: @Mulvya added original PNG - thx  
> **username_1**: This appears to be a scaler issue, not the encoder. I'll look into it.  
> **username_0**: @Mulvya is there a way to disable or change the scaler to see if that resolves it? I tried using bitexact in light of your comment but it didn't solve it. Thanks  
> **username_1**: How did you view and take the screenshot of the output?  
> **username_0**: @Mulvya Viewed using `ffplay test444.mp4` and screenshot taken using Greenshot (note that a screenshot of the PNG file has no issues - only of the resulting MP4 file). Thanks  

---

## 1 answers

### Answer by username_1 on 2017-11-15. Score: 2 | Accepted answer

It's a rendering artifact, not an actual error.
See
ffplay test444.mp4 -vf scale=iw*16:-1:flags=neighbor

and
ffmpeg -i test444.mp4 roundtrip.png

You should see no black pixels.
Update: ffplay downsamples YUV inputs to 420 before final conversion to RGB.
[swscaler @ 0000000005a82800] bicubic scaler, from yuv444p to yuv420p using MMXEXT

You can avoid artifacts by directly calling pixel format filter.
ffplay test444.mp4 -vf format=bgra

> **Comments:**
> **username_0**: How weird - I wonder why the player would possibly decide to add those dark pixels.  
> **username_2**: I think decoder/display uses yuv420  
> **username_1**: That's right. See workaround.  

---

