How DTS Handles Out-of-Order B-Frames in VOB

In DVD-Video VOB (Video Object) containers based on the MPEG-2 Program Stream specification, bidirectional predictive frames (B-frames) require reference data from both past and future anchor frames to decode properly. Because a future reference frame must be decoded before a B-frame can be reconstructed, the physical transmission order of frames inside the VOB differs from their final playback sequence. The Decoding Time Stamp (DTS) works in tandem with the Presentation Time Stamp (PTS) inside the Packetized Elementary Stream (PES) headers to instruct the hardware decoder exactly when to unpack and reconstruct these out-of-order frames, preventing buffer underflows and visual stutter.

The Display Order vs. Decoding Order Problem

MPEG-2 video utilizes three primary picture types: Intra-coded (I-frames), Predictive (P-frames), and Bidirectional (B-frames). While I-frames and P-frames serve as reference anchors, B-frames rely on motion vectors referencing both the preceding and succeeding anchor frames.

Consider a standard playback sequence (Presentation Order):

To display frame B1, the decoder requires the pixel data from both I0 and P3. Consequently, P3 must arrive and decode before B1 can be processed. The stream multiplexer therefore reorders the frames into the bitstream sequence (Decoding Order):

The Separation of DTS and PTS

Because the decoding sequence diverges from the display sequence, the MPEG-2 standard separates timing instructions into two 33-bit counters embedded in the PES header:

  1. Decoding Time Stamp (DTS): Specifies the exact moment the compressed picture must be removed from the decoder buffer and decompressed by the video processor.
  2. Presentation Time Stamp (PTS): Specifies the exact moment the fully reconstructed picture must be sent from the frame store to the display output.

When display order and decoding order match (such as in an audio stream, or a video stream consisting solely of I-frames and P-frames without frame reordering), DTS is omitted to save bandwidth, and the decoder treats PTS as the target for both operations. When B-frames are introduced, DTS becomes mandatory for the anchor frames.

How DTS Processes B-Frames in the Decoder Buffer

Inside the VOB pipeline, the decoder manages these timestamps using a dedicated Video Buffering Verifier (VBV) buffer:

  1. Reordering the Anchor: Frame P3 enters the buffer with an early DTS and a late PTS. The DTS triggers immediate decompression of P3. Once decompressed, the decoded image of P3 is stored in a reference frame buffer and held, rather than immediately sent to the display.
  2. Decoding the B-Frames: When B1 arrives at the decoder, its DTS triggers decompression. Because I0 and P3 are already decoded and sitting in the reference memory, B1 can interpolate between them immediately.
  3. Equivalence on B-Frames: Because B-frames are never used as references for subsequent frames, they do not need to be retained in reference memory. For B-frames, the DTS and PTS values are identical, meaning the frame is decoded and presented at the exact same instant.
  4. Final Presentation: While the B-frames are decoded and displayed in rapid succession according to their timestamps, P3 remains in the buffer until the system clock matches its distinct, later PTS value, at which point it is finally pushed to the display.

Through this split-timestamp mechanism, the DTS dictates the non-linear computation timeline required by temporal compression, while the PTS maintains a continuous, linear output for playback.