How Media Player Classic Renders Embedded VOB Subtitles

Media Player Classic (MPC-HC/MPC-BE) handles embedded VOB subtitles through a multi-stage pipeline involving stream demuxing, packet reassembly, run-length decoding, and video overlay composition. Unlike text-based subtitles, VOB subtitles (found in DVD-Video and VOB/MPG containers) are pre-rendered bitmap images accompanied by display commands. Media Player Classic utilizes its internal source filters (or external splitters like LAV Splitter) alongside its Internal Subtitle Renderer (ISR) to extract these compressed subpicture streams, interpret their timing and color palettes, decode the graphical elements, and blit them seamlessly over the decoded video frames.

1. Demuxing and Packet Extraction

VOB files encapsulate data using the MPEG-2 Program Stream format. Subtitles within this structure are designated as "Subpicture" data and are carried inside MPEG Packetized Elementary Stream (PES) packets marked under Private Stream 1 (with stream IDs ranging from 0x20 to 0x3F).

When playback begins, MPC's demuxer scans the pack headers to identify these subpicture tracks. Because a single subtitle graphic is often larger than an individual PES packet, the demuxer strips away the transport headers and concatenates the segmented payloads into a contiguous data block known as a Subpicture Unit (SPU).

2. SPU Structure Parsing

Once an SPU is reconstructed, the Internal Subtitle Renderer parses its contents. Each SPU consists of three primary components:

3. Palette and Transparency Resolution

VOB subpictures are 2-bit indexed images, meaning each pixel can only reference one of four logical color indexes: background, pattern (body/text), emphasis 1 (primary border/outline), and emphasis 2 (secondary outline or shadow).

The actual color definitions are not stored within the SPU itself. Instead, the SPU references a 16-color Color Look-Up Table (CLUT) found in the DVD’s .IFO configuration file or within the container’s metadata stream. MPC reads the control commands from the SP_DCSQ to map the 2-bit pixel indices to the 16-color palette (in YCbCr/YUV format) and applies the specified 4-bit contrast/alpha values (0 to 15, representing fully transparent to fully opaque) to determine the visibility of each element.

4. Decompression and Rasterization

The pixel decoder processes the RLE compressed data line by line:

  1. It reads control bits to determine run lengths (the number of consecutive pixels sharing the same color index).
  2. It expands these runs across the defined width and height of the bounding box.
  3. It separates and deinterlaces the odd and even field lines to assemble a single coherent, uncompressed bitmap.
  4. Using the resolved palette and alpha mappings, MPC transforms this indexed graphic into an internal 32-bit RGBA or AYUV bitmap buffer.

5. Synchronization and Rendering Overlay

Each SPU includes Presentation Time Stamps (PTS) that dictate precisely when the subtitle appears and disappears relative to the system reference clock. MPC's subtitle engine matches these timestamps against the audio/video clock to maintain exact synchronization.

Finally, the rasterized bitmap is passed to the video rendering engine (such as the MPC Video Renderer, EVR Custom Presenter, or madVR). The renderer handles aspect-ratio corrections—scaling the non-square pixel dimensions typical of standard-definition DVD content to match the target display—and alpha-blends the subtitle graphic directly onto the final video frame surface before it is presented to the display.