How to Use YUV Analyzer to Diagnose Color Issues

YUV Analyzer Tools: Comparing Formats and Workflows### Introduction

YUV analyzers are indispensable tools for video engineers, colorists, codec developers, and anyone working with digital video pipelines. They let you inspect raw pixel data, evaluate color fidelity, diagnose format mismatches, and confirm that encoding, color space conversions, and chroma subsampling are performed correctly. This article compares common YUV formats, surveys popular analysis tools, and outlines practical workflows for diagnosis and troubleshooting.


What is YUV?

YUV is a family of color representations separating luminance (Y) from chrominance (U and V). This separation allows efficient compression by reducing chroma resolution while preserving perceived detail, since human vision is more sensitive to luminance.

Key facts

  • Y = luminance (brightness)
  • U and V = chrominance (color differences)

YUV is a conceptual family rather than a single fixed format; it includes different sampling schemes, bit depths, and color space definitions (e.g., BT.601, BT.709, BT.2020).


Common YUV Formats and Their Differences

Below is a concise comparison of typical YUV sampling formats and what they mean for image detail, bandwidth, and common uses.

Format Sampling Color Detail Use Cases
YUV4:4:4 Y, U, V at full resolution Max color fidelity High-end color grading, VFX, studio post
YUV4:2:2 U and V sampled horizontally at half res Good color fidelity for motion Broadcast, video production
YUV4:2:0 U and V sampled both horizontally and vertically at half res Reduced chroma detail, efficient Consumer video, streaming, codecs (H.264, HEVC)
YUV4:1:1 U and V sampled at quarter horizontal resolution Very low chroma detail Specific codecs, some archival formats
YVU Same as YUV but U and V order swapped No quality difference, just channel order File formats that expect different channel order

Bit depth variants (8-bit, 10-bit, 12-bit) affect quantization and banding; higher bit depths reduce banding and support HDR.


Color Spaces and Ranges

YUV values depend on the color space (BT.601 vs BT.709 vs BT.2020) and the numeric range (full vs limited):

  • Full range (0–255 for 8-bit) vs limited/video range (16–235 for Y, 16–240 for U/V in 8-bit): Mismatches produce crushed blacks or clipped highlights.
  • Matrix coefficients: BT.601 typical for SD; BT.709 used for HD; BT.2020 for UHD/HDR. Applying the wrong matrix will shift colors and desaturate or tint the image.

Here are widely used tools for inspecting YUV data, each with strengths depending on needs:

  • FFmpeg (ffplay, ffprobe): Command-line tools for quick inspections, conversions, and metadata.
  • YUView: GUI-based, open-source YUV player and analyzer with per-channel viewing, waveform, vectorscope, and pixel peeking.
  • RawVideoPlayer / RawPlayer: Simple players for raw YUV files with channel toggles.
  • VirtualDub (with plugins): Windows tool for frame-level inspection and filters.
  • DaVinci Resolve / NLE scopes: Professional scopes with waveform, vectorscope, and RGB parade; can ingest raw YUV sources.
  • Custom scripts (Python with NumPy/OpenCV): For automated analysis, histograms, and batch checks.

Features to Look For in a YUV Analyzer

  • Per-channel display (Y, U, V) and toggles for viewing individual components.
  • Waveform monitor and vectorscope for luminance and chroma distribution.
  • Pixel peeking with numeric values and coordinate readouts.
  • Support for varied sampling formats (4:4:4, 4:2:2, 4:2:0) and bit depths.
  • Color space and range conversion options (BT.601 ↔ BT.709, full ↔ limited).
  • Ability to visualize chroma placement and subsampling artifacts.
  • Batch processing and automation APIs for large sets of files.

Typical Workflows

1) Quick Format & Metadata Check
  • Use ffprobe to read container metadata and stream info.
  • Confirm pixel format, bit depth, color space, and range.
  • Command example:
    
    ffprobe -show_streams input.yuv 
2) Visual Inspection
  • Open frames in YUView or a raw player.
  • Inspect Y, U, V channels separately to spot chroma collapse, noise in U/V, and luma clipping.
  • Use pixel peeking to verify expected numeric ranges.
3) Scope-Based Diagnosis
  • Use waveform to check luma distribution and headroom.
  • Use vectorscope to detect hue shifts or saturation changes caused by wrong matrix or channel swapping.
  • Check RGB parade to see whether conversion to RGB introduced clipping or shifts.
4) Subsampling & Upsampling Checks
  • Downmix and upsample chroma to simulate codec behavior; compare against original using difference/blend modes.
  • Visualize artifacts like chroma bleeding, stair-stepping, and edge-color contamination.
5) Automation for Batch QA
  • Write Python/FFmpeg scripts to verify format compliance, count frames, and sample pixel values at key coordinates.
  • Generate per-file CSV reports of min/max/mean for each plane.

Common Problems and How to Diagnose Them

  • Color shift after transcoding: Check matrix and color range; verify whether U/V order was swapped.
  • Banding in gradients: Likely low bit depth; inspect histograms and consider dithering or higher bit depth.
  • Chroma bleeding or ghosting: Result of aggressive chroma subsampling or poor upsampling; inspect U/V channels separately.
  • Clipping of highlights or crushed blacks: Numeric range mismatch (full vs limited); convert ranges appropriately.

Practical Examples

  • Diagnosing a green tint:

    • Check whether U and V are swapped (compare pixel values to expected).
    • Check the vectorscope: clusters shifted toward green axis point to matrix/range mismatch.
  • Fixing crushed blacks:

    • Determine if source is full range but treated as limited. Convert from full to limited or vice versa using ffmpeg:
      
      ffmpeg -i in.yuv -vf scale=in_range=full:out_range=limited -c:v rawvideo out.yuv 

Conclusion

Choosing the right YUV analyzer depends on whether you need quick command-line checks, deep visual inspection, professional grading scopes, or automated batch QA. Understanding sampling formats, color spaces, and numeric ranges is essential to correctly interpret YUV data and to avoid common pitfalls like color shifts, clipping, and chroma artifacts.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *