logologoHomeBlog

Navigation

  • All Posts

Topics

  • Version History
  • Tips & Tricks

More

  • RSS Feed
  • Donate
  1. Home
  2. >
  3. Blog
  4. >
  5. Analyzing YUV files: pixel formats and color planes explained

Analyzing YUV files: pixel formats and color planes explained

April 4, 2026
howtotips-n-tricks

Raw YUV files are everywhere in video engineering, yet they carry no metadata at all - no resolution, no pixel format, no frame rate. Open one in the wrong configuration and you get a garbled mess of colored noise. In this guide we will walk through the YUV Viewer and show how to turn those mystery bytes into a picture you can actually work with.

Creating a YUV file for inspection

If you only have an MP4, MOV, MKV, or transport stream, convert it to a raw YUV stream first. The most direct tool for that job is ffmpeg.

Raw video is the simplest representation to inspect, but it is also one of the most reliable ways to debug frame differences. Once two sources are converted into the same raw pixel format and resolution, you can compare them on common ground instead of chasing container quirks, decoder behavior, timestamps, or encoder-specific packaging. That workflow is standard across codec, playback, and video-tooling debugging.

To export a file in the most common viewer-friendly format, use yuv420p:

ffmpeg -i input.mp4 -pix_fmt yuv420p -f rawvideo output_1920x1080_yuv420.yuv

That command writes raw frame bytes with no container metadata, so put the resolution and format in the filename. The viewer can often infer those values from names like output_1920x1080_yuv420.yuv.

One practical rule matters here:

  • Keep the exported resolution fixed. If you scale during conversion, include the new size in the filename.

If you need only a short clip for debugging, trim it during export so the raw file stays manageable:

ffmpeg -ss 00:00:10 -t 2 -i input.mp4 -pix_fmt yuv420p -f rawvideo sample_1920x1080_yuv420.yuv

Other tools can do the same job, but the principle is identical: export raw video frames without a container, normalize both sources to the same resolution and pixel format, then open those .yuv files with matching settings in the viewer.

Opening a file

Click Open File in the YUV Viewer toolbar and select your .yuv file. A configuration dialog appears where you set three things: resolution, pixel format, and frame rate.

The viewer now does more than simple filename parsing. It runs a quick correlation-based scan as soon as the dialog opens, combines that with filename hints and file-size heuristics, and shows a confidence label for the guess. If the first suggestion still looks wrong, run Deep Scan to try more resolution and format candidates, then apply one of the alternatives from the results list.

You can still override everything manually, swap width and height, or click a common resolution preset. Once the preview looks right, hit Open and the first frame will render on screen.

Choosing the right pixel format

The viewer supports eight formats, grouped into three families:

Planar - each component (Y, U, V) stored as a separate contiguous block:

  • YUV420 (I420) - 4:2:0 subsampling, 1.5 bytes per pixel. The most common format for compressed video.
  • YV12 - 4:2:0 planar with U and V stored in reverse order compared with I420.
  • YUV422 - 4:2:2 subsampling, 2 bytes per pixel. Often used in broadcast and professional editing.
  • YUV444 - no subsampling, 3 bytes per pixel. Full chroma resolution.

Semi-planar - Y plane first, then interleaved UV (or VU):

  • NV12 - 4:2:0 with interleaved UV. Common on mobile and hardware decoders.
  • NV21 - same as NV12 but with swapped U and V. Default on many Android devices.

Packed - luma and chroma samples interleaved in a single plane:

  • YUYV (YUY2) - 4:2:2 packed. Widely used in capture cards and webcams.
  • UYVY - 4:2:2 packed, alternate byte order.

Picking the wrong format usually produces a recognizable artifact. A resolution mismatch creates diagonal "barber-pole" stripes. A chroma plane swap (NV12 vs NV21) tints the entire image with the wrong hue. If something looks off, try a different format before changing the resolution.

Inspecting individual color planes

The display mode selector lets you view each component in isolation:

  • RGB - standard color output using BT.601 YUV-to-RGB conversion.
  • Y - the luma (brightness) plane only, shown as grayscale.
  • U (Cb) - the blue-difference chroma plane.
  • V (Cr) - the red-difference chroma plane.

Viewing planes individually is useful for spotting problems that are invisible in the combined image. Chroma bleeding, subsampling artifacts, and plane-swap errors become obvious when you isolate U or V.

Using the pixel inspector

Hover over any pixel to see its coordinates, raw YUV values, and converted RGB values in both decimal and hexadecimal. On touch devices, drag a finger over the image to update the readout the same way.

If you need to carry those numbers into a bug report or test note, right-click a pixel to copy coordinates, RGB, YUV, or the full inspection block.

This is especially handy when you need to verify exact sample values - for instance, checking that black is encoded as Y=16 (limited range) vs Y=0 (full range), or confirming that a specific test pattern has the expected chroma values.

Comparing two files

The YUV Viewer can open multiple files and compare any two selected files in four modes:

  • Single - show just one selected file.
  • Side by Side - two files rendered next to each other at the same zoom level.
  • Difference - pixel-by-pixel subtraction visualized as brightness. Identical pixels are black.
  • Split Screen - a draggable divider lets you slide between the two files.

To enter comparison mode, select one file normally, then add the second with the file checkbox or Cmd/Ctrl+click in the Files panel. The viewer keeps the two selections frame-locked and uses the shorter clip as the playback limit so stepping stays aligned.

Difference mode also has an amplification slider (1-10x) that multiplies the difference values, making subtle quality losses visible to the naked eye. This is invaluable for encode quality audits and regression testing.

Zooming in on artifacts

Use the zoom controls in the Controls panel, pick a preset from the zoom dropdown, or hold Ctrl and use the mouse wheel over the image. The zoom menu also exposes Fit to Window and Actual Size (1:1) shortcuts.

When the image is highly magnified, enable the pixel grid to see exact sample boundaries. The grid overlays the rendered image and makes it much easier to inspect subsampling layout, packed-format byte interpretation, single-pixel ringing, and block-edge artifacts.

Keyboard shortcuts

A few shortcuts that speed up daily work:

  • Space - play / pause
  • Arrow Left / Right - step one frame backward / forward
  • Home / End - jump to first / last frame
  • + / - / 0 - zoom in, zoom out, reset zoom
  • Ctrl + Shift + P (Cmd + Shift + P on Mac) - open the command palette for quick access to all viewer actions

Wrapping up

The key to working with raw YUV files is knowing your format. Once resolution and pixel format are set correctly, the YUV Viewer gives you GPU-accelerated rendering, confidence-scored auto-detection, per-pixel inspection, pixel-grid analysis, and side-by-side comparison - all without leaving the browser. Next time you inherit an unlabeled .yuv file, start with the quick guess, escalate to Deep Scan if needed, and verify the result with plane views and the inspector.

Enjoy this post? Subscribe via RSS to get notified about new articles.
Previous Post
Decoding Media Metadata: How Tools and Devices Leave Their Fingerprints
Next Post
v0.6.0

Similar Posts

September 25, 2023•
howtotips-n-tricks

How to check MPEG-TS program map table

Today we will learn how to quickly check MPEG-TS **program map table (PMT)** using VTCLab Media Analyzer. When you begin the analysis of MPEG-TS file, PMT may be a good start point. **It contains in

March 12, 2024•
howto

Exploring Apple's Stereoscopic Video

Apple's recent introduction of stereoscopic ("3D") video storage format for its visionOS platform, the algorithmic core of Apple Vision Pro glasses, has sparked a surge in interest. Support for this

February 26, 2024•
tips-n-tricks

New UI elements

In this post, we'll introduce the latest updates to the user interface of the analyzer application. We've added new elements aimed at optimizing functionality and improving the user experience. Let's