Demuxing PCM and AC-3 Streams in VOB 0xBD

Inside a DVD Video Object (VOB) file, both Linear PCM (LPCM) and AC-3 (Dolby Digital) audio tracks share the MPEG-2 private_stream_1 identifier (0xBD). A software demuxer distinguishes between these formats by inspecting the DVD-specific sub-stream ID byte located at the very start of the Packetized Elementary Stream (PES) payload, and further validates the audio data using the format-specific header fields and external IFO container metadata.

The Role of Stream ID 0xBD in MPEG-2 Program Streams

Standard MPEG-2 Program Stream specifications reserve stream IDs 0xC0 through 0xDF for native MPEG audio. Because AC-3, DTS, and raw PCM are not native MPEG-1 or MPEG-2 audio types, the DVD-Video standard encapsulates them inside the generic private stream ID 0xBD (private_stream_1).

Since multiple tracks (such as different languages, audio formats, or sub-picture subtitles) can share this single stream ID, the DVD specification implements a secondary multiplexing layer directly within the PES packet payload.

Sub-Stream ID Identification

When a demuxer encounters a PES packet with stream ID 0xBD, it skips the standard MPEG PES header to read the first byte of the PES packet payload. This byte is the sub-stream ID, which identifies both the format and the track index:

If the first byte falls between 0x80 and 0x87, the demuxer routes the payload to an AC-3 decoder or file writer. If it falls between 0xA0 and 0xA7, the demuxer treats it as LPCM.

Payload Header Validation

After identifying the sub-stream ID byte, the demuxer examines the subsequent DVD audio header bytes to parse framing details. These bytes differ significantly between AC-3 and PCM:

AC-3 PES Payload Header

For an AC-3 stream, the 1-byte sub-stream ID is followed by a 3-byte DVD audio header:

  1. Byte 0: Sub-stream ID (0x800x87).
  2. Byte 1: Number of frame headers located in this packet.
  3. Bytes 2–3: A 16-bit offset pointing to the start of the first access unit (the first complete AC-3 frame).

Immediately following this offset, the raw AC-3 syncword (0x0B77) appears, allowing the demuxer to verify sync and parse the audio frame.

LPCM PES Payload Header

For an LPCM stream, the 1-byte sub-stream ID is followed by a 6-byte DVD LPCM audio header:

  1. Byte 0: Sub-stream ID (0xA00xA7).
  2. Byte 1: Number of frames.
  3. Bytes 2–3: First access unit pointer (offset to the first PCM audio sample block).
  4. Byte 4: Emphasis flag, mute flag, and frame number.
  5. Byte 5: Quantization word length (16, 20, or 24-bit) and audio sampling frequency (48 kHz or 96 kHz).
  6. Byte 6: Channel configuration and number of audio channels (e.g., mono, stereo, 5.1).

The demuxer uses these configuration flags in byte 5 and byte 6 to construct the appropriate PCM output headers (such as a standard WAV header) when demuxing raw audio samples.

Cross-Referencing IFO Metadata

While standalone VOB demuxers rely entirely on the sub-stream byte and payload headers, complete DVD demuxing software typically queries the associated Video Title Set Information file (VTS_XX_0.IFO) before parsing the VOB directly.

The VTS_VOB_ATTR table inside the IFO file explicitly maps each audio stream number to its coding standard (AC-3, LPCM, DTS, or MPEG), sample rate, language code, and channel layout. By reading this table first, the demuxer establishes which sub-stream IDs to expect within 0xBD packets throughout the corresponding VTS_XX_X.VOB files.