Changes between Initial Version and Version 1 of Chroma Subsampling


Ignore:
Timestamp:
Dec 21, 2018, 11:38:54 AM (10 months ago)
Author:
slhck
Comment:

add page with first info on chroma subsampling

Legend:

Unmodified
Added
Removed
Modified
  • Chroma Subsampling

    v1 v1  
     1{{{
     2#!html
     3<h1 style="font-size: 22px;">
     4Chroma Subsampling
     5</h1>
     6}}}
     7
     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.
     9
     10Typical chroma subsampling approaches have the following names:
     11
     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
     15
     16For more information, refer to [https://en.wikipedia.org/wiki/Chroma_subsampling Wikipedia].
     17
     18= Setting Chroma Subsampling in ffmpeg =
     19
     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.
     21
     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.
     23
     24If you want to set different chroma subsampling formats, you have two options:
     25
     26- `-pix_fmt <pix_fmt>`
     27- `-vf format=<pix_fmt>`
     28
     29where `<pix_fmt>` is the targeted pixel format. See `ffmpeg -pix_fmts` for a list of supported pixel formats.
     30
     31Among the most commonly used formats are:
     32
     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`
     39
     40= Example =
     41
     42For example, if you want to encode to 8-bit 4:2:0:
     43
     44{{{
     45ffmpeg -i input.mp4 -c:v libx264 -vf format=yuv420p output.mp4
     46}}}
     47