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

Original PNG below:

enter image description here

  • Can you share the original PNG?
    – Gyan
    Nov 13, 2017 at 9:28
  • @Mulvya added original PNG - thx
    – g491
    Nov 13, 2017 at 10:05
  • This appears to be a scaler issue, not the encoder. I'll look into it.
    – Gyan
    Nov 13, 2017 at 10:33
  • @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
    Nov 14, 2017 at 19:51
  • How did you view and take the screenshot of the output?
    – Gyan
    Nov 15, 2017 at 4:52

1 Answer 1


It's a rendering artifact, not an actual error.


ffplay test444.mp4 -vf scale=iw*16:-1:flags=neighbor


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
  • How weird - I wonder why the player would possibly decide to add those dark pixels.
    – g491
    Nov 15, 2017 at 9:34
  • 1
    I think decoder/display uses yuv420
    – bukkojot
    Nov 15, 2017 at 12:52
  • 1
    That's right. See workaround.
    – Gyan
    Nov 15, 2017 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.