-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Given a 16 bpc RGB PNG sequence, if I encode it with:
ffmpeg -i regular%04d.png -c:v libx265 -pix_fmt gbrp12le -crf 1 out_gbrp12le.mp4
and then I encode that output into a lossless codec with a bigger pixel format:
ffmpeg -i .\out_gbrp12le.mp4 -c:v ffv1 -pix_fmt rgb48le libx265_gbrp12le_to_rgb48le.mkv
If I create a reference file with:
ffmpeg -i regular%04d.png -vcodec rawvideo -pix_fmt rgb48le lossless.nut
and I compare a plot of the two PSNRs to this reference file , they are extremely close:
This makes sense to me. gbrp12le is basically a subset of rgb48le so the PSNR plots should be identical. They are off slightly here, but it could just be rounding; no big deal.
However, as soon as I move to YUV, something odd happens. Take this example:
ffmpeg -i regular%04d.png -c:v libx265 -pix_fmt yuv444p12le -color_range pc -crf 1 out_yuv444p12le_pc.mp4
and then I encode that output with
ffmpeg -i .\out_yuv444p12le_pc.mp4 -c:v ffv1 -pix_fmt rgb48le libx265_yuv444p12le_pc_to_rgb48le.mkv
I get a notable difference in the PSNR values.
Why is there a difference? In order to calculate the PSNR, both files have to converted to the same pixel format, right? So when the reference is an RGB file and the encoded file is YUV, is ffmetrics converting the reference from RGB to YUV, or is it converting the encoded file from YUV to RGB?
Or is it something else entirely? I don't understand what's happening behind the scenes that causes a gap in the second chart when there is no gap in the first chart.

