H.264 adding dark anti-aliasing even on high444 yuv444p 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.



Original PNG below:
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