How DGIndex Creates D2V Index Files from VOBs

DGIndex processes MPEG-2 video streams across contiguous VOB files to produce a lightweight, plain-text index file with the .d2v extension. Rather than demuxing or re-encoding the entire video track, DGIndex scans the underlying MPEG structure, catalogs keyframe locations, and records critical frame-level metadata. This resulting index allows frameservers like AviSynth to access any frame with frame-accurate precision during editing workflows without creating massive intermediate files.

1. Parsing the MPEG-2 Program Stream

When a sequence of VOB files is loaded, DGIndex treats them as a single continuous byte stream. It parses the MPEG-2 Program Stream, filtering out audio tracks, sub-pictures, and private streams to focus on the video elementary stream (PES packets). It searches specifically for standard MPEG-2 start codes, including:

2. Recording Byte Offsets

Direct random access in MPEG-2 video is difficult because P-frames and B-frames rely on reference frames for decoding. DGIndex solves this by cataloging the exact byte offsets of every I-frame (keyframe) across the VOB files.

For every GOP encountered, DGIndex logs the file number in the sequence and the hexadecimal byte position where the GOP begins. If an editor requests a frame in the middle of a VOB sequence, the decoding filter uses these offsets to jump immediately to the nearest preceding I-frame, decode forward, and serve the requested frame instantly.

3. Cataloging Picture Flags and Telecine Information

A critical role of DGIndex is logging temporal and display flags embedded in the MPEG-2 Picture Coding Extension headers. For every frame, DGIndex extracts:

DGIndex encodes these attributes as hexadecimal matrix entries within the .d2v file. This data informs video editors whether the source is truly interlaced, progressive, or telecined, allowing for automated inverse telecine (IVTC) without frame-matching errors.

4. Writing the .D2V Output

Once the scan is complete, DGIndex writes the collected metadata into the .d2v text file. The file is structured into several distinct parts:

5. Utilization in the Editing Pipeline

The finished .d2v file does not contain actual video data; it serves entirely as an external address book. When an AviSynth script calls MPEG2Source("video.d2v"), the decoder plugin reads the .d2v file, references the original VOBs on disk, reconstructs frames accurately via the logged byte offsets and flags, and serves uncompressed video frames directly to editing software.