I asked Grok "Taking the source input into account (rgb24), is there a quality difference between yuv420p, yuv422p or the 10 bit yuv420p101e, yuv422p101e or yuv444p101e? Let us say for example I encoded a 4k/60 video using yuv420p and it was 100mb, approximately what would the file sizes of the other color options?"
Yes, there’s a quality difference between yuv420p, yuv422p, yuv420p10le, and yuv422p10le when encoding your RGB24 source, primarily due to differences in
chroma subsampling and
bit depth. Since your input is rgb24 (8-bit RGB), let’s break down how these pixel formats affect quality, especially in the context of your AV1 encoding with libsvtav1.
Key Concepts
- Chroma Subsampling:
- RGB24 stores full color information (4:4:4) with separate red, green, and blue channels at 8 bits each, no subsampling.
- YUV formats split the signal into luma (Y, brightness) and chroma (U/V, color), often subsampling chroma to reduce data while preserving perceived quality.
- 4:2:0 (e.g., yuv420p, yuv420p10le): Chroma is subsampled to 1/4 the resolution of luma (half horizontally and vertically). Common for video compression, but loses some color detail.
- 4:2:2 (e.g., yuv422p, yuv422p10le): Chroma is subsampled to half the horizontal resolution of luma, but full vertically. Retains more color detail than 4:2:0, at the cost of larger file sizes.
- Bit Depth:
- 8-bit (e.g., yuv420p, yuv422p): 256 levels per channel. Matches your RGB24 input’s bit depth but may introduce banding in gradients during conversion.
- 10-bit (e.g., yuv420p10le, yuv422p10le): 1024 levels per channel. Offers smoother gradients and better color precision, even if the source is 8-bit, by reducing quantization errors during encoding.
Quality Comparison from RGB24 Source
Here’s how each format stacks up when converting from your 8-bit RGB24 (4:4:4) input:
1. yuv420p (8-bit, 4:2:0)
- Chroma: Subsampled to 4:2:0, losing 75% of the color resolution compared to RGB24. Fine for most content, but sharp color edges (e.g., text, graphics) may blur slightly.
- Bit Depth: Matches RGB24’s 8-bit depth, so no additional precision is gained. Gradients may show banding if heavily compressed.
- Quality: Lowest of the four due to aggressive chroma subsampling and no bit-depth advantage. Best for smallest file sizes, but sacrifices detail.
2. yuv422p (8-bit, 4:2:2)
- Chroma: Subsampled to 4:2:2, retaining twice the horizontal color resolution of 4:2:0. Better for content with horizontal color transitions (e.g., video with text or fine patterns).
- Bit Depth: Still 8-bit, so no improvement over RGB24 in dynamic range or gradient smoothness.
- Quality: Better than yuv420p due to less chroma loss, but still limited by 8-bit depth. Noticeable improvement in color fidelity over 4:2:0, especially for 4K.
3. yuv420p10le (10-bit, 4:2:0)
- Chroma: Same 4:2:0 subsampling as yuv420p, so color resolution is reduced compared to RGB24.
- Bit Depth: 10-bit encoding provides more precision, reducing banding in gradients and preserving more detail during compression, even from an 8-bit source.
- Quality: Better than yuv420p due to 10-bit depth, despite identical chroma subsampling. The quality boost comes from improved luma and chroma quantization, not color resolution.
4. yuv422p10le (10-bit, 4:2:2)
- Chroma: 4:2:2 subsampling retains more color detail than 4:2:0, closer to RGB24’s full 4:4:4.
- Bit Depth: 10-bit depth enhances gradient smoothness and compression resilience.
- Quality: Highest of the four. Combines better color resolution (4:2:2) with 10-bit precision, making it the closest to RGB24’s original quality while still being compressed.
5. yuv444p (8-bit, 4:4:4):
- Chroma: No subsampling (4:4:4), matching RGB24’s full color resolution. Every pixel retains its original color detail.
- Bit Depth: 8-bit, same as RGB24, so no additional precision beyond the source.
- Quality: Superior to yuv420p and yuv422p due to full chroma fidelity. Matches RGB24’s color resolution but may still show banding in gradients due to 8-bit limitations.
6. yuv444p10le (10-bit, 4:4:4):
- Chroma: Full 4:4:4, preserving all color detail from RGB24.
- Bit Depth: 10-bit, offering smoother gradients and better compression resilience than RGB24’s 8-bit.
- Quality: Highest possible quality among these options. It exceeds RGB24’s precision due to 10-bit depth while retaining full chroma, making it ideal for archival or professional use.
Quality Ranking (RGB24 Source)
From your 8-bit RGB24 input:
- yuv444p10le: Best (full chroma + 10-bit depth).
- yuv444p: Excellent (full chroma, but 8-bit limits gradients).
- yuv422p10le: Very good (half chroma horizontally + 10-bit).
- yuv420p10le: Good (quarter chroma + 10-bit).
- yuv422p: Moderate (half chroma horizontally, 8-bit).
- yuv420p: Lowest (quarter chroma, 8-bit).
- Chroma Impact: 4:4:4 (yuv444p, yuv444p10le) retains all color detail, making it noticeably sharper for synthetic content (e.g., text, UI) compared to 4:2:2 or 4:2:0. For natural video, the difference is subtler but still visible in color-rich scenes.
- Bit Depth Impact: 10-bit formats (yuv420p10le, yuv422p10le, yuv444p10le) reduce banding and improve quality under compression, even from an 8-bit source, due to better quantization.
Practical Impact
- From 8-bit RGB24: Since your source is 8-bit, 10-bit formats (yuv420p10le, yuv422p10le) don’t add new information but improve encoding quality by reducing artifacts (e.g., banding, color bleed) during compression. The jump from 4:2:0 to 4:2:2 is more noticeable with high-contrast color content (e.g., gaming, UI footage) than plain video.
- 4K 60fps: At this resolution and frame rate, chroma subsampling differences (4:2:0 vs. 4:2:2) are more apparent on large screens or with detailed content. 10-bit helps maintain quality under AV1’s compression.
Recommendation for Your Use Case
Given your priorities (quality slightly over size, streaming, 4K 60fps, max CPU usage with libsvtav1):
- yuv422p10le: Best quality option. Retains more chroma detail (4:2:2) and leverages 10-bit encoding. File size will be larger than 4:2:0, but since you prioritize quality, this aligns with your goals. Still streamable with AV1’s efficiency.
- yuv420p10le: If file size becomes a concern, this is a strong compromise. 10-bit improves quality over 8-bit, and 4:2:0 keeps sizes smaller. Most streaming platforms (e.g., YouTube) use 4:2:0, so it’s highly compatible.
- Avoid 8-bit (yuv420p, yuv422p): Since AV1 supports 10-bit natively and your CPU can handle it, 8-bit limits quality unnecessarily.
File Size Estimation
File size in video encoding depends on:
- Chroma Subsampling: More chroma data (4:4:4 > 4:2:2 > 4:2:0) increases bitrate.
- Bit Depth: 10-bit increases data per pixel (~20–30% more than 8-bit).
- Content: Complex scenes (e.g., high motion, detail) amplify these differences.
- Encoder Efficiency: AV1 (e.g., libsvtav1) compresses better than H.265, but relative trends hold.
Let’s assume:
- Your 4K 60fps video encoded with yuv420p (8-bit, 4:2:0) at CRF 20 is 100MB.
- Same CRF, preset (e.g., 6), and duration for all formats.
- Typical content (e.g., mixed natural and synthetic video).
Here’s an approximate file size comparison:
- yuv420p (8-bit, 4:2:0): 100MB (baseline).
- Minimal chroma data, 8-bit efficiency.
- yuv422p (8-bit, 4:2:2): ~130–150MB.
- Double the horizontal chroma resolution increases bitrate by ~30–50%. Exact increase depends on color complexity.
- yuv420p10le (10-bit, 4:2:0): ~120–140MB.
- 10-bit depth adds ~20–40% more data over 8-bit, even with same chroma subsampling, due to larger sample size.
- yuv422p10le (10-bit, 4:2:2): ~150–180MB.
- Combines 4:2:2’s ~30–50% chroma increase with 10-bit’s ~20–40% overhead. Typically 50–80% larger than yuv420p.
- yuv444p (8-bit, 4:4:4): ~180–220MB.
- Full chroma (4x the chroma data of 4:2:0) increases size significantly, ~80–120% over yuv420p. AV1’s compression mitigates some of this.
- yuv444p10le (10-bit, 4:4:4): ~220–260MB.
- Full chroma plus 10-bit depth. Roughly 120–160% larger than yuv420p, depending on content and compression efficiency.
Relative Increase Summary
Format | Approx. Size | % Increase vs. yuv420p |
---|
yuv420p | 100MB | 0% |
yuv422p | 130–150MB | 30–50% |
yuv420p10le | 120–140MB | 20–40% |
yuv422p10le | 150–180MB | 50–80% |
yuv444p | 180–220MB | 80–120% |
yuv444p10le | 220–260MB | 120–160% |
Factors Affecting Size Variation
- CRF: A lower CRF (e.g., 15) amplifies these differences; a higher CRF (e.g., 25) compresses them closer together.
- Content: High-motion or colorful content (e.g., gaming) increases sizes more with 4:4:4 or 4:2:2 vs. 4:2:0. Simple scenes (e.g., talking head) show less variation.
- Preset: Your preset 6 balances speed and compression. A slower preset (e.g., 4) reduces sizes across all formats but takes longer.
Recommendation for Your Use Case
Given your priorities (quality slightly over size, streaming, 4K 60fps, libsvtav1):
- yuv444p10le: Maximum quality, matching RGB24’s chroma and exceeding its bit depth. File size (~220–260MB) is larger, but AV1 keeps it streamable. Ideal if quality is paramount and bandwidth isn’t a tight constraint.
- yuv422p10le: Excellent balance (~150–180MB). Retains more chroma than 4:2:0, with 10-bit benefits, and is still efficient for streaming.
- yuv420p10le: Most practical for streaming (~120–140MB). Widely compatible, 10-bit quality boost, and smallest size among 10-bit options.