User:Mjb/DVD

DVD format basics
Here's what I've learned:
 * VIDEO_TS folder contains everything for video DVDs. AUDIO_TS is usually empty.
 * TS means title set.
 * IFO = DVD container for various types of navigation info, including title & chapter locations; basically it has everything except the audio/video/image/graphics data.
 * VIDEO_TS.IFO = main IFO for the whole disc. Some apps can read this and go get the individual title set IFOs.
 * VTS_01_0.IFO = 1st IFO for title set 01. There can be more. Some apps have to be explicitly pointed to each one of these.
 * A title is a logical division of the content. Each title is divided into 1 or more chapters. Titles and chapters are numbered 01, 02, 03, etc., and are defined by the timecode of where they begin.
 * BUP = backup of IFO file.
 * VOB = DVD container for data. Usually there are as few VOB files as possible, max 1 GB each.
 * A VOB contains an MPEG-PS (MPEG Program Stream), which can be more flexible, but for DVDs, is a multiplexed combo of the following:
 * 1 4:3 or 16:9 video stream: Usually MPEG-2, max 9800 Kbps; 24 fps progressive or 29.97 fps interlaced 720x480, 704x480, 352x480 (NTSC, displayed @ 29.97 fps) or 720x576, 704x576, 352x576 (PAL/SECAM, 25 fps interlaced). Sometimes MPEG-1, max 1856 kbps; 352x240 (NTSC) or 352x288 (PAL/SECAM). Sometimes MPEG-4 (DivX/XviD).
 * 0-8 MPEG audio streams: Usually MP2 (48 KHz, max 384 Kbps). Sometimes MP1, MP3, or AAC. I found that MP3 & AAC aren't always supported!
 * 1 private stream, with multiplexed sub-streams:
 * 0-32 subpictures (subtitle & menu bitmap graphics)
 * 0-8 LPCM audio streams
 * 0-8 DTS audio streams
 * 0-8 SDDS audio streams
 * A VOB stream is divided into "packs", each 2 KB (one DVD sector).
 * There are 4 types: video, audio, subpicture, navigation.
 * Each contains a header and a set of packets for the relevant type of stream. The packet format is complicated.
 * The file name extension .VOB is often synonymous with .MPG or .MPEG.
 * VOB files can be concatenated.

Splitting DVDs
I often want to losslessly split custom compilation DVDs of concerts and music videos into separate VOB files for each song. The goal is to just segment the various content data streams from the original VOBs and put each segment into its own VOB, without re-encoding the stream. Lots of splitters and multipurpose editors exist, but they are not lossless; they re-encode the streams.

PgcDemux and MPEG Video Wizard are Windows apps that can do lossless splitting. PgcDemux is free but crude and unmaintained. MPEG Video Wizard is more complicated and is not free, but it is more robust and is supported.

PgcDemux
PgcDemux can be used from the command line, but the rudimentary GUI lets you poke around and see how things are split up. DVDs can be authored in different ways; the separate videos may not actually be indexed separately. Even if they are, there are different indexing methods, which can require different extraction methods. Sometimes the clips just don't line up with VID or cell boundaries. In that case, PgcDemux is useless. But if they do, it's good.


 * 1) Make sure all Options are unselected, except "Create a PGC VOB" and "One file per VID".
 * 2) In VOB id Selection, select "Titles".
 * 3) Drag and drop the VTS_01_0.IFO into PgcDemux
 * 4) Select mode "by VOB id" and see if the VOB Id Selection shows a list of VIDs (1 for each video).
 * If there's 1 VID for each video, then select mode "by PGC"; the list should show one long PGC and Cells should be the # of videos. You can then click "Process!" and you'll get one VOB file per video (you'll be prompted for where to put them).
 * If the VOB Id Selection only shows one long VID, same as the PGC, then you have to select mode "Single Cell". Now the list should show each video. When you click "Process!" you'll only get the currently selected video. The filename will be the same every time, so you have to go rename the file, select the next one, click Process, over and over.
 * There will be another problem: some videos may be split into multiple cells. It's OK, just extract all the cells and then use VOBMerge to put them back together into a single VOB file. Another option would be to load the IFO into VIDChanger, select "Fix Cell_Id" and have it write out a new set of VOBs + an IFO which can then be used in "by PGC" mode in PgcDemux.


 * PgcDemux & VIDChanger: &lt;http://download.videohelp.com/jsoto/dvdtools.htm>
 * VOBMerge: &lt;http://www.evilmaster.net/index.php?page=tools>

MPEG Video Wizard
MPEG Video Wizard is non-free software for DVD-oriented video editing.

Easy method
The main way to split is very easy: Open the DVD Reader tool, point to the VIDEO_TS folder, then select all the chapters, right-click and choose Extract to VOB. Each chapter will go into its own VOB. That's it! Obviously, this method is useless if the chapter boundaries don't match up with the video boundaries.

DIY method
If the chapter boundaries aren't where you want to split, then you need to tell it where the boundaries are. Here is the method I use:

Use the DVD Reader, point to the VIDEO_TS folder, select the title(s) you want, and click on Add To Timeline, then close the DVD Reader. In the Time Line window, there will be markers (red dots) for the chapters. Clear them by pressing "Alt"+"M" (or click the X'd-out clover/club button). You want to add your own markers. Start by pressing "M" (or click the clover/club button) to create a marker at the start of the file, to indicate this is where the first chapter begins.

You want to create a marker where each chapter is to begin, so make sure the frame you want to be the first one in the chapter is showing in the Output window. To navigate, on the ruler, drag the white triangle, and use the left and right arrow keys for frame-by-frame movement. Use the plus/minus buttons to zoom in on the timeline. There's a horizontal scrollbar at the bottom. Use "M" to toggle a marker. You can use "Ctrl"+"Tab" or "Ctrl"+"Shift"+"Tab" to navigate from marker to marker (or use buttons on the lower right). "Ctrl"+"Z" will undo. The little disk icon will save your progress in a project file. To help find the right places to edit, you can double-click the video (blue bar) in the timeline, and the preview should appear in the Input window, along with a Bookmarks window which you can close; you can play the video and navigate in the Input window to find the frames you want, then navigate in the Timeline and/or Output Window to the same frame. If you play or navigate in the Output window, it adjusts the position in the Timeline, too, so that's another option for you.

Once all the markers are in place, don't use Export ("E" or the red-circle button). Instead, click the "DVD" button to open the DVD Editor. It will have a chapter for each marker. Test by clicking on each chapter and playing (yet another way to navigate!) If anything's wrong, go back and make adjustments in the timeline. When you re-open or just click in the DVD Editor window again, the adjustments will be there. Make sure that the V and A bars at the bottom of the window are solid blue, indicating Stream Copy. If they are red, something is wrong. When you're ready, click Export, choose a destination folder, and it will write a VIDEO_TS folder there. Now you can use the DVD Reader tool to do the split, as described in the main method above.


 * MPEG Video Wizard: &lt;http://www.womble.com/>