How Stuffing Bytes Maintain 2048-Byte VOB Sectors

DVD-Video Video Object (VOB) files are built upon the MPEG-2 Program Stream specification, which mandates that all data packs align perfectly with the 2048-byte physical sectors of a DVD. Because compressed video, audio, and subpicture streams produce variable-length data that rarely divides evenly into fixed-size blocks, multiplexers utilize stuffing bytes and padding packets to fill the remaining void. This article explains how stuffing byte allocation dynamically balances payload variations, ensuring every VOB pack meets the strict 2048-byte boundary required for seamless hardware playback.

The 2048-Byte Structural Requirement

Standard DVD media reads data in fixed physical sectors of 2048 bytes. To avoid costly hardware re-buffering or software realignment during optical playback, the DVD specification dictates that every logical unit—known as a "pack"—inside a VOB file must match this 2048-byte sector size precisely.

A standard pack consists of:

  1. Pack Header (14 bytes base): Contains synchronization markers, the System Clock Reference (SCR), and multiplex rate information.
  2. System Header (Optional, usually 18–24 bytes): Appears periodically to define stream bounds and buffer sizes.
  3. PES Packets (Variable): Packetized Elementary Stream packets containing the actual media payloads (e.g., MPEG-2 video, AC-3 audio).

Because audio frames and compressed video slices fluctuate in size, the raw media payload almost never perfectly completes the 2048-byte target.

Mechanisms for Stuffing Allocation

The MPEG-2 standard provides multiple hierarchical locations where non-payload "stuffing" bytes can be inserted without corrupting the media stream. Multiplexers choose among these mechanisms depending on how many residual bytes are needed to reach 2048 bytes.

1. Pack Header Stuffing (1 to 7 Bytes)

The MPEG-2 pack header includes a 3-bit field called pack_stuffing_length. This allows the encoder to insert between 1 and 7 stuffing bytes (fixed to the value 0xFF) directly at the end of the pack header. This mechanism handles micro-adjustments where the remaining space is too small to justify a new header or packet structure.

2. PES Header Stuffing (1 to 32+ Bytes)

When the remaining gap is larger than 7 bytes, stuffing can occur within the PES packet header. The PES header includes a PES_header_data_length field that specifies the size of optional fields and stuffing bytes. Any byte allocated here is filled with the fixed hexadecimal value 0xFF. The demultiplexer reads the designated length, processes any present timestamps (PTS/DTS), skips the 0xFF stuffing bytes, and immediately begins reading the payload.

3. Dedicated Padding Packets (Large Gaps)

When an elementary stream payload ends and leaves a large gap—or when an audio frame cannot fit into the remaining space of the current pack without splitting—multiplexers insert a complete Padding PES Packet.

The Multiplexing Calculation Process

During authoring, the multiplexer executes a continuous sizing algorithm for every pack:

  1. Calculate Fixed Overhead: The multiplexer sums the lengths of the Pack Header, any optional System Header, and the structural PES headers.
  2. Determine Payload Chunk: It slices a portion of the incoming elementary stream to fit into the remaining capacity.
  3. Evaluate Remaining Deficit: \[\text{Deficit} = 2048 - (\text{Overhead} + \text{Payload})\]
  4. Apply Stuffing Strategy:
    • If \(\text{Deficit} = 0\), the pack is written immediately.
    • If \(1 \le \text{Deficit} \le 7\), the bytes are appended to the Pack Header via pack_stuffing_length.
    • If \(\text{Deficit} \ge 8\) and payload is present, the deficit is appended inside the PES Header stuffing area.
    • If the deficit cannot fit in the PES header or no payload is available for the remainder of the pack, a 0xBE padding packet is constructed with a length equal to \(\text{Deficit} - 6\) bytes.

Decoder Handling

When a DVD player reads a 2048-byte sector, the hardware demultiplexer parses the headers sequentially. Because stuffing locations are strictly defined by length fields in the standard, the parser simply discards these bytes before routing the data to video, audio, or subpicture decoders. This ensures that the physical drive reads a deterministic stream of identical-length sectors while decoders receive variable-bitrate streams without timing or buffer interruptions.