How VOB Multiplexers Prevent Buffer Underflow
This article explains how multiplexers avoid buffer underflow when interleaving high-bitrate video, audio, and subtitle streams into a DVD Video Object (VOB) file. It details the role of the MPEG-2 System Target Decoder (STD) model, predictive buffer simulation, precise timestamp scheduling via System Clock Reference (SCR) and Presentation Time Stamps (PTS), and strategic interleaving within DVD physical bit-rate constraints.
The Buffer Underflow Problem
In DVD-Video authoring, a VOB file interleaves separate elementary streams (MPEG-2 video, AC-3/LPCM audio, and sub-pictures) into a unified stream constrained to a maximum overall delivery rate of 10.08 Mbps. Buffer underflow occurs when the hardware decoder's internal buffer empties before the next required frame or audio sample arrives, causing playback stutter or frozen frames. Preventing this requires the multiplexer (muxer) to act not just as a file packager, but as a real-time hardware simulator.
Simulation via the System Target Decoder (STD)
Multiplexers prevent underflow primarily by implementing a mathematical simulation of the MPEG-2 System Target Decoder (STD). The DVD specification defines exact buffer sizes for each component:
- Video Buffer (VBV/STD): Typically 224 KB (1.835 Mb).
- Audio Buffer: Typically 4 KB for AC-3, larger for LPCM.
- Sub-picture Buffer: Typically 16 KB.
Before writing data to the VOB container, the multiplexer simulates the behavior of these decoders in memory. It tracks the exact byte occupancy of each buffer for every microsecond of planned playback, ensuring that a stream's instantaneous consumption never exceeds the data supplied by the disc drive.
Timestamp Synchronization (SCR, DTS, and PTS)
Data delivery and consumption are governed by a strictly synchronized clock system running at 27 MHz:
- System Clock Reference (SCR): Encoded into the header of each 2048-byte VOB pack, the SCR tells the player the exact time that specific pack must arrive at the demultiplexer.
- Decoding Time Stamp (DTS): Specifies the exact moment a compressed picture must be removed from the buffer and decoded.
- Presentation Time Stamp (PTS): Specifies when the uncompressed frame must be shown to the user.
To prevent underflow, the multiplexer adjusts the SCR schedule so that packets arrive well in advance of their DTS. If a complex video scene demands a sudden surge in bitrate, the multiplexer must advance the delivery of those video packs relative to their decode time.
Look-Ahead Analysis and Pre-buffering
High-bitrate scenes (peaks approaching 9.8 Mbps for video alone) cannot be transferred strictly "just-in-time" because disc read limits cap the maximum intake. A modern multiplexer performs look-ahead analysis across the entire presentation:
- Pre-filling the Buffer: During low-action, low-bitrate scenes preceding a high-bitrate spike, the multiplexer allocates excess delivery bandwidth to the video stream. This gradually fills the 224 KB buffer near maximum capacity before the complex scene begins.
- Drain Management: When the high-bitrate scene occurs, the decoder draws data from its buffer faster than the 10.08 Mbps drive transfer limit can replenish it. Because the buffer was pre-filled, it drains smoothly without hitting empty (underflow) before the peak subsides.
Interleaving Strategy and VOBU Construction
VOB files are divided into Video Object Units (VOBUs), each representing 0.4 to 1.0 seconds of content, aligned with an MPEG-2 Group of Pictures (GOP). Within each VOBU, 2048-byte packs are dynamically ordered.
The multiplexer constantly evaluates buffer "run-out times." If the audio decoder buffer is 80 milliseconds away from starvation while the video buffer has 300 milliseconds of safety margin, the multiplexer interrupts the video stream to insert an audio pack. By constantly prioritizing the stream closest to its lower threshold, the multiplexer ensures all concurrent decoders remain adequately supplied.