[Cin] 8-bit vs 10-bit 420 and 422 pixel formats

Terje J. Hanssen terjejhanssen at gmail.com
Thu Jul 25 17:16:52 CEST 2024


Usually 8-bit color depth is refered to 420 pixel formats and 10-bit to 
the higher color quality 422 pixel formats,
which sub-sampled keeps respectively 25% and 50% color information, 
compared with a full 444 format.

But what about the "opposite" cases, 10-bit 420 and 8-bit 422 pixel formats?
What and when are they used and good for (applications)?
For example frame grabbers like my HDMI->USB3 mini capture card, looks 
to support 'YUY2',' a 8-bit 422 pixel format.

And among 8-bit and 10-bit depths, there are 'yuv', 'nv', 'y' and 'p' 
prefixed pixel formats as well.

Querying my system ffmpeg, the following list of 8-bit and 10-bit pixel 
formats are available:

    ffmpeg -hide_banner -pix_fmts | grep -E
    'yuv42.*8-8-8|yuv42.*10-10-10|nv.*8-8-8|nv.*10-10-10|210' | sort -r -k 5
    -----
    Pixel formats:
    I.... = Supported Input  format for conversion
    .O... = Supported Output format for conversion
    ..H.. = Hardware accelerated format
    ...P. = Paletted format
    ....B = Bitstream format
    FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS
    -----
    IO... yuv422p                3 16      8-8-8
    IO... yuv420p                3 12      8-8-8
    IO... nv42                   3 24      8-8-8
    IO... nv24                   3 24      8-8-8
    IO... nv21                   3 12      8-8-8
    IO... nv16                   3 16      8-8-8
    IO... nv12                   3 12      8-8-8
    ..... y210be                 3 20      10-10-10
    ..... nv20le                 3 20      10-10-10
    ..... nv20be                 3 20      10-10-10
    IO... yuv422p10le            3 20      10-10-10
    IO... yuv422p10be            3 20      10-10-10
    IO... yuv420p10le            3 15      10-10-10
    IO... yuv420p10be            3 15      10-10-10
    IO... y210le                 3 20      10-10-10
    IO... p210le                 3 20      10-10-10
    IO... p210be                 3 20      10-10-10

The ffmpeg h264 encoder supports the following pixel formats (all):

    ffmpeg -hide_banner -h encoder=h264 | grep Supported
         Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p
    yuv444p yuvj444p nv12 nv16 nv21 yuv420p10le yuv422p10le yuv444p10le
    nv20le gray gray10le
         Supported pixel formats: bgr0 bgr24 rgb24
         Supported pixel formats: yuv420p yuvj420p
         Supported pixel formats: nv12 yuv420p
         Supported hardware devices: cuda cuda
         Supported pixel formats: yuv420p nv12 p010le yuv444p p016le
    yuv444p16le bgr0 bgra rgb0 rgba x2rgb10le x2bgr10le gbrp gbrp16le cuda
         Supported hardware devices: qsv qsv qsv
         Supported pixel formats: nv12 qsv
         Supported hardware devices: vaapi
         Supported pixel formats: vaapi

I have run some rendering tests using some h264 8-bit and 10-bit pixel 
formats as follows:

Cinelerra Infinity - built: Jun 30 2024 08:31:40
Libav version: Lavc61.3.100

    Input file:
    3,3G    cfhd01.mkv
    Video: cfhd (CFHD / 0x44484643), yuv422p10le(tv, bt709, top coded
    first (swapped)), 1920x1080, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k
    tbn (default)

    Rendered to h264 8bit and 10bit pixel formats:

    72M    h264_8bit_nv12.mp4
    ** rendered 1780 frames in 46.067 secs, 38.639 fps
    Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc,
    smpte170m/unknown/unknown, top first), 1920x1080 [SAR 1:1 DAR 16:9],
    8462 kb/s

    72M    h264_8bit_yuv420p.mp4
    ** rendered 1780 frames in 48.250 secs, 36.891 fps
    Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc,
    smpte170m/unknown/unknown, top first), 1920x1080 [SAR 1:1 DAR 16:9],
    8462 kb/s

    83M    h264_8bit_yuv422p.mp4
    ** rendered 1780 frames in 41.807 secs, 42.577 fps
    Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuvj422p(pc,
    smpte170m/unknown/unknown, top first), 1920x1080 [SAR 1:1 DAR 16:9],
    9683 kb/s

    70M    h264_10bit_yuv420p10le.mp4
    ** rendered 1780 frames in 42.414 secs, 41.967 fps
    Video: h264 (High 10) (avc1 / 0x31637661), yuv420p10le(pc,
    smpte170m/unknown/unknown, top first), 1920x1080 [SAR 1:1 DAR 16:9],
    8213 kb/s

    80M    h264_10bit_yuv422p10le.mp4
    ** rendered 1780 frames in 42.920 secs, 41.473 fps
    Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p10le(pc,
    smpte170m/unknown/unknown, top first), 1920x1080 [SAR 1:1 DAR 16:9],
    9364 kb/s


References:
Chroma Subsampling in ffmpeg
https://trac.ffmpeg.org/wiki/Chroma%20Subsampling#SettingChromaSubsamplinginffmpeg
Preferred YUV Formats (Microsoft Windows, Learn)
https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#preferred-yuv-formats





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cinelerra-gg.org/pipermail/cin/attachments/20240725/9eb2299f/attachment.htm>


More information about the Cin mailing list