Changes between Initial Version and Version 1 of Chroma Subsampling

Dec 21, 2018, 11:38:54 AM (2 years ago)

add page with first info on chroma subsampling


  • Chroma Subsampling

    v1 v1  
     3<h1 style="font-size: 22px;">
     4Chroma Subsampling
     8Since the human visual system is not as sensitive to color information compared to luminance information, most video codecs default to encoding the luma plane (Y') at full resolution, while using half or even quarter resolution for the chroma planes (Cb', Cr'). While slightly sacrificing video quality, this will result in data reduction.
     10Typical chroma subsampling approaches have the following names:
     12- 4:4:4: There is no chroma subsampling
     13- 4:2:2: Cb' and Cr' are sampled at half the sample rate of luma, the horizontal chroma resolution is halved
     14- 4:2:0: Cb' and Cr' are each subsampled at a factor of two, both horizontally and vertically
     16For more information, refer to [ Wikipedia].
     18= Setting Chroma Subsampling in ffmpeg =
     20In ffmpeg, chroma subsampling is performed by setting the corresponding ''pixel format'' of the output video stream. If you have an original source with full color information, ffmpeg will try to retain this information by choosing a matching output pixel format.
     22Depending on your use case, you may want to use a different pixel format, e.g., when you have a high-quality source that you are encoding for video streaming clients that do not support 4:2:2. In this case, you want to use 4:2:0 subsampling instead.
     24If you want to set different chroma subsampling formats, you have two options:
     26- `-pix_fmt <pix_fmt>`
     27- `-vf format=<pix_fmt>`
     29where `<pix_fmt>` is the targeted pixel format. See `ffmpeg -pix_fmts` for a list of supported pixel formats.
     31Among the most commonly used formats are:
     33- 8-bit 4:2:0: `yuv420p`
     34- 8-bit 4:2:2: `yuv422p`
     35- 8-bit 4:4:4: `yuv444p`
     36- 10-bit 4:2:0: `yuv420p10le`
     37- 10-bit 4:2:2: `yuv422p10le`
     38- 10-bit 4:4:4: `yuv444p10le`
     40= Example =
     42For example, if you want to encode to 8-bit 4:2:0:
     45ffmpeg -i input.mp4 -c:v libx264 -vf format=yuv420p output.mp4