...making Linux just a little more fun!

### To split DVD video stream according to DVD menu - how ?

Wladimir Mutel [mwg at mwg.dp.ua]
Sun, 19 Nov 2006 15:14:50 +0200

Dear people,

I have a DVD with several short films glued together into one big video-stream (and of course then split into 1GB VOBs). There is a menu on this DVD, which buttons trigger play of this stream from certain offsets (starts of separate shorts). On the ending of a short, playing continues into next one.

My problem now is how to split this DVD structure back into separate mpeg/avi files, one for each short ? I.e., first, to read starting point data out of DVD menu buttons, next, sort these points in advance order, and last, extract resulting pieces/intervals from big DVD stream.

I would prefer to solve this problem by using free software (transcode/mplayer/mencoder/mjpegtools/xine/wharever). I also would not mind writing a little program myself in C/Perl/shell if there are no existing command-line utilities to achieve this goal. And I would appreciate some initial directions from you. What is better to read and learn before I start ? I found out that DVD menu is plain MPEG2 file, but no great details about these buttons/actions. May be I should use libdvdnav ? What good examples to look into ?

Thank you in advance for your reply.

Top Back

Benjamin A. Okopnik [ben at linuxgazette.net]
Sun, 19 Nov 2006 08:55:43 -0500

On Sun, Nov 19, 2006 at 03:14:50PM +0200, Wladimir Mutel wrote:

    > 	Dear people,
    >
    > 	I have a DVD with several short films glued together into one
    > 	big video-stream (and of course then split into 1GB VOBs).
    > 	There is a menu on this DVD, which buttons trigger play of
    > 	this stream from certain offsets (starts of separate shorts).
    > 	On the ending of a short, playing continues into next one.
    >
    > 	My problem now is how to split this DVD structure back into
    > 	separate mpeg/avi files, one for each short ?

I'm not an expert on DVDs/multimedia at all, but the solution seems pretty straightforward: read up on the format in which DVD menus are stored, write a programming structure to match that format, and extract the offsets. Since you can read C, there's a project that you might want to look at - http://sourceforge.net/projects/html2dvd/ - that encodes an HTML menu to a DVD menu. Assuming that the code is actually written in a readable manner, you should be able to see the format definition in one of the header files.

The other approach would be to dig into the resources at mpeg.org - e.g., 'http://www.mpeg.org/MPEG/dvd.html'. Plenty of reference material there, including lots of off-site links to FAQs, etc.

If anyone here has more specific info on how to do the specific thing you're asking about, great. If not, I hope these general pointers will be useful.

    --
    * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *

Top Back

Karl-Heinz Herrmann [kh1 at khherrmann.de]
Sun, 19 Nov 2006 16:43:45 +0100 (MET)

Hi,

On Sun, 19 Nov 2006 15:14:50 +0200 Wladimir Mutel <mwg@mwg.dp.ua> wrote:

    > 	I have a DVD with several short films glued together into one
    > 	big video-stream (and of course then split into 1GB VOBs).
    > 	There is a menu on this DVD, which buttons trigger play of
    > 	this stream from certain offsets (starts of separate shorts).

That would be either titles (top level) or chapters (second level) structures.

If you don't care for a DVD with the same menu but just want to get every sinlge short movie into a single file mencoder (part of mplayer) can handle this easily. At the bottom of the man page are some examples including the following one:

    EXAMPLES OF MENCODER USAGE
       Encode DVD title #2, only selected chapters:
           mencoder dvd://2 -chapter 10-15 -o title2.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4

If you would prefer to keep the original mpeg2 encoding instead of recoding into mpeg4 you might want to grab transcode and have a look at tccat

    tccat  -i name [ -t magic ] [ -T title[,chapter[,angle]] ] [ -L ] [ -S n ] [ -P ] [ -a ] [ -d mode ] [ -v ]

which can extract title/chapters from the DVD stream.

K.-H.

Top Back