Concatenate and Convert VOB Files Using FFmpeg
This article provides a direct guide on how FFmpeg processes, concatenates, and converts multi-part DVD VOB (Video Object) files into a single, modern digital video format. It covers the underlying structure of DVD VOB segments, the most effective FFmpeg concatenation methods, solutions for common audio sync issues caused by MPEG timestamp discontinuities, and commands for lossless merging as well as conversion to formats like MP4.
Understanding Multi-Part VOB Files
DVD video data is stored in the VIDEO_TS directory as
MPEG-2 Program Streams split into segments typically sized at 1 GB
(e.g., VTS_01_1.VOB, VTS_01_2.VOB, etc.) to
comply with file system limitations. Because these files are sequential
slices of a single continuous MPEG stream, they must be combined
sequentially to preserve continuous playback, multiple audio tracks, and
subtitle streams.
Method 1: The Concat Protocol (Recommended for VOBs)
Because VOB files are raw MPEG Program Streams, they can be concatenated at the byte/stream level. FFmpeg offers a built-in protocol explicitly suited for this without requiring an external text list.
To merge and convert files using the concat protocol:
ffmpeg -i "concat:VTS_01_1.VOB|VTS_01_2.VOB|VTS_01_3.VOB" -c:v libx264 -crf 18 -c:a aac -b:a 192k output.mp4In this command:
concat:VTS_01_1.VOB|...streams the segments together sequentially as if they were a single continuous input.-c:v libx264encodes the video into H.264.-crf 18maintains high visual quality.-c:a aac -b:a 192ktranscodes the DVD audio (typically AC-3) into standard AAC audio.
Method 2: The Concat Demuxer
If there are many VOB segments, creating a text file to list the files avoids long command lines.
- Create a plain text file named
input.txt:
file 'VTS_01_1.VOB'
file 'VTS_01_2.VOB'
file 'VTS_01_3.VOB'
- Run FFmpeg using the concat demuxer:
ffmpeg -f concat -safe 0 -i input.txt -c:v libx264 -crf 18 -c:a aac output.mp4The -safe 0 flag permits the use of relative or absolute
file paths inside input.txt.
Lossless Concatenation (Stream Copy)
If conversion to a modern codec is not desired and the goal is simply to merge the VOBs into a single playable MPEG-2 file without quality loss or re-encoding time:
ffmpeg -i "concat:VTS_01_1.VOB|VTS_01_2.VOB" -c copy output.mpgThis bypasses the decoding and encoding pipeline, writing the
existing MPEG-2 video and AC-3/PCM audio tracks directly into a new
.mpg container.
Resolving Timestamp Discontinuities and Audio Desync
VOB boundaries often contain non-monotonic timestamps or Presentation Time Stamp (PTS) resets, which can cause audio and video to drift out of sync when merged.
To prevent timestamp discrepancies, append
-fflags +genpts and the aresample filter:
ffmpeg -fflags +genpts -i "concat:VTS_01_1.VOB|VTS_01_2.VOB" -af aresample=async=1 -c:v libx264 -crf 18 -c:a aac output.mp4-fflags +genptsforces FFmpeg to regenerate missing or broken presentation timestamps.-af aresample=async=1stretches or squeezes the audio dynamically to synchronize it with the video timestamps, preventing drift across segment transitions.
Handling Specific DVD Streams
VOB files frequently contain multiple audio languages or subtitle streams. By default, FFmpeg selects only one audio and one video stream. To preserve all streams during the conversion:
ffmpeg -fflags +genpts -i "concat:VTS_01_1.VOB|VTS_01_2.VOB" -map 0 -c:v libx264 -c:a aac -c:s mov_text output.mp4The -map 0 option instructs FFmpeg to include every
video, audio, and subtitle track found across the input files into the
output container.