The iDVD Play All Tutorial is designed to illustrate that the DVD navigation commands are actually easy to understand once you become familiar with a few of the rather odd terms and acronyms used. iDVD is particularly good for this, because it uses a very straightforward navigation scheme.
The solution given here was authored by Ben Weinrach, and is simpler and more direct than the earlier version autored by Larry Applegate, which has been replaced with this version.
Download the iDVD project and two command files (zipped into a single folder) here.
The iDVD Project
Go ahead and open the PlayAllExample iDVD project. You will see three buttons, "Ebeneezer", "My Office", and "Play All". Go ahead and try out the DVD within iDVD. You will notice that "Ebeneezer" contains a slideshow of pictures of a strange bird that visited my property last year. "My Office" contains a few pictures take in and from my office in Coloma California a couple of years ago. "Play All" plays a single slide, since iDVD insisted that every button must have a target. We will turn this button into the real thing, later.
DVDAfterEdit edits a DVD by changing the actual files that are stored in the DVD. These files are contained in a folder always named "VIDEO_TS". To get to these files, we must start by saving a disc image from iDVD. Go ahead and do this, using the last entry from the File menu. You can use the default file name and save it to the desktop.
Once the disc image file is ready, open it by double-clicking on it. You will see a disk icon on the desktop. Go ahead and double-click on the icon. You will see two folders, named "AUDIO_TS" and "VIDEO_TS".
Create a new folder for your new DVD and name it "New DVD Folder". Copy both folders from the mounted disc image to that folder. One more step - Do a "Get Info" on New DVD Folder and, under Ownership and Permissions, choose "Apply to enclosed items...". This is because mounted disc images are always created "Read-only" by iDVD and other authoring systems, and we want to edit this DVD.
Examining the VIDEO_TS folder
In DVDAfterEdit, open the New DVD Folder. You may do this either by pointing at the folder itself, or at the VIDEO_TS folder within it. You will see the DVDAfterEdit Main Window, containing two panes. The "Video Manager (VMG) item in the left pane will be selected, and the right pane will show its contents. Click on the right-facing arrow in the right pane titled "Title Play Map". Click on the arrow in the left pane titled "Video Title Sets (VTS). If you were careful to leave the Video Manager selected in the left pane, you will see the following image:
NOT FOUND: 1
Note that Title 1 contains the video that is played when the Ebeneezer button is activated, Title 2 is My Office, and Title 3 is Play All. Each slide in the title occupies its own chapter. Each Video Title Set contains a menu section (VTSM) and a title section (VTS).
Try opening up the Preview arrow in the right pane. You will notice that the Video Manager contains the Main Menu that is played when the DVD starts up. Since we didn't create any sub-menus, the VTS menus all have "Nothing to Preview".
Each VTS contains a single TT (Title). Notice that the Titles are also called PGC's (Program Chains). Notice also that the Chapters from the right pane are called PTT's (Parts of Title), and PG's (Programs). Chapters and PTT's are synonymous. All Titles are Program Chains, and all Parts of Title are Programs. The reverse is also true in iDVD projects, but other, more sophisticated authoring programs allow Program Chains that are not Titles and Programs that are not Parts of Title. This is all very confusing at first, but as you work with it and use the Preview capability, it will become easier to understand.
Please explore the DVD. You can drill down to the Cell and Nav Pack level within the Program Chains and Programs. If we had used slide transitions, there would have been more Nav Packs in the Titles. This structure is identical in all DVD's.
Let's look at the Commands
Make sure something in the left pane is selected. Open the Project Menu. Choose "Copy All Commands as Text". Hit OK. Open a blank Text Edit window. Paste in the commands. You will see about a bit more than one page of commands. Here are all of the commands from the VMG of the DVD:
#PreCommands from "PlayAll»First Play PGC" (V2)
#PostCommands from "PlayAll»First Play PGC" (V2)
1: Jump Title Menu
#PooledCellCommands from "PlayAll»First Play PGC" (V2)
#PreCommands from "PlayAll»VMG Menus»English»VMG PGC 1" (V2)
1: Set r5 = 0
2: Set r3 = 1
3: Set r0 = 0
#PostCommands from "PlayAll»VMG Menus»English»VMG PGC 1" (V2)
1: Set r2 = 0
2: if r0 > r2 then Jump TT 1
3: Link C 2
#PooledCellCommands from "PlayAll»VMG Menus»English»VMG PGC 1" (V2)
#ButtonCommands Group 1 of 1 with 3 buttons from "PlayAll»VMG Menus»English»VMG PGC 1»PG 2»Cell 2»V1C2 NavPack 1" (V2)
1: Jump TT 1
2: Jump TT 2
3: Jump TT 3
When a DVD starts up, it always begins at the First Play. Notice that the First Play says "Jump Title Menu". Menus are also PGC's, but PGC's are not always Menus, so we weren't quite correct in our earlier description of Titles and PGC's. Go ahead and expand the arrows for the VMG, and you will see that VMG PGC 1 (the only VMG Menu PGC in this project) is designated "entry PGC yes". This means that it is the Title PGC. This also means that if the DVD viewer hits the "Title" button on the remote (some remotes use different terminology), navigation will be directed here.
The Pre-Commands for the Title Menu set registers 0, 3, and 5 to certain values. There are 16 general-purpose registers that are used to control navigation in a DVD. These are like variables in any other "program". It is completely up to the DVD Author how he or she wishes to use these registers. In the case of iDVD, it is the "Author", and it has decided how it wants to use these registers.
iDVD does not give its users access to these registers. DVD Studio Pro uses half of the registers for its own purposes and exposes the other half to its users. In our case, we made a very simple DVD and so iDVD didn't use the registers later for anything. You can verify this by glancing at the complete text file you created. You can also use text file functions such as search and replace to find out things about the commands.
Notice that the main menu had three buttons, and there are three button commands. Each of them jump to the appropriate Title for that button, Ebeneezer, My Office, or Play All.
The Post-Commands from the main (Title) menu are interesting. First it sets r2 to 0, then compares r0 to r2. The reason it didn't just compare r0 to the "constant" 0 is that the DVD navigation commands have certain limitations in their format. DVDAfterEdit allows you to type in commands directly, or you can use popups that automatically show only the valid choices for each operand of a command.
Now, what is it doing? I'm guessing that this is code designed for "One Step" DVD's that just play the DVD directly without waiting for the user to click a button. In our case, there are no commands that would ever set r0 to anything but 0, so it will never jump to TT 1 from here.
Then notice the Link C 2. When you play the main menu, when it is finished it loops, but not to the beginning which is where the buttons fly in from outside the menu when you first start up.
Here all all of the commands from the first VTS of the DVD:
#PreCommands from "PlayAll»Video Title Sets»VTS 1»VTSM 1 Menus»English»VTSM PGC 1" (V2)
#PostCommands from "PlayAll»Video Title Sets»VTS 1»VTSM 1 Menus»English»VTSM PGC 1" (V2)
1: Jump VMG PGC 1
#PooledCellCommands from "PlayAll»Video Title Sets»VTS 1»VTSM 1 Menus»English»VTSM PGC 1" (V2)
#PreCommands from "PlayAll»Video Title Sets»VTS 1»PGC 1" (V2)
#PostCommands from "PlayAll»Video Title Sets»VTS 1»PGC 1" (V2)
1: Call VMG PGC 1 resume C1
#PooledCellCommands from "PlayAll»Video Title Sets»VTS 1»PGC 1" (V2)
#ButtonCommands Group 1 of 1 with 3 buttons from "PlayAll»Video Title Sets»VTS 1»PGC 1»PG 1»Cell 1»V1C1 NavPack 1" (V2)
2: Link C 1
3: Link C 2
#ButtonCommands Group 1 of 1 with 3 buttons from "PlayAll»Video Title Sets»VTS 1»PGC 1»PG 2»Cell 2»V1C2 NavPack 1" (V2)
2: Link C 1
3: Link C 3
#ButtonCommands Group 1 of 1 with 3 buttons from "PlayAll»Video Title Sets»VTS 1»PGC 1»PG 3»Cell 3»V1C3 NavPack 1" (V2)
2: Link C 2
3: Link C 4
#ButtonCommands Group 1 of 1 with 3 buttons from "PlayAll»Video Title Sets»VTS 1»PGC 1»PG 4»Cell 4»V1C4 NavPack 1" (V2)
2: Link C 3
3: Link C 5
#ButtonCommands Group 1 of 1 with 3 buttons from "PlayAll»Video Title Sets»VTS 1»PGC 1»PG 5»Cell 5»V1C5 NavPack 1" (V2)
2: Link C 4
3: Link C 5
The English VTSM 1 is a "dummy" menu because it has no video. But it is important because it is marked "root" in the right pane. This means this is where navigation goes if you hit the "Menu" key on your remote when VTS 1 is playing. Notice that it just goes back to the Title Menu.
Now look at the Button Commands. These are the Next, Prev, and Go Up buttons that are optional during playing of slide shows. If you drill down to a Nav Pack, and look at the Button Navigation info, you will see little tiny white rectangles at the top of the navigation black rectangles. If the buttons option had been chosen, the rectangles would have been much bigger and the video would have displayed the buttons.
Using Tracer to see what is going on
Before continuing this tutorial, you can use Tracer to get a better feel for what is going on. Just Click on the "Tracer" Menu Bar item and click "Start Tracer" (Command-G). You can run the Tracer Player, set break points, step through one command at a time, etc. etc. Please see the Tracer Tutorial for more information.
Devising a strategy for modifying the commands
We can see in the command text file that only r0, r3, and r5 are "used", though even those registers are never tested for anything. But to be safe, let's assume that iDVD only uses no more than the first 8 registers, and start with r8 for our own purposes. This way, if we start modifying more complicated iDVD projects, we will never try to use one of the registers it might be relying on.
We can set r8 to zero to mean that the Play All button has not been invoked, and to the TT number that we are currently playing if it has. That way, when we finish playing a TT, we can continue with the next one. In our example, we have two buttons plus the Play All button. So the first button (Title 1) is the only case where we have a choice, after playing Title 2 we will always go back to the main menu. Title 3 was just a holding place for the Play All button and will be deleted later.
We are going to add two PGC's to the VMG, to contain the logic for what we want to do. These will be "dummy" PGC's, and will contain only commands, no video.
Select VMG Menus in the left pane. Drill down to English, and select it. Select "Add Dummy Menu" from the Edit Menu, or use Control (Right) Click to select the same function from the contextual menu. Do it again, so that you have two dummy PGC's, VMG PGC 2 and VMG PGC 3. We will add commands to them later.
Modify the commands individually
We could modify the text file and then paste it back in, but that would require quite a bit of visualization at this point. So, instead, we will work directly with the commands in-place.
Go to the Pre-Commands for VMG PGC 1 (the Title (Main) Menu). You will see:
1: Set r5 = 0
2: Set r3 = 1
3: Set r0 = 0
Add a fourth command:
4: Set r8 = 0
This will "prime" our logic for playing Titles one at a time.
Now drill down to VMG Menus, VMG PGC 1, PG 2, Cell 2. You will see 56 Nav Packs. Click on the first one. Drill down to the button commands if necessary. You will see the following:
1: Jump TT 1
2: Jump TT 2
3: Jump TT 3
Change line 3 (the third one) to:
3: Link PGC 2
Click on the Button Commands line under which the command now shows, and select "Copy Button Commands" from the Edit Menu (command-C).
Now click in the left pane on the Cell under which the Nav packs appeared. (Cell 2). Select "Paste Button Commands Deeply Into" from the Edit Menu (command-V). Now you will notice that all of the Nav Packs for that Cell have turned red, which means they were changed.
In the DVD spec each individual Nav Pack can have different commands! But usually, when a motion menu is playing, you want the same thing to happen throughout the playing of the motion menu. To save processing time in the player, the Nav Packs have a Highlight status flag which can say "All new info", "Use Prev VOBU", etc. This way the player can avoid recomputing things that are the same on lots of Nav Packs in a row. So DVDAfterEdit must go to a bit of trouble to maintain these flags correctly when you cut and paste into Nav Packs. The "Paste Button Commands Deeply Into" function makes it easier to do this.
Now click on the VMG PGC 2 (the one we just linked to) in the left pane. Select Pre-Commands in the right pane. Use the Edit Menu (or Command K) to add two command lines. They will contain Nop's. Change them to the following:
1: Set r8 = 1
2: Jump TT 1
This will prime the logic to play both of the Titles, and start playing the first one.
Click on VMG PGC 3 in the left pane. Insert the following three Pre-Commands:
1: if r8 == 1 then GoTo Line 3
2: Link PGC 1
3: Jump TT 2
This will decide whether or not we are doing a play all, and if so, go to the second title, and if not, go to the Title Menu.
Select VTS 1 PGC 1 in the left pane. You will see:
1: Call VMG PGC 1 resume C1
Change it to:
1: Call VMG PGC 3 resume C1
This will go to the logic we added above to decide where to go after playing the first Title. We can't put that logic here, because it is not possible to jump directly from one VTS to another, and the other Title is in VTS 2.
Now do a Save, and play the DVD with Tracer or the Apple Player. The Play All button will now work.
One more Thing
You may have noticed that VTS 3 is no referenced any more, because it was a single slideshow frame that was put there to satisfy the error checking of iDVD. So now you may delete it. Just select VTS 3 in the left pane, hit the delete key, and hit OK.
If you encounter difficulties
Since DVDAfterEdit has the capability of copying all the commands in a DVD to a text file, we have done so and provided you with the completed DVD's text file. Just select anything in the left pane, go to the Project Menu and select "Delete all Commands in Project", Open the text file "All Commands After", Select All, Copy, and then select "Paste Commands from Text" in the Project Menu. Save, and the project is done.
Burning the DVD
Since we have changed the DVD, we can't burn it with iDVD, since it would insist on rebuilding the commands according to how it thinks the DVD should work. So we must use Toast, or another burning program. Unfortunately, the Finder does not know how to create a proper DVD with its UDF directory.
-Larry Applegate & Ben Weinrach