Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T09:34:35.597Z
Answers.Text: How weird - I wonder why the player would possibly decide to add those dark pixels.
Answers.UserDisplayName: g491
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T12:52:39.277Z
Answers.Text: I think decoder/display uses yuv420
Answers.UserDisplayName: bukkojot
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T13:00:50.040Z
Answers.Text: That's right. See workaround.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-15T08:18:55.670Z
Answers.LastActivityDate: 2017-11-15T13:00:33.293Z
Answers.LastEditDate: 2017-11-15T13:00:33.293Z
Answers.UserDisplayName: Gyan
Body: <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>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T09:28:22.977Z
Comments.Text: Can you share the original PNG?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T10:05:54.510Z
Comments.Text: @Mulvya added original PNG - thx
Comments.UserDisplayName: g491
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-13T10:33:10.883Z
Comments.Text: This appears to be a scaler issue, not the encoder. I'll look into it.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-14T19:51:02.883Z
Comments.Text: @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
Comments.UserDisplayName: g491
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-15T04:52:21.343Z
Comments.Text: How did you view and take the screenshot of the output?
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-15T07:59:34.373Z
Comments.Text: @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
Comments.UserDisplayName: g491
Tags: <ffmpeg><encoding><h.264><libx264>
Title: H.264 adding dark anti-aliasing even on high444 yuv444p
UserDisplayName: g491
ThreadText: # 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.  
  
  ---
  
  