How Multiplexers Align Audio and Video PTS in a VOBU
Multiplexing audio and video into a single Video Object Unit (VOBU) within a DVD Video Object (VOB) requires precise synchronization using a shared 90 kHz System Time Clock (STC). In a VOBU, the multiplexer evaluates the Presentation Time Stamp (PTS) of the starting video I-frame, defines the VOBU's temporal boundaries, calculates the corresponding audio frame durations, and interleaves the streams using buffer models. This ensures continuous playback without buffer underflow or drift between audio and video tracks.
Establishing the Presentation Window
A VOBU represents an MPEG-2 Program Stream container that typically spans 0.4 to 1.0 seconds of playback, beginning strictly with a Navigation Pack (NV_PCK) followed by a Group of Pictures (GOP). The primary reference for the VOBU's presentation window is determined by the video stream:
- Start PTS: The multiplexer assigns the presentation start time of the VOBU based on the PTS of the first sequence I-frame.
- End PTS: The presentation duration is defined by the sum of all display durations of the pictures contained in the GOP, establishing an exact timeline window \([PTS_{start}, PTS_{end}]\).
Mapping Audio Frames to Video Timecodes
Audio formats used in VOBs—such as AC-3, MPEG-1 Audio Layer II, or LPCM—operate on fixed frame sizes that rarely divide evenly into video frame periods (e.g., a 32 ms AC-3 frame versus a 33.37 ms NTSC video frame).
To align audio to video:
- The multiplexer computes the discrete PTS for each successive audio frame based on sample count and sampling rate (e.g., 48 kHz).
- Audio frames whose PTS falls within the active VOBU presentation window are associated with that specific VOBU.
- Because audio frame durations do not align perfectly with video GOP boundaries, an audio frame often straddles two adjacent VOBUs. The multiplexer generally includes an audio frame in the current VOBU if its PTS begins before the video presentation end time, allowing the tail of the audio frame to briefly play across the boundary into the next VOBU.
Buffer Simulation and Delivery Scheduling (SCR)
PTS dictates when a frame must be rendered, but it does not dictate when data arrives at the decoder. Alignment requires satisfying the System Target Decoder (STD) buffer constraints for both audio and video:
- System Clock Reference (SCR): The multiplexer stamps each pack (Pack Header) with an SCR value indicating the exact byte-arrival time at the decoder.
- Buffering Delay: The multiplexer positions audio packs alongside video packs so that the audio stream's SCR allows the data to enter the decoder audio buffer well before its PTS.
- Preventing Underflow/Overflow: Audio bitrates are typically much lower and constant compared to variable-bitrate (VBR) video. The multiplexer calculates a rolling simulation of both the audio and video decoder buffers. It interleaves audio packs periodically across the GOP so that neither the video buffer starves during complex scenes nor the audio buffer overflows due to early delivery.
Boundary Continuity Across Consecutive VOBUs
Inside a VOB, presentation time must remain continuous across VOBU boundaries unless a cell boundary or angle switch occurs. The multiplexer ensures seamless alignment by maintaining an unbroken sequence of audio PTS values that match the continuous video PTS track:
- Fractional Offsets: Any minor fractional sample offsets between audio and video display ends are tracked internally. The multiplexer compensates for this offset in subsequent VOBUs to prevent cumulative audio-video drift.
- Padding and Stuffing: If an audio frame finishes
early within the data allocated for that sector, the multiplexer inserts
stuffing bytes or padding packets (
0x000001BE) within the pack to preserve the temporal alignment of the next stream packet.