Monday, January 13, 2014

Converting from a DVD VIDEO_TS directory

The file system on a DVD usually has a directory called VIDEO_TS whose contents looks similar to the following example:
  VIDEO_TS.BUP  VTS_01_1.VOB  VTS_02_1.VOB  VTS_04_0.IFO  VTS_05_1.VOB
  VIDEO_TS.IFO  VTS_01_2.VOB  VTS_03_0.BUP  VTS_04_1.VOB  VTS_05_2.VOB
  VTS_01_0.BUP  VTS_02_0.BUP  VTS_03_0.IFO  VTS_04_2.VOB
  VTS_01_0.IFO  VTS_02_0.IFO  VTS_03_1.VOB  VTS_05_0.BUP
  VTS_01_0.VOB  VTS_02_0.VOB  VTS_04_0.BUP  VTS_05_0.IFO
The video files have a .VOB suffix. They are simply MPEG2 files. Due to a restriction on the maximum size of a .VOB file, longer video sequences are spread over several .VOB files. In the example VTS_01_0.VOB, VTS_01_1.VOB and VTS_01_2.VOB make up a single video sequence, e.g. a film or an episode of a TV series. To find out which sequences in VIDEO_TS represent the film or an episode, it suffices to look at the sizes of the .VOB files: the longest ones correspond to the 'real thing'.
me$ ls -l *.VOB
-rw-rw-r-- 1 me me   18542592 Jan 12 23:16 VTS_01_0.VOB
-rw-rw-r-- 1 me me 1073739776 Jan 12 23:45 VTS_01_1.VOB
-rw-rw-r-- 1 me me  447463424 Jan 13 00:07 VTS_01_2.VOB
-rw-rw-r-- 1 me me   49453056 Jan 12 17:54 VTS_02_0.VOB
-rw-rw-r-- 1 me me    2201600 Jan 12 14:58 VTS_02_1.VOB
-rw-rw-r-- 1 me me    5548032 Jan 12 14:58 VTS_03_1.VOB
-rw-rw-r-- 1 me me 1073739776 Jan 12 23:52 VTS_04_1.VOB
-rw-rw-r-- 1 me me  340936704 Jan 12 23:59 VTS_04_2.VOB
-rw-rw-r-- 1 me me 1073739776 Jan 12 23:47 VTS_05_1.VOB
-rw-rw-r-- 1 me me  423309312 Jan 12 23:55 VTS_05_2.VOB
Clearly, the relevant video sequences here are VTS_01_*.VOB, VTS_04_*.VOB and VTS_05_*.VOB while VTS_02_1.VOB and VTS_03_1.VOB probably contain auxiliary video that has to do with e.g. the DVD menu.
To convert the film or episodes to the more efficient H264 mp4 format, one can use the avconv program. Since mpeg2 files can be simply concatenated and avconv can take input from a pipe, one would think that the following command would convert the VTS_01_*.VOB files to a much more compact 01.mp4.
cat VTS_01_*.VOB | avconv -i pipe: 01.mp4
Unfortunately, that does not seem to work: the resulting 01.mp4 does not contain the audio track, and I have been unable to find out why. The following works, though:
me$ cat VTS_01_*.VOB >01.VOB
me$ avconv -i 01.VOB 01.mp4
# how much space did the conversion save?
me$ ls -l 01.VOB 01.mp4
-rw-rw-r-- 1 me me  396286644 Jan 13 21:49 01.mp4
-rw-rw-r-- 1 me me 1539745792 Jan 13 21:48 01.VOB
which also shows that the .mp4 version takes only about 25% of the space of the original.

No comments:

Post a Comment