[FFmpeg-user] BGR48BE to yuv420p10le conversion - which rgb2yuv coefficients are actually used?

Michał Kudelski m.a.kudelski at gmail.com
Thu May 14 15:51:08 EEST 2020


Hi All,

I am converting 16-bit PNG frames to yuv420p10le (and encoding them to
HDR10 videos) with the following command:

ffmpeg \
    -pix_fmt bgr48be \
    -framerate 23.976 \
    -i "${1}%05d${extension}" \
    -color_primaries 9 \
    -color_trc 16 \
    -colorspace 9 \
    -color_range 1 \
    -c:v libx265 \
    -pix_fmt yuv420p10le \
    -crf 1 \
    -b:v 0 \
    output.mkv


It seems to work correct, but I need to reproduce the BGR48BE to
yuv420p10le conversion outside of the ffmpeg. For this, I need to know the
underlying rgb2yuv coefficients.

Assuming Y' = WR⋅R′ + WG⋅G′ + WB⋅B′, is it:
a) WR = 0.2627, WB = 0.0593, WG = 1−KR−KB = 0.678 [bt.601]
b) WR = 0.299, WB = 0.114, WG = 1−WR−WB = ...          [bt.709]
c) WR = 0.2126, WB = 0.0722, WG =  1−WR−WB = ...     [bt.2020]
d) other?

Best regards,
Michal Kudelski


More information about the ffmpeg-user mailing list