How HandBrake Processes VOB to MP4 or MKV
This article explains the technical pipeline HandBrake uses to transform raw DVD VOB (Video Object) files into space-efficient, modern MP4 or MKV containers. Converting these legacy files involves parsing complex container structures, demultiplexing interleaved streams, decoding MPEG-2 video and legacy audio, applying video filters like deinterlacing, and re-encoding the data using high-efficiency modern codecs before final packaging.
1. Ingestion and Stream Demultiplexing
VOB files are based on the MPEG-2 Program Stream format, multiplexing
video, audio, navigation menus, and subtitle streams into a single file.
When a user loads a VOB file or a DVD folder (VIDEO_TS) into HandBrake,
the software utilizes libavformat (from the FFmpeg library)
to inspect the container. HandBrake reads the timestamps and stream
headers to separate (demux) the interleaved data into isolated
elementary streams:
- An MPEG-2 video stream.
- One or more audio tracks (typically AC-3, DTS, or LPCM).
- Subpicture streams containing bitmap-based DVD subtitles (VobSub).
If an entire DVD structure is provided, HandBrake references the
accompanying .IFO files to stitch split VOB files together
seamlessly, ensuring continuous playback without audio-video
desynchronization.
2. Decoding the Legacy Content
Once demuxed, the elementary streams are sent to software decoders:
- Video: The MPEG-2 bitstream is decoded into uncompressed raw video frames, usually in the YUV 4:2:0 planar pixel format.
- Audio: Formats like Dolby Digital (AC-3) are decoded into uncompressed PCM (Pulse Code Modulation) audio samples.
- Subtitles: The bitmap overlays are held in memory for processing, either to be burned directly into the image or converted into a compatible modern subtitle track.
3. Video Filtering and Pre-Processing
DVD video stored in VOB files frequently suffers from interlacing artifacts, incorrect aspect ratios, and black borders. HandBrake routes the raw, uncompressed frames through a pipeline of user-defined filters:
- Decomb and Deinterlacing: Converts interlaced frames (common in standard-definition TV broadcasts and DVDs) into progressive frames, eliminating comb-like edge artifacts. HandBrake’s "Decomb" filter dynamically checks for motion to avoid softening static areas.
- Cropping: Automatically detects and removes black bars (letterboxing or pillarboxing) to save encoding bits.
- Scaling and Anamorphic Adjustment: Corrects the non-square pixels native to DVDs (such as 720x480 for NTSC or 720x576 for PAL) to ensure the proper display aspect ratio (4:3 or 16:9) on modern progressive screens.
4. Re-encoding (Compression)
After processing, the uncompressed data is passed to target encoders:
- Video Encoding: The raw frames are processed by
modern video encoders such as
x264(H.264/AVC),x265(H.265/HEVC), or SVT-AV1. The encoder analyzes spatial and temporal redundancies across frames (using I, P, and B frames) to drastically reduce the file size while preserving visual quality based on the selected Constant Rate Factor (CRF) or bitrate. - Audio Encoding: Uncompressed PCM audio is typically encoded into AAC, Opus, or MP3 for broad compatibility and smaller size. Alternatively, HandBrake can perform an "audio passthrough," copying the original AC-3 or DTS stream directly without re-encoding to preserve bit-for-bit fidelity.
5. Final Multiplexing (Muxing)
The final stage is packaging the new elementary streams into the user's chosen modern container—either MP4 or MKV:
- MP4: HandBrake interleaves the H.264/H.265 video,
AAC audio, and compatible timed-text subtitles. It writes the
moovatom (metadata index), optionally placing it at the beginning of the file (via the "Web Optimized" setting) for faster playback over networks. - MKV: The Matroska container accepts a wider range of codecs and formats without strict limitations, easily accommodating variable frame rates, multiple audio formats, and bitmap DVD subtitle tracks without requiring them to be permanently burned into the video.
Once muxing is complete, the resulting file is a modern, standalone media file that is significantly smaller than the original VOB and compatible with contemporary hardware and media players.