How Players Restore A/V Sync When Seeking VOB Files

When a media player seeks forward in a large VOB (Video Object) file, it recovers audio/video (A/V) synchronization by locating the nearest video keyframe, parsing embedded Presentation Time Stamps (PTS), discarding mismatched audio packets, and locking both streams to a central reference clock. Because VOB files are MPEG-2 Program Streams containing multiplexed elementary streams, the player must independently parse, align, and trim both audio and video data to restore a seamless presentation without introducing drift or distortion.

1. Jumping to the Nearest Keyframe (VOBU Alignment)

VOB files are divided into Video Object Units (VOBUs), each typically starting with a Navigation Pack (NAV pack) followed by an MPEG-2 Group of Pictures (GOP). Because video compression relies on temporal prediction (P-frames and B-frames), a player cannot resume video playback mid-GOP. When you seek forward:

2. Reading Timestamps: SCR, PTS, and DTS

MPEG-2 Program Streams rely on three timing indicators to manage synchronization:

Upon landing at the target VOBU, the demuxer parses the elementary stream headers to extract new PTS values for both video and audio. These timestamps dictate how far apart the two streams are relative to the target timeline.

3. Audio Packet Discarding and Flushing

Video decoding involves a variable delay because modern decoders buffer multiple frames to resolve temporal dependencies. Audio frames, typically formatted in AC-3, LPCM, or DTS within a VOB, decode instantaneously.

To prevent audio from playing ahead of the video:

  1. Buffer Flushing: The demuxer flushes existing hardware and software audio/video buffers immediately upon the seek command.
  2. Audio Pruning: The demuxer reads audio packets from the newly acquired stream but drops any packet whose PTS is earlier than the PTS of the first presentable I-frame.
  3. Pre-roll/Padding: If the audio stream starts slightly later than the video I-frame, the audio subsystem temporarily outputs silence until the audio PTS matches the current timeline.

4. Clock Master Arbitration and Resynchronization

Once both streams start outputting decoded data, the player regulates their speed using a clock synchronization method:

Through this combination of GOP-aligned seeking, PTS realignment, buffer flushing, and master clock arbitration, the player eliminates drift and restores tight A/V synchronization within a fraction of a second.