DVDAfterEdit Articles and Tutorials

Articles to help you use all the features of DVDAfterEdit.

Add a Play All Button to iDVD

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:

[inline:1=Initial Main Window]

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)
1: Nop
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)
1: Nop
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)
1: Nop
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)
1: Nop
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)
1: Nop
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

Adding DTS Audio to your DVD using the Replace VTS Function

by Ian Shepherd

Requires DVDAfterEdit Standard

Part 1: Introduction and Preparing the Project

This article was written before DTS support was added to DVD Studio Pro. However the "Replace VTS" function is one of 'Edit's most powerful features, also allowing us to modify subtitle streams in exisiting features or remove or change sections of video, for example. The procedure outlined here applies to all these scenarios. It can also be used with the output of ANY authoring application, not just DVDSP. To jump directly to the section on using the Replace VTS function straight away, please click here, however many people may still find much of the discussion in sections 1 and 2 helpful.

Introduction

DTS audio is one of the DVD format's super-high-end features that simply hasn't been available to DVD authors like us at a realistic price - until DVDAfterEdit came along. This article describes how to use the "Replace VTS" function to incorporate DTS audio into your existing project, in a suprisingly straightforward way.

Using the technique to achieve DTS support is quite an advanced use of the Replace VTS function, but it can also be put to other, more straightforward purposes - you could use it to replace a copyright logo on a disc one of your customers has licensed, for example. Something that previously would have required days of ripping and re-authoring can now be accomplished in a matter of minutes !

I sometimes choose to use this method for adding DTS to DVDs even though we now have a Creator system, because it's just so much faster to put many types of new projects together in DVD Studio Pro.

[inline:1=center,combining projects]

Something which should be made clear from the outset is that to use DTS audio, you will need a DTS encoder, like the one made by Minnetonka Audio (http://www.surcode.com/low/dvdDts/dvdDts.htm) as well as DVDAfterEdit and your normal authoring software . You will also need a way of multiplexing (building) the DTS audio stream, along with your video, into a DVD file structure (VOB file). Before I persuaded SRT to invest in the Sonic system, we had this encoding and multiplexing done for us by another authoring company who already offered DTS. I'll cover this in detail in the article, but for now it's important to realise that (unusually !) at the moment DVDAfterEdit can't offer a complete solution. In the future, though, who knows...

The technique described here has been tested on DVD projects authored using DVD Studio Pro versions 1.5.2 and 2.0, and can be adapted to work with any other system too.

Overview of the method

These are the steps we are going to work through:

  1. Author your project as normal, so you can set-up and test Audio Select menus and/or audio-related scripting. Restrict the data-rate and total size of your video stream to allow "space" for the extra DTS track, by using an extra PCM audio stream as a "place-holder" in your project
  2. Build and test the project
  3. Encode your DTS Audio stream
  4. Use a suitable authoring package to multiplex your DTS audio with your other video, audio and subpicture assets into a VOB file.
  5. Use DVDAfterEdit's "Replace VTS" function to replace the original VOB file in it's entirety with the new one containing the DTS audio, but nevertheless retaining all the navigation commands from your original project.

Before we get into the details though, a little background may be useful.

What is DTS Audio?

[inline:2=right,DTS Audio]DTS is an audio compression codec developed by the company Digital Theatre Systems, and does the same job as Dolby Digital (AC-3) - offering high-quality surround-sound in cinemas and on DVDs. It is becoming more and more popular on DVD releases, especially music titles. It has various Pros and Cons:

Pros

Some people feel it sounds better than AC-3 (Dolby Digital)

Offers "added value" to titles which include it

Ensures the audio is heard exactly as it was intended, since unlike AC-3, it has no "dialnorm" feature, and players have no automatic level control. People often have these selected unknowingly, or they may be enabled by default on some players.

Cons

Not all players or surround amps support DTS.

At it's highest quality, It uses a data rate nearly 3 times as high as 5.1 Dolby Digital, so it takes up 3 times as much space, and you have to adjust your bit-budgets and maximum data rates accordingly.

Even if users' equipment supports DTS, they have to know that the DTS is there, understand why they might prefer it, and choose to enable it. Some discs have an auto-detect feature, but not all players support this.

There are debates raging in Pro Audio circles about whether DTS really does sound better or not, and whether the Pros outweigh the cons, but meanwhile more and more of our customers are asking for it, and the customer is always right!

So, lets look at each of the stages more closely.

The Method In Detail

1. Author your project with a dummy "placeholder" audio stream.

We are lucky that the DVD spec commands which control navigation and interactivity only refer to "Audio Streams", without specifying what format they are in. A familiar example showing why this is useful is that we can safely author a project (which will eventually have surround-sound) using two stereo audio streams - one as a dummy placeholder - while we wait for the surround mix to be completed. We then replace the second stereo stream with the 5.1 stream at the very last moment. All our "set stream" commands will still work, even though we've changed the contents of the stream.

Similarly, because the method described here preserves all the existing pre- and post- commands from your chosen authoring package (scripting, in Abstraction Layer terms), we can safely add an extra audio stream of any format to our project while authoring, pretending to ourselves that it is a DTS stream, and build all the control we would like for it into our project. Then at the end of the process when we exchange our original VTS for one which really does contain DTS, everything will carry on working just as we intend.

The illustration below shows an example "track" (title) in DVD Studio Pro, where the third stream is the dummy placeholder audio track.

[inline:3=center,dummy placeholder audio track]

Notice that the track has a pre-script which sets the audio stream to the value of the variable ChosenAudioStream. Elsewhere in the project there is a menu where this value is set depending on the choices made by the user. Using our method here, all this interactivity will be preserved after this track has been replaced by one containing DTS audio !

We do have to be careful about one point though - maximum data rate and bit-budgeting. The DVD spec specifies that any playback stream (video, audio & sub-pictures) should not exceed a maximum rate of 10.08 Mbps. So in a typical single-language feature film with stereo and surround sound-tracks, this means our video data-rate can peak at a maximum of 9.4 Mbps:

[inline:4=center,data-rate peak max 9.4]

Whereas with an extra DTS stream at it's highest-quality, this is significantly reduced:

[inline:5=center,reduced data-rate peak]

So we need to adjust the parameters of the video stream when we encode, and ensure that our encoder actually complies with them ! This is especially important if you will be getting the DTS encoded and multplexed by another facility, since the last thing you want is to send all your assets away and be told the data rate is too high.

We also need to take care that there is enough space for all the assets on our disc. High-quality DTS files take up over 3 times as much space as 5.1 AC-3, because they have a data rate 3 times higher.

A great tip to avoid mistakes is to use a stereo PCM (AIFF or WAV) file as the "dummy" or placeholder track when authoring. This has the same data rate and size as a high-quality DTS stream, so if your project has enough space for this file, it will have enough space for the final DTS stream.

2. Build And Test The Project

Write your project to hard drive, as though you were going to write a DVD-R or DLT. This will create a VIDEO_TS folder, a duplicate of the file system which will eventually end up on the finished disc, and which we will later open with DVDAfterEdit to swap the DTS audio into. As usual, test everything about this project fully, especially audio behaviour and scripting - bearing in mind of course that we have a "dummy" PCM stream instead of the eventual DTS stream.

Now move on to Part 2

Adding DTS Audio to your DVD using the Replace VTS Function (Part 2)

by Ian Shepherd

Requires DVDAfterEdit Standard

Part 2: Encoding DTS & Multiplexing the New VTS

3. Encode the DTS audio tracks

As I mentioned in the introduction, you will either need to own a utility like Surcode DTS-DVD, or ask someone else to do the encoding for you. If you decide to go the later route, it's probably best to find someone who uses a software encoder, mainly to keep sync issues straightforward. Remember you won't be able to trim or add frames to a DTS audio stream in your authoring application as you might with AC-3 or PCM. If the facility you choose do use a hardware encoder, you will have to supply the mix on multitrack digital tape, with timecode and in/out points.

[inline:3=right,DTS Encoder]If you go the software route, just as with A-Pack you need to verify the sync of the audio - the easiest way is probably to load the main left and right tracks up in a video editor like Premiere or Final Cut and verify that when the start points are lined up, it sounds & looks right.

I'll give a brief example of encoding using SurCode DTS_DVD - if you choose to do it yourself it is very straightforward - similar to encoding with A-Pack or a similar utlilty, but with fewer parameters to set. If you are using an external facility, you will still find it useful to understand the following, to help explain to the people who are doing the work for you exactly what it is that you want.

Incidentally, wherever possible I would suggest finding a facility who can both encode and multiplex the DTS audio for you - somewhere like this is more likely to have a full understanding of everything that's involved with the process, so you'll have less supervising to do, and there's less possibiity for mistakes.

You should have five or six 48 kHz WAV or AIFF files for the 6 channels of your surround-sound mix. DTS supports fewer tracks as well, but is most commonly used for surround-sound. If the encoder supports it, you will get slightly better quality encodes if the files you use are 24-bit rather than 16-bit. Wherever possible I would suggest you have the files encoded at 1.536 Mbps, rather than the lower 768 kbps data rate, since in my opinion it's barely worth the extra effort and expense of DTS unless you use it's highest quality setting. On the other hand, if the bit-budget is tight, and your customers insist...!

[inline:2=left,name Destination file]Once you have loaded your source files into the right "slots" as shown above, you need to name the Destination file, and choose a location for it.

At this point you will also need to choose the format of the DTS file you are going to create. There are three choices in Surcode - DTS Padded (*.dts), DTS Compact (*.cpt), and DTS WAV (*.wav). You'll need to choose the right one for the authoring application which is going to be used to multiplex (combine)the video & audio streams. For Sonic DVD Creator, the right one is the DTS Compact (*.cpt)format.

Finally we simply need to select the encoding options, and hit "Encode". The only option we haven't already discussed is the "Attenuate Rear Channels 3dB" setting. As with Dolby Digital, this is here because for playback in cinemas, the rear channels are normally attenuated (reduced in level)by 3 dB. (Surround audio is often quieter, so can be encoded louder and turned down on playback, giving theoretically better quality.)So when mixing for film, cinema people mix the rear channels 3 dB louder to compensate. However a Home Cinema setup doesn't reduce the level of the rears, so if your material has come from a cinema, you should tick this box or the rear channels will sound 3 dB too loud. If you aren't sure whether to use this option or not, check with the people who supplied the audio to you. If they don't know, a quick test encode with an AC-3 file and a correctly setup 5.1 system should shine some light.

[inline:5=right,DTS Encode Options]That's it - one way or another, you (or the facility you are using)should now have an encoded DTS file ready to be multiplexed along with any other audio and possibly sub-picture streams (Subtitles, button highlights)that you need.

I'll cover the requirements for this in a moment, but for now let's pause for a moment to look in a little more detail at what a VTS actually is.

Background - What is a VTS ?

When working with many of the popular authoring packages, the major video assets in a DVD project are commonly referred to as "Titles", "Tracks", or "Movies". The video for these is stored in large Video Object (VOB)files on the disc.

[inline:1=right,VTS structure]Information about each VOB file is contained in a corresponding information (IFO)file, and the DVD player reads this file and uses it as a set of instructions telling it how to play back the video contained in the VOB file.

A VOB file can contain the video for only one title or several. So for example, one VOB might contain all the video for the disc - say with the main feature first followed by a bonus feature - in which case the IFO file will describe two different playback sequences or titles. The first title instructs the player to play the section of the VOB relating to the main feature, the second describes the playing sequence for the bonus feature. The titles are each defined by a Program Chain (PGC), which is simply a description of what sequences of video the player should play, and in which order.

The title PGCs are grouped together in Video Title Sets - the point being that all the titles in a particular set use video from the same VOB. (This means they must all have the same aspect ratio and audio/subpicture streams, by the way)Simpler DVDs only allow the video in the VOB to be played back in one particular order, and so only have one title per VTS - ie. a "set" of one !

As you can see in the illustration above, the VOB files are therefore labelled with names like

* VTS_01_1.VOB - the VOB containing the video used by VTS 01 - and
VTS_01_1.IFO - the instruction file describing the Title PGCs for that VTS

So to summarise - a Video Title Set (VTS)is a complete description of the ways in which a particular DVD can play back the video contained in it's corresponding VOB file. It can contain one title PGC, or several. If we want to replace the video in a VOB file with a new version containing DTS audio, for example, then by necessity we need to replace the entire VTS.

As it turns out, if we aren't using authoring features like "stories" or "playlists", many authoring packages only create one title per VTS, which makes replacing the VTS using TFDVDEdit very straightforward, as we shall see. If your project has a more complicated VTS structure though, with multiple PGCs, you can use TFDVDEdit to recreate that VTS PGC structure using it's amazing Title List Editor - but that's a whole different article...!

4. Preparing the DTS VTS - Multiplexing to create a new VOB & IFO file

Let's remind ourselves where we're up to - at this stage we have an an encoded DTS file, and our project's VIDEO_TS folder on a hard drive. One of the VOB files in the folder holds the multiplexed video stream containing the video we want to add a DTS soundtrack to, currently with a "placeholder" PCM audio stream. We now want to create a new VTS, containing the DTS audio stream, to replace the existing one with. This means generating a new VOB file and IFO file, for which we need an authoring package which supports DTS. Currently this means Sonic Scenarist, DVD Creator / DVD Fusion (with the Advanced Authoring Pack), or Spruce Maestro.

I will outline the process to create a suitable VIDEO_TS using DVD Creator here, hopefully giving you enough of an insight to effectively communicate what you need to the facility who do this for you to deliver.

All that's needed is to create a project containing a single Title Set structured in exactly the same way as your original Track or Movie - ie. with the same layout of audio and subpicture streams except that it will include a DTS stream.

You will need to supply the following, either on DVD-R or a firewire hard-drive :

  • The MPEG-2 (m2v, mpeg)video file
  • Any non-DTS audio
  • Either the encoded DTS file or the raw 5.1 streams if you need them to encode it too
  • Any subpicture elements for the VTS - subtitles, button highlights etc.
  • An I-frame-accurate list of chapter points

The assets will need to be imported into the DTS authoring application. Creator and Scenarist call everything by their "proper" names (VTS, PGC etc), which makes things a little simpler when talking to authors about your requirements. By default every new project contains an empty VTS, so all that's necessary is to double-click on it to open it up and drag the MPEG-2 video into it. Then the audio must also be dragged across, and assigned in the same way as it was in your original project. So, in my example Stream 1 is stereo AC-3, Stream 2 is 5.1 AC-3. Stream 3 was the dummy PCM stream in my original project so here it contains the DTS stream. This ensures that all the interactive control of our original project will work exactly as expected.

[inline:4=center,interactive control]

Make sure the attributes of the audio and video streams are set correctly - the video aspect ratio, and the language settings of the audio streams, for example. These can be adjusted later in TFDVDEdit, but it's better to get them right from the start. Any subtitles and button highlights must be correctly setup at this stage.

It's also best for all the chapters to be added in the DTS application as well. Again, this can be done "after the fact" in TFDVDEdit, but my personal preference is for the imported DTS VTS to be "plug in and go". The illustration above shows a project with one VTS, containing the video and audio streams, including the DTS stream. Also shown are the settings for one of the chapters - if you've been using 'Edit for a while you'll recognise many of the properties - the chapter is a Part Of Title (PTT)Program, with seamless playback enabled.

Finally the project needs to be built to the hard drive, so you'll end up with a second VIDEO_TS folder, containing just one VTS VOB file and IFO file. This is then ready to be "Replaced Into" the original project, over the top of the VTS with the dummy PCM stream. If someone else is doing this for you, ask them to send the new VIDEO_TS folder with the DTS VOB back to you on DVD-R or a firewire hard drive.

Finally, bear in mind that the above creates the very common and straightforward VTS structure of only one Title PGC per VTS. If you or your authoring application have created more complex VTS PGC structures in your project, you will have to recreate these using TFDVDEdit's Title List Editor, which will be covered in another article.

Now move on to Part 3

Adding DTS Audio to your DVD using the Replace VTS Function (Part 3)

by Ian Shepherd

Requires DVDAfterEdit Standard

5. Replacing your DTS VOB into the final VIDEO_TS folder

So, (finally!) we get to the action in TFDVDEdit. Open up the build file of your project from Stage 2. TFDVDEdit displays a representation of the information contained in the information (IFO) files of the DVD. You can see the Video Title Sets of your project by unfolding the arrow of the VTS node, in the Left Pane. Using the Preview Window in the Right Pane, find the VTS you would like to Replace, unfold it's node arrow, and select the Title PGC (PGC_TT) node:

[inline:3=center,Video Title Sets]

The Right Pane is displaying all kinds of information about the VTS, but for the time being let's concentrate on the Pre-Commands. Unfold the arrow as shown above if you can't see them. These commands control the detailed navigation of the disc. Pre-Commands are executed before the video in the PGC is played, and Post-Commands are executed after it has been displayed. If you're a DVD Studio Pro user and have written "scripts" to control navigation or the selection of audio streams, for example, your commands will be here - although they may be difficult to find or recognise!

Don't worry - we don't need to understand these commands at all for this process - we just need to make sure we don't loose them when we Replace our VTS. We do that by making sure that the VTS TT_PGC node is selected as in the illustration above, and choosing "Copy PGC Commands" from the Edit menu. So all those commands are copied into the Paste Buffer, and will stay there until we've replaced the VTS with our new one containing the DTS audio stream. Then when the Replace function has finished, we can just paste them back in again.

[inline:2=right,Replace Video Title Set]Try it, making sure the Project you're working on has been backed up first. Select the VTS node instead of the PGC_TT node, control-click on it and select "Replace VTS":

You'll get a requester like the one shown below. Browse your way to the VIDEO_TS folder of the project which contains your DTS VOB file, and select the VTS_01_1.VOB:

[inline:1=center,select the VTS_01_1.VOB]

As you can see, TFDVDEdit offers you the chance to Import any commands or menus associated with the VTS VOB you have chosen, but since we are taking the VTS from a project which has nothing to do with this one, we don't either of these options, so un-check both boxes, and click "Choose". This won't take too long, but for a larger VTS it will be some minutes. The program shows you a progress indicator.

[inline:4=center,progress indicator]

Once the VTS has finished importing, select it's node arrow and unfold the arrow in the Right Pane to look at the audio stream properties:

[inline:5=center,access audio stream properties]

Bingo! We have a DTS audio stream. We're not quite finished yet, though - if you unfold the VTS node arrow again and select the Title PGC again, you'll see that as expected, the VTS has no Pre or Post Commands - we chose not to import them, remember.

[inline:6=center,no Pre or Post Commands ]

So now we simply have to select "Paste PGC Commands" from the Edit menu (while the title PGC is still selected), and the commands we copied to the Paste Buffer before starting the Replace VTS function will slot straight in. The navigation and/or scripting for the DVD will now behave exactly as it did originally, but with a DTS audio stream where the dummy PCM track was. All we need to do now is Save the project and we're done!

Summary

To recap, here is this final stage in outline:

  1. Open the project in TFDVDEdit and find the VTS you want to Replace with the DTS VOB
  2. Copy the PGC Commands of the current VTS Title PGC
  3. Replace the VTS, choosing not to import it's commands or menus
  4. Paste the old commands into the Title PGC of the new VTS
  5. Save

At this stage it's also worth using TFDVDEdit to check all the other properties of the new VOB - aspect ratio, subtitle & audio streams and their languages and so on, just to make sure that everything is as it should be.

If your original VTS had a more complicated structure than just one title PGC, you would copy the commands from the whole project rather than just the Title PGC, and use TFDVDEdit's Title List editor to create the correct VTS PGC structure before pasting those commands back in. This is also quite straightforward, but will be covered in another article.

Conclusion

Hopefully you can now see that TFDVDEdit's Replace VTS function is both extremely powerful and extremely easy to use. As I mentioned in the introduction, any VTS can be replaced, not just ones you want to use DTS in. So you could insert a new Corporate Logo clip, for example, or a VTS with animated subpictures (overlays), or one with complicated subtitle requirements - in fact, any feature not currently supported by your authoring application can be added, allowing you to keep creative control of the rest of the project, and pass the savings in time and efficiency on to your customers rather than letting the work go elsewhere. I'm sure someone out there will come up with some truly innovative uses for this function, and I look forward to seeing them!

Adding ISRC Codes To DVD Projects

by Ian Shepherd

Introduction

One of DVDAfterEdit's many high-end features is the ability to stripe music video DVDs with ISRC codes. This feature has previously only been available on the most expensive authoring systems available. It will be invaluable to you if you are dealing with music video product - a "must-have" feature that none of your competitors will be able to offer! The process is swift & straightforward, and this article aims to tell you everything you need to know. You may also like to check out the Guided Tour article before reading this, for a more general overview of the program.

What are ISRC codes?

ISRC stands for International Standard Recording Code. They were originally developed for Audio CDs, to help keep track of digital recordings, and in particular for administrative purposes. Each sound recording or music video can have its own unique ISRC which enables it to be identified internationally throughout its life. The code is embedded in the sub-code information of the CD or DVD, and specialised hardware can read this information and make use of it as necessary. One great example is performance rights - if a piece of music is broadcast on the radio or TV, for example, the owners of the copyright and publishing rights are entitled to a fee. Keeping track of exactly what is broadcast, where and when, is a huge administrative achievement, and ISRC codes allow this process to be automated.

The codes also act as a fairly primitive form of copy prevention - although compared to more sophisticated digital "watermarking" systems they are relatively easy to remove, nevertheless if someone simply copies a CD or DVD in it's entirety, then the ISRC code is copied as well, and this offers rights holder the chance to prove that their material has been stolen. Since they are part of the subcode, they also have the added advantage of not affecting the audio in any way.

Finally, the codes provide a quick and easy way of keeping track of the details of a particular recording. Where different versions or edits of a recording or music video exist, they can be given different codes, so that instead of relying on the timing information to distinguish between them for example, we can just read the codes from the disc.

For all these reasons ISRC coding has become more and more widespread on CD releases, and will almost certainly do the same on DVD, especially once we all start offering the service to our customers!

All of the above is obviously particularly important in a digital environment where music is being increasingly disseminated in electronic form and the record industry is faced with the challenge of monitoring and collecting payment for the use of its copyrights.

The Code itself will be in the following format:

[inline:102_isrc_format.jpg=center, ISRC format]

Registering To Use ISRC Codes

In order to use ISRC codes, your customers will need to register with the appropriate organisation in their territory. So, for example, in the US, you need to contact the IFPI,

http://www.ifpi.org/isrc/

wheras in the UK the PPL handle codes for audio recordings (http://www.ppluk.com/) and the VPL handle music videos:

http://www.musicmall.co.uk/vpl/vpl_content.nsf/contentview/p1?opendocument

Once a member of the appropriate organisation, they will be supplied with all the information needed to use ISRCs. Remember though that the registration and use of ISRCs is the job of the copyright-holders of the audio & music, not the DVD author. If you were to register for the codes, you could end up illegally collecting all their royalties!

Adding ISRC Codes In DVDAfterEdit

This process is straightforward. First we need to find the right video. You'll probably have been given a separate ISRC for each song, if it's a music product, and so it's best if you give each song it's own chapter.

Open up your project, and use the Preview window to find the VTS containing your music video, and unfold the arrows down to the nav-pack level. Still in the left pane, select the first nav-pack in the VTS PGC's PTT Cell that you want to add the code to:

[inline:102_select_navpack.jpg=center,select the nav-pack]

There's a data field in the selected Nav Packs Right Pane info simply called "International Standard Recording Code"; click to the right of it, and an input field will appear. Paste the ISRC code into it, and hit return to make it stick.

[inline:102_paste_isrc_code.jpg=center,paste in ISRC code]

That's added the ISRC to the first I-frame of the cell. So, make sure the data field you just pasted the code into is still selected, and hit Control + C to copy the code to the clip board. Now we need to paste that code to all the other I-frames in the song, so that the ISRC is present all the way through.

If your DVD has one song per chapter or cell, this is easy - simply select the cell or PG and press Apple-V ( or Edit > Paste ISRC Codes deeply into ) and move on to the next song.

If your DVD doesn't have separate chapters for different songs, you'll have to use the preview window to find the first and last nav-pack of each song.

[inline:102_paste_code_all_navpacks.jpg=left,paste code into all nav-packs]

Then select the next nav-pack, and shift-select all the rest of the nav packs in the song.

So now all the nav packs are selected in the song. Hit Control + V to paste the code into all the selected nav packs, or if you prefer you can also use the edit menu - it will say "Paste ISRC Codes Repeated" .

Finally click on a nav pack or two to verify your that your paste has "taken". Save. Repeat for all the Title PGC nav packs that need the code and Save again. Job done!

Conclusion

Because this feature has been relatively obscure up until now, not many of the smaller DVD productions out there will have ISRCs at the moment. But copyright protection and Rights Management are two of the hottest topics in the music industry right now, so if you market this great feature well, it could be the key selling-point that swings you some great DVD deals in the near future.

Advanced Techniques - Manipulating Menus

by Ian Shepherd

Requires DVDAfterEdit Standard

How to Replace, Add, Remove & Edit Menus With DVDAfterEdit

[inline:103_replace_menu_vob.jpg=center,Replace Menu VoB]

Introduction

This article describes one of the more advanced techniques possible using DVDAfterEdit - replacing menus in existing DVDs, retaining all the original navigation, without access to the original assets. Initially we'll assume you want to keep the number of menus and buttons the same as the original, but in the final section, "Extending the Technique", I'll show how you can add, remove and edit menus, including the number of buttons on them.

Because DVDAfterEdit can currently only replace a whole menu VOB file, and each file usually contains several menus, the process is somewhat more complicated than simply replacing a VTS, say. It has several stages:

  1. Copy the original project to a new location ready for editing
  2. Extract ("rip") the original material (video, button highlights etc) from the existing VIDEO_TS folder
  3. Modify the extracted material to incorporate the changes you need
  4. Create a new VOB file (with the modified assets) using your authoring application, and build it to a temporary folder.
  5. Use the "Replace Menu VOB" function to overwrite the original menu VOB file with the new one
  6. Re-create the required PGC structure in your modified project
  7. Copy and paste all the original commands and navigation back in to the new project and "tidy up" any loose ends.

This may look a little daunting, but actually it's quite straightforward when you get the hang of it. This article will have less detail about basic navigation of DVDAfterEdit's interface than some of the others, so if you find there are things you aren't clear on, it might be better to check out some of the others first. I mention several useful utilities during this article - all are easily found using Google.

Menu VOB Structure Overview

Before looking at the details of the method, it's important to understand a little about the structure of menu VOB files, how they are displayed in DVDAfterEdit, and even more importantly how they can be modified using 'Edit's amazing Program Map.

All the visual material in a DVD menu (even static menus) is stored as MPEG, and is contained in Video Object or "VOB" files on the disc. The VMG menus are contained in the VIDEO_TS.VOB file, and VTS Mappleenus are stored in VTS_01_0.VOB, VTS_02_0.VOB files etc.

So, if you renamed one of these Menu VOB files with a ".mpg" extension and opened it in the Quicktime Player, for example, you would see all the video used by your menus play continuously - in the case of stills, they will flash by, since they are only one nav-pack long, whereas motion-menus contain longer sequences of video.

Each menu is contained in one or more cells, just as other pieces of video are divided into chapters - a chapter, or PTT (Part Of Title) is in fact a particular type of cell. Simple looping motion menus have one cell, menus with a transitions can have 2 cells. This explains why replacing the video for a single menu is a little more complicated than simply replacing an entire VTS. All the video for the cells is joined together in a continuous stream in the VOB file, so to change just one menu, we need to somehow disect a menu VOB into it's constituent parts, change the video & buttons for that one cell only, and then build a whole new VOB file and import this over the top of the original.

Finding which VOB file to edit

The first task is to look at the existing project, and find out which VOB file contains the menus you want to change. There's no one answer to this - menus can be "stored" in a whole host of places. Luckily DVDAfterEdit makes it a piece of cake to find out where they are. Simply fire up Tracer in Version 3 (Apple-G, :-) and "Stride" through until the Preview window shows the menu you're interested in, and then click the "Show" button. (There's an introduction to Tracer here.)

One possibility you should be prepared for is that the menus may be spread out through the project. So for example, DVDSP 1.5.x puts all it's menus in the VMG, so they are all contained in the VIDEO_TS VOB. However Versions 2 & 3 put all the menus in VTSM 1 (or, if there are both 4:3 and 16:9 menus, in VTSM 1 and 2 respectively) . A Sonic Creator or Scenarist author, on the other hand, is at liberty to put menus wherever he or she likes, so there may well be menus in the VMG and in several VTSMs, if not all of them ! Which means you'll have to repeat this whole process for each VTSM VOB... Before you get too concerned though, the upside of this last scenario is that where the menus are spread out through multiple VTSMs, there are likely to be far fewer in any one VOB file, making each stage correspondingly simpler and quicker.

So, now let's look at each stage of the process in detail:

1 - Duplicate the original VIDEO_TS folder

If you haven't already done so, now is a good time to duplicate your original VIDEO_TS folder to a new location, ready for editing. (It's a good idea to put the copied project in a folder with a different name, to avoid confusion.) This also means we can copy and paste all the project's commands when we've finished editing the menu PGC structure in stage 6.

2 - Extracting Data From VOB Files ("Ripping")

The aim of this stage is to obtain all the elements you need to rebuild the new VOB, including the parts you want to change. My favourite application for this is DVD Decryptor, on the PC, however DVD Extractor and OSEx on the Mac are also possibilities. (Detailed instructions on using all these programs is beyond the scope of this article, but they all have tutorials available online which are easy to find using Google)

Exactly what you should extract depends on the method you want to use for modifying the VOB. Ther are two options - build new menus in your authoring application as menus ( simple ) or another method which is much more flexible, since it doesn't rely on any restrictions your authoring software might have about creating menus. In a nutshell, this method will build a new menu VOB as a VTS (often called a "track", or "movie") and then import that VOB into Menu Space, and allocate all the video it contains to new menu PGCs. Don't worry, that will all be covered in great detail in Section 5 as we progress.

So, first we will need to de-multiplex, or "demux" the files - ie. separate out the video, audio and subpicture streams, so that you can import these as assets into your authoring application. DVD Decryptor doesn't support extracting button highlights as image files, so I use another PC utility called SubRip for this purpose.

Extracting Audio & Video Streams

In DVD Decryptor, first go to the Tools menu, and choose "File Splitting by Cell ID". Since menus are divided up into cells in the VOB file, this will result in a separate piece of MPEG for each menu. It isn't essential if you have the facility to trim and adjust mpeg streams, but can save a lot of time for very large projects.

[inline:103_split_by_cell.jpg=center,Split by cell]

Next, in the main window, right-click on the file you want to demux and select "Stream Processing" (I've selected VTS_01_0.VOB, ie. VTSM 1, in the picture below) . For each stream choose the "demux" option.

[inline:103_choose_demux_option.jpg=center,choose the demux option]

If for any reason there are any streams you don't want, uncheck the boxes to stop them being extracted. Assuming you're demuxing a menu, you can untick any "subtitle" streams - these are actually the button highlight subpictures, and DVD Decryyptor won't extract these as image files. We'll do this in a moment using SubRip instead.

Once the process has finished, you'll have a large collection of audio and video files on your hard drive. The files will be given logical names, but even so it's worth working systematically through them at this stage to find the ones you want to make alterations to. If you have any problems keeping track, you can always open up the original VIDEO_TS folder in DVDAfterEdit. Double-clicking on a menu's PGC in the left pane will "jump" the preview window to the start of the menu's video so you can preview it, and provided you have the "Show Object Location In Window" option ticked in the General Preferences, you'll be able to see exactly what it is you're looking at in the Preview window.

Extracting Button Highlight Info

Now we'll use another small and useful utility called SupRip to extract the button highlight images. Fire up the program and choose File > Open VOB(s)from the file menu. The "What To Do ?" window will open. Click the "Open Dir" button and browse to the VIDEO_TS folder you're working on. Choose the VOB file you need, for example VTS_01_0.VOB, and click Open. In the VOB(Sub)files window, make sure the correct VOB file is checked - the auto-select feature will pick the VTS_01_1.VOB file by default, whereas the one we want VTS_01_0.VOB (or the equivalent if you're extracting from a different VTSM)

Click the "Verify" button in the Language Stream box - this scans the VOB file for any available subpicture streams. In the drop-down menu you should see 00 - ???. (There are question marks because the program is commonly used to extract subtitle streams, which would be flagged with a language. Since in this case the subpictures are button highlights, there isn't one.) If the menu you're working on is 16:9, there will possibly be two subpicture streams, one for Widescreen displays, and another for Pan-Scan or Letterbox display modes on a 4:3 set. You'll need to extract both, separately.

So, make sure that the option "Save Subpictures as BMP" is ticked in the panel on the right, and click "Start".

[inline:103_save_subpictures_bmp.jpg=center,Save Subpictures as BMP]

Choose a location and name for the extracted pictures in the next window which opens - you can choose the correct colour-preset for your authoring application at this point too, if you like. Click OK, and once the program has finished, you have everything you need to start modifying the menus.

3 - Modifying the extracted assets

Assuming you intend to modify the existing menu design, rather than start from scratch, the first stage of this process is to convert the ripped m2v files into something you can work with, since editing MPEG directly is flaky at best. There are several applications that will do a good job of this - I use an application called DiVA and Uli has recommended MPEGStreamClip. Whichever you choose, be sure to extract the files to a high-quality format like uncompressed Animation, to avoid any quality loss. DV isn't good enough for this job !

Now you can modify the video assets to your heart's content - removing logos, changing text etc, until everything is as you want it for the new version. Remember to edit the button highlight subpictures too, if you're changing the size and / or position of any buttons.

(Notice that for the time being I'm assuming you're keeping the number of menus, and the number of buttons on those menus, the same as in the original project. However as I'll show you at the end of the article, it's straightforward to expand this technique to allow the addition and deletion of both menus, and buttons. Another great feature of this method is that the new menus can even be different lengths to the originals, if you like, although the copying and pasting of commands in stage 7 at the end of the process becomes a little more involved. For the time being then, keep all your menus the same length and structure as the originals.)

You now need to re-export these modified assets as MPEG video. Depending on whether your encoder features I-frame forcing, it may be safest to choose to export each cell separately, rather than as a continuous stream with an I-frame at the start of each new menu - ie. on each separate image, if you are using static menus. If you're making 16:9 (widescreen) menus, remember to drop them onto Force Pan-Scan or Force Letterbox from John Brisbin's MPEGAppend Suite, to ensure they display correctly on all players.

(Since later we will copy and paste the button commands for our menus, and because these commands are referred to by nav-pack number, ideally you need to duplicate the GOP structure of the encoded video too. Often these menus will be encoded with fixed 12 or 15-frame GOPs, in which case this should be straightforward. If they were encoded with Open GOPs, you will have to do a little editing of the commands before you paste them back in, but more on this later.)

Once you have exported your adjusted assets (or indeed made entirely new ones), you're ready to rebuild these as a VTS VOB in your authoring application ready to be imported over the top of the original in DVDAfterEdit.

4 - Building new Menu VOBs

By far the easiest way to create suitable menus is simply to author them as usual in your favourite authoring application. You can then open the build files and explore using Tracer to find out where the newly built menus are located - for example, DVDSP puts them all in either VTS_1_0.VOB or VTS_2_0.VOB depending whether they are 4:3, 16:9 or both. You can then simply use the Replace Menu VOB function to over-write the originals.

If you choose to use this approach ( recommended ! ), you can simply move straight on to Section 5, which will show you how to Replace the new menu VOB into your project, and modify the structure to retain navigation.

In this section though, we will look at building menus as "buttons-over-video". Although more long-winded, this approach can get around the limitations of certain authoring systems, and gives some interesting insights into how menus are constructed. It may be a good idea to read though it anyway, even if you intend to simply build the new menus in the usual way.

The illustration below shows a "track" in DVD Studio Pro 2, laid out ready to create a VTS VOB suitable for replacing the original. For those not familiar with the interface, the blue blocks represent video assets, the green blocks are audio, and the yellow blocks are subpictures. The vertical lines are "markers", which specify where cell boundaries should be. The orange ones show where sub-picture information (button highlights) begins. There are two subpicture streams, because the menus are in widescreen 16:9 format, and there is an extra stream for button highlight display when the player is set to 4:3 playback. (Uli has written an article about creating overlays for this kind of project over on TFDVD.com) As is usual, the 4:3 (pan-scan) overlays are first, in Stream 0, and the widescreen overlays are in Stream 1.

The original project is also shown in DVDAfterEdit to show how the video is being used by different PGCs.
(Each PGC with a "twirly" arrow defines a menu on the DVD.) In the top illustration, two examples are highlighted - PGCs 11 and 12 are using the cells indicated by the red arrows.

[inline:103_two_sample_pgcs.jpg=center,two sample PGCs]

Looking at the second larger picture, we can see how the markers in the VTS (track) separate the cells (sections of video) for each menu. Each marker defines a cell boundary, as we saw earlier. (In DVDSP, these markers usually define chapters, but in this case the "Chapter" box is un-ticked. Don't be confused that the markers are named as if they were chapters, these names are added by default when the markers are added.)

Remember that in DVDAfterEdit's display, each PGC with a twirly arrow by it refers to a menu on the final disc. The first 5 PGCs are dummies, ie. they don't use any video from the VOB file. They contain commands which control navigation on the disc, but don't display anything.

So, the first section of video, defined by the first marker (cell) is being used by VTSM PGC 6, and contains button highlight info. The next 4 PGCs use much shorter cells, without buttons - these are just short snippets of "transition" video.

VTSM PGC 11 is more interesting - it has two cells. The first is the menu transition, without button info (green marker) whereas the second in the looping portion, with button info (orange marker) . Notice as well that none of these menus has any audio, although one of the later menus does, visible in the top view of the VTS track.

Laying out a new VOB (Track)

So, to build your own VOB, you begin by simply lining up all the snippets of video which you extracted back at stage 1 in a new VTS (track, or movie) . However wherever you have modified an asset, of course you insert your new exported MPEG file instead of the original. Then you define each segment as a cell (using markers, in DVDSP) and add buttons-on-video as required.

So, for example, below is a list of some of the extracted segments of video I obtained from DVD Extractor. I import all of these into an empty DVDSP project, create a new track, and drag them into it in the correct order:

VTS_01_MENU_VOBID_001_CELLID_001_1 - 0xE0 - Video.M2V
VTS_01_MENU_VOBID_002_CELLID_001_1 - 0xE0 - Video.M2V
VTS_01_MENU_VOBID_003_CELLID_001_1 - 0xE0 - Video.M2V
Menu_4_New_Version - C4.m2v
VTS_01_MENU_VOBID_005 _CELLID_001_1 - 0xE0 - Video.M2V
VTS_01_MENU_VOBID_006_CELLID_001_1 - 0xE0 - Video.M2V

...and so on.

(Incidentally, don't be confused by the fact that these segments are distinguished by VOB IDs, and are all labeled as CELLID_001_1, even though I'm talking about them being separate cells. This is because a VOB file can contain many VOBs (video objects) . Each VOB boundary corresponds to a cell boundary, and each VOB can itself contain cells, although this isn't the case here. So, the first cell in this VOB is VOBID_001 but only contains one cell, the second is VOBID_002 and so on.)

(An alternative method to piecing the files together in your authoring application would be to join all the files together using John Brisbin's MPEGAppend before importing them. This has the advantage (in DVDSP at least) that the markers will be added automatically when importing, but the disadvantage that alterations later are more fiddly - plus, that's a lot of files needing to be renamed before you append them...!)

Setting Up Buttons-On-Video

Once all your video segments and cells are laid out in the correct order, and you've added audio where necessary (remembering to keep it all exactly the same format, as the spec requires) you need to add cell boundaries (markers) between all the different chunks. As we saw above, these shouldn't be chapters (PTTs), and you need to carefully assign buttons-on-video where necessary, using the overlay images you extracted earlier using SubRip. You also need to set up the button hotspot coordinates, highlight colors, button navigation (left, right, up down) and so on, exactly as if you were creating a normal button-on-video.

It isn't necessary, however, to set up any actual button commands - this wouldn't make any sense anyway, since the rest of the project isn't there to navigate to ! We'll copy and paste all the original commands in stage 7 anyway. Make sure your buttons have the same numbers assigned to them as they were in the original project - you can use the button hot-spot preview function in DVDAfterEdit for this - otherwise when you paste the commands back in later, the wrong command will be assigned to the wrong button.

This is probably the most labour-intensive part of the process, since you have to be painstaking about putting all the markers in the right place - just one GOP (I-frame) out, or one marker omitted, and everything gets a bit confusing later on ! Don't worry, though, if you do make a mistake, you simply correct it, re-mux the VTS, and re-import.

As I mentioned earlier, at the end of this article I'll demonstrate an extension of this technique which allows you to add or remove buttons from menus - if you're adding them, you'll obviously need to include the highlights for the new buttons at this stage as well.

Multiplex (build) the new Menu VOB project

Finally, however, you're ready to multiplex (build) your project to a temporary folder, ready for importing in over the top of the original. So, go ahead !

5 - Use the "Replace Menu VOB" function to overwrite the original VOB file

As is often the case, this powerful feature of DVDAfterEdit is deceptively simple to use. Open up the renamed copy of your project, then simply select the correct node in the left-hand pane of 'Edit - ie. the VMG if you are replacing the VIDEO_TS VOB, or the appropriate VTS Menu otherwise, control-click and select "Replace Menu VOB".

[inline:103_replace_menu_vob.jpg=center,Replace Menu VoB]

When prompted, browse to the temporary folder and select the VTS VOB we were working on earlier. Remember to select the VTS VOB itself - there are no "real" menus in the temporary project. (If you're using DVDSP and the menu track was the only one in the project, the file you want is VTS_01_1.VOB.)

Un-tick the "Import commands" option, and click OK. If you have built your menus in a track as described in the previous section, you should get a warning that the VOB contains subpicture information - click Continue. (If you don't get the warning, you've forgotten to specify the overlay subpictures for your buttons-on-video !) The progress bar will show you the replacement's progress, until it is finished.

So far so good - all the original video data has now been replaced by our new VOB file, including the edited elements. However, that isn't the whole story, as we shall see. If you're already comfortable with the concept of PGCs and how 'Edit displays them in the Program Map, you can skip straight to Section 6 - if you've followed Uli's animated button highlights tutorial, and Ben's re-authoring articles, much of this will be familiar territory, for example - otherwise, let's take a detailed look at our project's menu PGC structure...

Menu PGC Structure "Before and After"

I think the easiest way to get a grip of Menu PGC structures is to look at them in 'Edit, so open the original project as well as the new version, and line them up side by side, so we can see what the differences are.

[inline:103_simple_structure.jpg=center,simple structure of new VOB]

The exact differences depend on how you made your new menus. The illustration shows menus built in a track. If you built them as menus in an authoring application, they will look different, but the method I'm about to describe is the same.

As you can see, after the Import the detailed PGC structure of the original is gone, and has been replaced by the very simple structure of the new VOB. Remember, a PGC (Program Chain) is actually just a set of instructions telling the DVD player how to access each cell of video contained in the VOB file. So whereas originally there was a PGC for each menu in the project, referencing only one or two cells of video per Menu, after the import there is just one PGC, for the whole VOB. It's "twirly" arrow is unfolded to show all the cells in the illustration above (on the right), but don't be confused - the original has 35 PGCs, including dummies - the new one has only one ! And of course now all the cells are used, or "contained" by this single PGC.

So, if you view the new VTSM 2 PGC in 'Edit's Preview window after the import, you'll see all the menu video playing continuously - exactly as we did earlier when we renamed a VOB file and opened it in the Quicktime Player. This is what we'd expect, since the VOB was built as a continuous stream of video. We can confirm this simple new structure by looking at DVDAfterEdit's unique Program Map. In the next section, we'll use this to actually Edit the PGC structure, in order to re-create the original, but for the time being let's just use it to look at the existing structure.

DVDAfterEdit's Program Map - Examining and editing PGC structures

Select the PGC of your imported menu VOB as shown above, and look for the Program Map in the right pane. It's display is divided in two - on the right-hand side, it shows us the "Available Cells". These are all the cells contained in the VOB - ie. one for each cell boundary (marker) in the VTS (track) we laid out in stage 4. The left-hand side shows which cells are "in use" by each PGC.

So, in this project, after the import, all the cells are in use by the first PGC. It's listed in the Program Map as PG 1, ie. "Program 1". Each PGC contains one or more Programs, hence the name "Program Chain" (PGC) . Menus usually contain only one or two Programs. However a VTS PGC, for example, typically contains a whole movie, and will have a Program for each Chapter. You can contrast the contents of this newly imported PGC with one of the original menu PGCs, by selecting one from the other 'Edit window. You'll see that each PGC there only "contains" one or two cells, depending on whether the menu has a transition or not.

So, now all we have to to do is change the PGC structure for our newly imported Menu VOB to match the original. Then we can just paste all the original commands back in, and our project will work exactly as it used to, but with new video assets wherever we changed them when re-building the VOB in our authoring application in stage 4.

6 - Edit the new VOB's PGC Structure

This is yet another feature of DVDAfterEdit which makes experienced DVD Author's jaws drop. Nothing like it has ever been available before, and like all 'Edit's more advanced features, actually using it is a piece of cake. Let's review our goal - our newly imported Menu VOB has a very simple PGC structure - one Program, containing all the cells we defined. We want it to actually have a PGC for each individual menu, containing the correct cell of video.

Removing cells

So, firstly, let's remove all the unwanted cells from the PGC we have. To do this, just click on one and drag it out of the program map, into the "Available Cells" side - job done ! Repeat the process for all the other cells, and we have a PGC containing one Program, using just one cell, the first one from our menu VOB - ie. our first menu PGC.

[inline:103_removing_cells.jpg=center, Removing cells]

[If anyone reading this is a step or two ahead of me, you may be wondering why I haven't simply created a dummy PGC and dragged the cell I need across into it. This is because the version of 'Edit I recommend you use for this tutorial, 2.05, has a quirk which means that a PGC with no cells assigned won't pick up on a few of the properties we'll need later on.]

Next we'll repeat this step for all the other PGCs we need, to recreate the same PGC structure as the original, ready to paste the commands back in, but first:

Doing things in the right order

Before going any further, I'm going to outline a summary of the next few steps, and how they fit into the overall procedure - getting the order of these right is important in order to to minimise your mouse-clicks ! Then we'll look at each new step in a little more detail.

Stage 5: Replace Menu VOB (We just did this)

Stage 6: Copy & paste menu UOPs from original VIDEO_TS folder

Unset Entry PGC, Root Menu
Set Subpicture Stream Properties (to make sure the right aspect ratio overlay displays)
Edit Menu Program Map (as above, to create all the PGCs we need)
Set the Root Entry PGC

Stage 7: Copy and Paste All Commands (We'll do this later) and

Repair as necessary, to include:
Cell Commands
Cell Still Times

So, with that in mind, let's look at each part of stages 6 & 7 in detail:

Adding PGCs and cells

In a moment we'll duplicate our new menu PGC, and drag & drop the correct cells into it, to make the next menu PGC, but since we're going to use this PGC as a "template" for all the others, first we'll tidy up a few details to save time later:

Copy and paste the User Operations (UOPs) from the original project for your menu. Hopefully this process will be familiar to you already from all those other DVDAfterEdit projects you've done ! If all your menus have the same UOP settings, this will be the only time you need to do this - if you're using different UOPs for different menus, you'll have to tweak them individually.

Unset Entry PGC, Root PGC settings. Since there can only be one Root Entry PGC Menu per VTS, and we will be duplicating this PGC, it's useful to unset these properties for this PGC. If the idea of "root" and "entry" PGCs is a new concept to you, please check out Ben's re-authoring articles to find out how it works. So, make sure "Entry PGC" is set to "No", and set Menu Type to "Non-entry PGC". We'll re-set them later for the actual menu we want.

Set Subpicture Stream Properties. This stage is only necessary if your project has both 16:9 (widescreen) and 4:3 menus. If so, you'll have set up the button overlay streams back in stage 4 - one for display on a widescreen TV, and one for either letterbox or pan-scan display. So, assuming (for example) you placed 4:3 Pan-Scan overlays in Stream 0, and the widescreen (16:9) overlays in Stream 1, you should adjust the properties so they look like this:

[inline:103_stream_properties.jpg=center,stream properties]

(You can find these properties by clicking on the PGC in the left pane and looking underneath the Pre & Post-commands.) Notice that because we've imported a VTS PGC into Menu Space, there are properties for both streams, whereas a menu straight from an authoring package has properties only for Stream 0. This doesn't matter as far as spec-compliance or operation goes, but to be on the safe side I have set the properties for both streams.

Editing PGC structure

Now we're ready to duplicate that PGC structure ! Looking at the original in 'Edit (see the illustration in Stage 5) we see that first we need 5 dummies, so:

  1. Control-click on the PGC and choose "Add Dummy PGC" five times. Now is a good time to set the first dummy PGC as a Root, Entry PGC.
  2. We now have an unwanted non-dummy PGC at the top of the list, but don't delete it straight away, since that's our "template" which we've just been working on. So control-click on that first PGC (with the twirly arrow, showing it has video assigned to it) and choose "Duplicate PGC". Notice that all added and duplicated PGCs are added to the end of the list, by the way.
  3. Next delete the first PGC, so now we have the correct initial structure - 5 dummy PGCs, followed by one with a Program in it.
    [inline:103_five_dummies_noe_program.jpg=center,pgc editing]
  4. Now we can duplicate PGC 6, drag the cell out of it, and drag the next cell in - this is of course the video for the next menu.
  5. Duplicate PGC 7, and replace cell 2 with Cell 3
  6. Duplicate PGC 8, and replace cell 3 with Cell 4, and so on...

...until eventually, we've entirely replicated the original PGC structure ! If you're thinking "that will take forever", don't worry - I can entirely rebuild the structure of the above example in about ten minutes; it's much quicker than it looks !

A few notes

  • You can double-click on a cell in the Program Map at any time and the Preview window will open up to show it's contents - this is a useful way of checking that you've added and removed the right cell.
  • Motion-menus have 2 cells, as we've seen - just drag the second cell in after the first, into the blank area, so that it is assigned it's own Program number.
  • One nice thing about this method is that it doesn't matter if your new menus are longer or shorter than the originals. However changing the duration, adding or removing a transition can make the final tidying-up stage a little trickier. We'll deal with that later.
  • Having a second 'Edit window open all the time to refer back to is almost essential!

7 - Copy and Paste Original Project Commands

So, now we have created a matching PGC structure in our new version, (it's a good time to Save !) we can safely go to our original project, and use:

Edit > Project-wide Edits > Copy Commands > All Commands as Text

(make sure you have a left-pane node selected when you do this, or the options may be grayed-out) and then, moving across to the new project:

Edit > Project-wide Edits > Paste Commands From Text

...to transfer all the original commands and navigation to our re-worked project. All that remains now is a little housekeeping, and we're done ! If you get error messages about being unable to paste certain items, the most likely problem is that either you've unintentionally missed a PGC out (or doubled it up !) or there are a different number of buttons or cells somewhere in the project. If it's the later, and you did it on purpose, no problem - but if your intention was to perfectly match the original structure, you'll need to do a little troubleshooting to find out where things have gone astray. Tracer can be very useful for this...!

Tidying Up

Lastly there are few details to check - I have listed examples that I have come across, but depending how your project was authored there may be others. The way to proceed is to fix everything you can think of, and then start testing to see if anything isn't working.

Cell Commands - some kinds of menu use cell commands, most commonly those which loop - these often have a "LinkTopC" command on the second Program of the PGC, for example. To add these, first select the Menu's PGC, select "Cell Commands" and hit Apple-K to add a new command. Type in "LinkTopC". Next unfold the twirlies of the PGC and second PG until you can select the cell for the looping portion of the menu, and use the drop-down menu to select 1:LinkTopC as the cell command.

Cell Still Times - other types of menu pause on the final frame until the user makes some kind of input - these need to have their Cell Still Time set to 256 (ie. pause indefinitely) This property is also found at the Cell node-level.

As I say, there may well be other details to look for in the project you're working on, so keep a sharp eye out.

And that's it - congratulations, you've just completed yet another task that has been hitherto impossible in DVD authoring ! You have extracted raw data from the VIDEO_TS folder of a pressed DVD, edited it, and replaced it back into the original project, all without access to the original assets, and retaining the original navigation..

Now, a few pointers about how to extend the technique to allow even more manipulation.

Extending The Technique - Adding, Removing and Editing Menus

There are two main new ideas at the root of all these extended techniques, which are just expansions of what we've already done.

They are:

  1. Editing the commands before you paste them back in, to account for different numbers of buttons, changes in menu length, etc.
  2. Adding additional video footage to the end of the new VOB file (for use in entirely new menus) and then editing the PGC structure after pasting the commands back in - to remove buttons and add/or remove menus.

1- Editing Project Commands

First, let's consider Option 1. To understand it, we need to examine how the project commands look when you copy and paste them. So, open up your original project again, and copy all the commands as text, as before. However instead of pasting them into your new project, open up TextEdit or a similar application, and paste them there. This excerpt is from the first non-dummy menu PGC in my project (I just searched for VTSM PGC 6) :

#ButtonCommands Group 1 of 2 with 4 buttons from
"SRT_DEMO Backup>>Video Title Sets>> VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 2
Link PGC 3
Link PGC 4
#ButtonCommands Group 2 of 2 with 4 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 2
Link PGC 3
Link PGC 4

So, I've omitted the Pre, Post and Cell Commands for clarity. As you can see the, the syntax is very simple - 'Edit records where the button-commands are ("SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1))and then what they are. (Link TailPGC)

Notice that this information includes the nav-pack number - we'll come back to that later. (Once again, there are two button groups in my project - Group 1 for Pan-Scan, and Group 2 for Widescreen)

So, how can we edit these commands, and what can we do with them ?

Removing buttons from a menu

In order to remove a button from this menu, we simply edit the commands shown above so they look like this instead.

#ButtonCommands Group 1 of 2 with 3 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 2
Link PGC 3
#ButtonCommands Group 2 of 2 with 3 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>English>>
VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 2
Link PGC 3

We have just told DVDAfterEdit that when it pastes the commands back in, there are only three buttons in the menu, not four. And when we paste them back in, the last one of our buttons will have disappeared. Simple ! You can copy and paste all the commands in one go, or just the ones relevant to the PGC you're looking at, and you can check it's worked by looking at the hotspot preview in DVDAfterEdit, if you like.

Of course this means that when you re-build your menu VOB in stage 4, because the hot-spot areas are "tied" to certain button numbers, you'll need to make sure the buttons you want to remove are the highest numbered, since these are the ones removed first - otherwise you'll end up with the wrong hotspot areas for the wrong buttons. You'll also need to make sure you keep track of which button does what, and re-arrange the commands if you changed the order. So, in the example above, if we wanted to remove the second button, we would move it to be the 4th button when we re-build our VOB in stage 4, and would have to change the commands we paste back in to read:

#ButtonCommands Group 1 of 2 with 3 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 3
Link PGC 4
#ButtonCommands Group 2 of 2 with 3 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 3
Link PGC 4

Of course we also have to be careful in this case to adjust the button navigation (left, right, up, down) to avoid the button which is about to be removed. It sounds confusing, but you'll get used to it :-)

Adding buttons to a menu

Adding buttons is just as simple, if not simpler - when we re-build the VOB in stage 4, we add our new buttons-on-video, and then edit the new information into the commands before we paste them back in. So, in the above example, to add an entirely new button to the menu, we simply add it into the VTS track in our authoring application before re-builing and importing, and then edit the commands to read:

#ButtonCommands Group 1 of 2 with 5 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 2
Link PGC 3
Link PGC 4
Link PGC 5
#ButtonCommands Group 2 of 2 with 5 buttons from 
"SRT_DEMO Backup>>Video Title Sets>>VTS 2>>VTSM 2 Menus>>
English>>VTSM PGC 6>>PG 1>>Cell 1>>Nav Pack 1" (V1)
Link PGC 1
Link PGC 2
Link PGC 3
Link PGC 4
Link PGC 5

Dealing With Menus of Different Length

As I mentioned earlier, there's no reason when using this method that the new or edited menus have to be the same length or structure as the originals - except, as we can see from the examples above, all the button commands are pasted to a specific nav-pack, and will continue until the text file indicates otherwise.

So, if you extend the length of one of your menus by a couple of seconds, say, there are likely to be several more extra nav-packs added to that segment of video. So, for example whereas originally the video for Menu PGC 4 might have begun at nav-pack 58, if we extend the video for PGC 3, now it might start later, say at nav-pack 62 instead. So, the button commands won't paste back in correctly.

To solve this problem, all we have to do is edit the commands in the text file to fix this. Fiddly, but straightforward - we can move through 'Edit checking the new nav-pack values in our edited project, and modify the text file accordingly.

So, having seen what is possible by editing the commands as a text file, now we can look at the second strategy of this "extended techniques" section:

2 - To add or remove menus

Adding a menu to a project

This should by now be quite a straightforward idea - if we want to add an entirely new menu to our project, whilst preserving all the original navigation information, we just add the new video data to the end of our newly-built VOB, just as if it was one of the existing menus, during stage 4. However we don't make a PGC for it initially, though - we duplicate the original PGC structure as usual in stage 6, and copy and paste our commands. Then we can duplicate an existing PGC, swap our new cell(s)into it, and bingo - one new menu.

Of course it's Pre, Post, Cell and Button Commands won't do what we want, and these will have to be edited to give us the navigation we want - and, if the project you're working on originated from an abstraction-layer application, this may be a little messy. So messy, in fact, that you may start to be tempted to delete all the project's commands and start again ! But that's Ben's favourite territory, and outside the scope of this article :-)

Deleting a menu from a project

This is even easier. After pasting your commands back in, you could simply delete the PGC of the menu you don't want. However once again, the navigation of your project will need to be repaired to account for the missing PGC, and so in practice it's actually less work to simply edit the commands of the project so that navigation "bypasses" the menu you don't want. If there are any buttons which used to link to it, you might simply remove them (messy but quick !) or cause them to jump to a "feature disabled" page instead. In the later case, you could choose to put this page in it's own VTS, or perhaps you would add a still menu to the end of your menu VOB as described above...?

Of course unless you choose to re-build the menu VOB without the old menu, it's video information will still be retained in the file, but the user will never know it's there, and unless your bit-budget is really tight, it seems silly to rebuild the entire VOB just to remove a little redundant video.

Yet another option would be to go to the trouble of re-building the entire VOB with a new piece of video that effectively removes the button that went to the old menu in the first place, in which case you will have to go through the whole process. Either way, make sure you account for all the navigational possibilities - was the menu you've removed accessible using the "Menu" Remote Key, for example ? If so, you'll need to trace the navigation and make sure that it's diverted somewhere sensible instead. For which, of course, Tracer will be an invaluable tool...

As you can see, there are many different ways of achieving a similar result. It's up to you to decide - with the new power & flexibility DVDAfterEdit has given you, you can solve the problem in the way that seems best to you.

Conclusion

This article has shown you how to edit, add, and remove menus from existing DVDs, preserving the original navigation, without access to the original assets. Without a doubt, it's a complex, involved task, and for large projects could take considerable time and planning. But, if it means you can offer you customer a service which might otherwise require weeks or even months to re-make an entire DVD in a new authoring application, it may well be worth taking a look at. I hope you've found the article interesting, and look forward to answering any questions on the boards.

Animated Button Overlays in Menus with DVDAfterEdit

by Uli Plank
Requires DVDAfterEdit Standard

This article is based on Trai's article about the subject he started in a recent thread (and that one was based on a brilliant idea from Larry Applegate). We've successfully completed the process during NAB (and demoed it there) and I'm going to explain it step by step here.

First of all: why can't we do this in DVDSP (not even in version 3)?

Well, you can make an animated overlay with the help of subtitles (i.e. subpictures) for a track, which is the first process I'm going to explain here. Unfortunately we can't add several subpictures to motion menus, only a single static overlay. But you are clever: you want to try and use buttons on video to make it happen! That would be a very tedious work, since you can't import them easily with the help of a text file. Plus: you can only change frames on every I-frame, making the animation very jumpy. Oh, I forgot, if you are a very experienced DVDSP user, hanging around here at DVDAfterEdit.com: What about importing the subpictures first and then adding the buttons? Sorry, as soon as we try to turn a track with animated subpictures into a kind of menu by adding buttons, only the first subpicture will be displayed and all subsequent pictures will be lost.

Now: What's the Trick?

It's pretty simple (like most great ideas): we construct a motion menu of the right length without the animation and an identical track with the animated subpictures (but no buttons) in DVDSP and let it do it's work (i.e. let it multiplex the files). Later we move the right VOB (a Track we've constructed for the purpose, in the same project, which we'll delete later) over into the menu domain and reconstruct the buttons and their navigation with DVDAfterEdit - which is not so hard to do and will teach you a lot about the use of this program at the same time.

Part I: Preparing the Animation

You'll need a row of single black and white pictures for your animation, and they'll be reduced to only 4 different shades between black and white, just like any other subpicture. You may generate them in any 2D-animation program. I actually used a few very old black and white photographs, actually the oldest effort to record motion that we know of, photographed by Eadweard Muybridge about 125 years ago. I arranged them, together with my static elements for the button overlays, in After Effects, then I rendered and saved them as numbered PICT files.

To import them into DVDSP, you'll want to generate a command file instead of positioning them in the track manually. It's mentioned in Apple's manual at page 382. This can be done by a STL file, and it's format is described in the manual, starting at page 386.

It should look more or less like this:

$SetFilePathToken = <<Image>>
// Tell the program when to expect an image file instead of text
$ForceDisplay = True
// Make it always visible
$TapeOffset = False
// Put it relative to the timecode of the track, not the video
// Here come the frames
00:00:07:00 , 00:00:07:02 , <<Image>>Animated_Overlay_00001.pct
00:00:07:02 , 00:00:07:04 , <<Image>>Animated_Overlay_00002.pct
00:00:07:04 , 00:00:07:06 , <<Image>>Animated_Overlay_00003.pct
00:00:07:06 , 00:00:07:08 , <<Image>>Animated_Overlay_00004.pct
00:00:07:08 , 00:00:07:10 , <<Image>>Animated_Overlay_00005.pct
00:00:07:10 , 00:00:07:12 , <<Image>>Animated_Overlay_00006.pct
00:00:07:12 , 00:00:07:14 , <<Image>>Animated_Overlay_00007.pct
00:00:07:14 , 00:00:07:16 , <<Image>>Animated_Overlay_00008.pct
00:00:07:16 , 00:00:07:18 , <<Image>>Animated_Overlay_00009.pct
00:00:07:18 , 00:00:07:20 , <<Image>>Animated_Overlay_00010.pct
// and so on...

Be careful where to type spaces: they should appear before and after the comma, but not between the FilePathToken and the filename (this one has caused me quite a headache for a while, not having looked at page 389 close enough to notice - it's there). You can generate that file in any old text program as long as you save it as plain ASCII text, and it should reside in the same folder as the images. Of course you could generate the file with an Apple Script or an Excel spreadsheet to avoid typing, but some copying, pasting or search and replace will get you going as well.

I have used an animation that changes every two frames here, which works very well on most players. There's a common misconception about overlay animations, they are not limited to GOP boundaries, they may even change on every frame. But the limits are not directly dictated by the number of frames per change, but the amount of data changed. If you change large areas of the screen, you will need to reduce to about 2-3 frames of video per frame of animation. If only small areas change, all players I've tested handle single frame animation pretty well. A speed of 15 fps (for NTSC) should work well in most cases, or 12 fps - like in my example - for PAL.

Building the Project in DVDSP

[inline:1=center,Position in Outline]

In my very basic example we'll use one single motion menu and three connnected tracks. I'm going to use a motion menu containing an intro of seven seconds with the buttons flying into place and 12 seconds with static buttons and moving background.

[inline:2=center,Original Motion Menu]

Notice that the loop point is set to 7 seconds. Generate the buttons you need here and link them to their target tracks. Let the end jumps of those tracks point to this menu (and the respective buttons), just set up everything as you'd normally do it.

Now generate an extra track (for a total of 4 Tracks in the project), which should be positioned after all the other tracks in the outline window, here I called it "Animated_Track".

[inline:3=left,Cell Marker]
[inline:4=left,Track with Marker]

Import the same video (and audio, if needed) you used for the motion menu into this track. Add a marker at precisely the same time as the loop point in the menu. You may de-activate all "types" for this marker in the marker's properties, so it'll be just a cell marker, showing in green.

[inline:5=left,Import Subtitle]
[inline:6=left,Imported]

Now click into the first subtitle track with the right mouse button (or CTRL-click) and select "Import Subtitle File..." from the contextual menu. Open the STL file you created for your animated subpictures. It may take a while, but finally you should see a message like mine (with your number of subtitles, of course).

[inline:7=center,Animated Subpictures CU]

They won't be visible as single subpictures without zooming in a bit on the timeline.

You can have a look at the subpicture animation with the Simulator, if your computer is fast enough. But there's one more thing you need to consider: if you don't want your animated button overlays to show in the ���normal' state, you'll need to change that here. The information for the visibility of this state is contained in the multiplexed subpicture, so we can't change that with DVDAfterEdit (the selected and activated state can be changed). So select one of your subpictures, turn the opacity down to zero for all values and click "Apply to Stream" - this will change all subpictures to the same settings.

[inline:8=center,Normal State Zeroed]

Don't connect any button or anything else to this track, since we want to get rid of it later. Now you are ready to multiplex the project - "Build" in Apple-speak. You'll notice that it takes DVDSP quite some time to multiplex the track with the animated subpictures. The log file will show which VTS number was the last one generated. Please note: any slideshows you have in the project will be put last in the row, behind the track with the animation.

[inline:9=left,Muxing]
[inline:10=left,Log Window]

You can't look at your animation now with any DVD player - remember, you can't even access that track now. So let's go for the next step.

Part II: Moving your Animation into the Menu Domain with DVDAfterEdit

Make a duplicate of your project on harddisk. Remember: "With great power comes great responsibility" as one of the characters on the DVD with animated button overlays said - seen "Spiderman" ? Since DVDAfterEdit will give us full power over the VIDEO_TS folder, we better work on a copy - and having both the original and the copy open makes a few operations easier.

What do we have now?

Open your VIDEO_TS folder in DVDAfterEdit and have a closer look at the structure of our simple project. The first VTSM will contain the PGC for our current menu (without the animation). After a few dummy PGCs DVDSP created for it's abstraction layer you'll see PGC 7 with two cells in it. This is our menu with it's intro and the part with the buttons in place.

[inline:11=center,Output DVDSP]

The video title sets are our four tracks, VTS 4 being the one with the animated overlays. Since we created a cell marker there, we can already see a similar structure like the one for PGC 7 in the VTSM, but the whole bunch of dummies is missing here. If you don't plan to destroy DVDSP's commands and do your own programming (as described in a recent article by Alex Alexzander), you'll need to reproduce the original structure to retain the abstraction layer programming.

Duplicating the PGC Structure

[inline:12=center,Add Dummy PGC]

By right-clicking on VTS 4 we'll acces the command "Add Dummy PGC" and repeat this six times to get the same number of dummies in VTS 4 that are in VTSM 1 (remember, we're about to move VTS 4 into VTSM 1 with a replace menu VOB operation, and we want the PGC structure of the Abstraction layer to match).

[inline:13=center,Drag Cell Out]

These empty PGCs will be generated after the existing one, so we don't yet have the same arrangement as in the existing menu. Not a big problem: click on the first one (the one with programs in it) and you'll see the the two cells in the Program map an the right hand side. Just drag both them out of that box and the first PGC will become a dummy too.

Now select the last dummy PGC in VTS 4 and drag the two cells from the box named "Available Cells" to the left into the Program Map (in correct order, for sure). The sequence of PGCs should look exactly like the one in VTSM 1 now, and the content of the two non-dummy PGCs should be identical too (which can be checked in preview, of course). Save this version to write the new structure into the VIDEO_TS folder.

Saving the Commands

When we replace the VOB connected to a VTS or VTSM - which is our next step - we loose all the commands attached to it. This is why we need to copy all the commands from the project's VTSM domain to put them back again later. DVDAfterEdit has a very efficient feature for this, copying all commands from the project (or from all PGCs) into the clipboard as a text file.

[inline:14=center,Copy Commands]

To retain this information paste it into a text editor like Apple's TextEdit, where you can look at all the information as readable (and editable!) text. The comment lines will tell you where every chain of commands belongs in the project.

Replacing Video, Sound and Subtitles

Now we are ready to replace the content (VOB) of VTSM 1 with our animated version sitting in the Track. Just right-click (or CTRL-click) on VTSM 1 and you'll see a smalll menu with the command "Replace Menu VOB". Select this and you get a file chooser window. Go for the VIDEO_TS folder of your project and scroll down to the last VOB, which is VTS_04_1.VOB in our case. It doesn't matter if you have "Import Commands With VOB" activated or not - we are going to replace them anyway. You'll get a warning telling you that we may produce an out of spec DVD if the contained subpicture information is meant to be subtitles instead of animated overlays. In our case, we can safely ignore this.

[inline:15=center,Warning]

Attention: if you have any slideshows in your project, the last track will not be your last VOB. Better check them in preview and take a note in such cases.

[inline:16=center,Replace VOB]

Now we need to paste those commands in again. Actually, we only need the ones for VTSM 1, which you can identify by comment lines in the Text file. Select them, copy, and paste them into your project, the entry under "Project-wide Edits" is "Paste Commands from Text".

It's a good idea to open your original version side-by-side now (remember, we are working on a copy, right?) so you can compare those commands we pasted back again. You may delete your dummy track - VTS 4 in my example - now, since it's nood needed any more. The command is "Delete Video Title Set" in the contextual menu (right/CTRL-click).

Replacing Navigation

Let's have a look at our VTSM 1 now at the lowest level of content, the "Nav Pack" level. If you twirl open PGC 7 in VTSM 1 you see the two cells it contains. The first one is our intro without any navigation, so let's look at the second one. You'll see 25 nav packs here, since my video is 12 seconds long, with GOPs about half a second apart (I'm in PAL).

[inline:17=center,Nav Packs]

When you activate cell 2 itself (not one of the nav packs), you'll notice one important difference from our original when looking at the right side of DVDAfterEdit's window: the original cell command is "Link TopC", while our copy has none. Let's fix this by clicking on that entry and choosing "Link TopC" from the menu for our copy too.

[inline:18=center,Link TopC]

Go over to the window of your original version and select the first nav pack, then select "Button Highlights" on the right side. This entry is different from the rest, so we need to change it separately. Type Apple+C (Copy Button Highlights), move over to the copied version and paste that over the same nav pack with Apple+V (Paste Button Highlights Into). Now go back to the original, activate the next nav pack and copy it's Button Highlights. Don't worry, we don't need to do this for every single nav pack one-by-one! Activate all the nav packs in your copy EXCEPT the first one by shift-clicking and use Alt+Apple+V, the command has now changed to "Paste Button Highlights Repeated". We could do this to thousands of nav packs in one single step - nice feature, ain't it?

[inline:19=center,Paste Highlights Repeated]

Select all the nav packs in cell 2 of our copied project now, since the next two actions will deal with all of them at the same time.

Another thing to copy is button navigation: go to the original version, select that position on the right while one nav pack is still selected and touch Apple+V (Copy Button Navigations). Get our new project to the front (see why it's useful to have both of them open?) and do another Alt+Apple+V (Paste Button Navigations Repeated).

Go back to the original, select any nav pack in cell 2, select "Color Schemes" and type Apple+C (Copy Color Schemes). Move to our new version and touch Alt+Apple+V (Paste Color Scheme Repeated).

If you want to have a look at them, twirl one open. BTW, the three color schemes here are the same as those "Color Sets" in Apple's DVDSP. You'll notice that we have settings for color and contrast only for "selection" and "action" at nav pack level. This is why we had to decide visibility or color for the normal state of our buttons before multplexing, since they are not easily accessible for DVDAfterEdit.

And why don't we see those colors here? Well, at nav pack level you may only choose entries from an existing palette - that's what these numbers are standing for. The palette itself is defined per PGC, and DVDAfterEdit will let you change colors at that level to your heart's delight (look at the last position in the right side of it's window while a PGC is selected). Select the PGC and "Color Palette", copy it from your original and paste it into the PGC of our animated project.

[inline:20=center,Copying Colors]

Correcting Button Navigation

Well, that would be it - if I had not made a little mistake! To be honest, it was for educational purposes this time ;-)

If you twirl navigation open for button 3, you'll notice it: pressing "left" should get us to button 2, not 1 as is indicated here. Just select any single nav pack, type in number 2 and copy button navigation from this one. Select all others, paste repeated and it's fixed. See how fast you can correct a little error in DVDAfterEdit without even touching DVDSP again? BTW, you may have noticed here that many other arrow keys will get us to the button itself. This is the equivalent of "Not Set" in DVDSP - there is nothing like ���not set' on this level in the DVD specs, it needs to be defined.

[inline:21=center,Fixing Button Nav]

We should improve on our viewers experience by skipping the intro when coming back from a track in this project as well, but I'd like to point you to Ian's excellent tutorial on the subject here at our site, called "Messages From Beyond The Build File".

For animated button highlights, you should be fine by now. Save and enjoy!

One final note: this project was simplified by having only one menu. If you have more than one, you got to check which ones reside in the same VTSM and build another dummy track with buttons on video for all of them, since you'll need to reconstruct the whole VOB together. Remember: still menus without sound will just be one GOP in length, those with sound will have as many nav packs as needed for the duration of the sound.

Uli Plank

Corporate Loop Example

by Larry Applegate

Presented here is the Corporate Loop example project from tfdvd.com reauthored in TFDVDEdit 2.

» Click here to download example files for this project.

This project plays up to four tracks continuously, such as for a trade show, allowing the user to choose which combination of tracks to play. The tracks, if played, are always played in the same sequence.

For this example we nuked the abstraction layer commands before beginning. We also used a binary bit for each title, which makes the implementation much easier than other methods.

For this project we used 7 registers, as follows:

R0  Scratch
R1  Menu number, 1, 2, or 3
R2  Button number for menu 1, 1-3
R3  Button number for menu 2, 1-6
R4  Button number for menu 3, 1-11
R5  Current track bit mask, 1, 2, 4, or 8
R6  Play list bit mask, any 0-15

This project remembers the last button number activated, not counting the links between menus, for each menu. This results in each menu showing the last button that was used for that menu when it is reentered for any reason.

The values of 1, 2, 4, and 8 are significant because they are powers of two, which also means that they each have only one bit present. In binary they are:

1  0001
2  0010
4  0100
8  1000

What we are going to do with the play list mask is to turn on the appropriate bit for each title that we want to play. This yields the following possible play lists:

0  0000  Play nothing (not used in our example)
1  0001   Play title 1
2  0010  Play title 2
3  0011  Play titles 1 and 2
4  0100  Play title 3
5  0101  Play titles 1 and 3
6  0110  Play titles 2 and 3
7  0111  Play titles 1, 2, and 3
8  1000  Play title 4
9  1001  Play titles 1 and 4
10  1010  Play titles 2 and 4
11  1011  Play titles 1, 2, and 4
12  1100  Play titles 3 and 4
13  1101  Play titles 1, 3, and 4
14  1110  Play titles 2, 3, and 4
15  1111  Play all four titles

So, for each play button in each menu, all we need to do is select the correct value from the above list, and the Boolean logic in just two PGCs will do the rest.

First Play PGC

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:First Play PGC:"
1:  Set r1 = 1
2:  Set r2 = 1
3:  Set r3 = 1
4:  Set r4 = 1
5:  Jump VTS 1 Menu Root

This initializes the menu and button registers to their default values, then jumps to the root menu in VTS 1. If you check the PGCs in VTS 1, only one menu will have the root designation. The other three PGCs, which are the three actual menus, are designated non-entry PGCs.

VTS 1 VTSM PGC 1 (root)

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Video Title Set Menus:Title Set 1 Menus:English (4 menus):VTSM PGC 1:"
1:  if  r1 <= 1 then Link PGC 2
2:  if  r1 == 2 then Link PGC 3
3:  Link PGC 4

The root menu links to one of the three actual menus, depending on the value of r1.

VTS 1 VTSM PGC 2 (non-entry)

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 2 (1 program):"
1:  Set r0 = r2
2:  Set r0 *= $400
3:  Set Button r0
4:  Set r1 = 1

This is the Title Menu, which offers three choices: to loop all of the tracks, to choose a single track, or to choose multiple tracks.

The pre commands decode the button number in r2 and highlights that button. Remember the button number must be multiplied by 1024 before storing in the system parameter, SPRM 8. Then it sets the menu number to 1, the first menu.

In DVDSP 2 we hooked up all of the buttons in all of the menus to something, even though we threw away the abstraction layer commands that were generated from doing this. This has the useful side-effect of generating a LinkTailPGC button command in each menu Nav pack, which transfers control to the PGCs post commands when the button is activated.

#PostCommands from "CorporateSimple:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 2 (1 program):"
1:  Set r2 = Button
2:  Set r2 /= $400
3:  if  r2 != 1 then GoTo Line 7
4:  Set r5 = 1
5:  Set r6 = $f
6:  Jump VTS TT 1
7:  if  r2 != 2 then GoTo Line 9
8:  Link PGC 3
9:  if  r2 != 3 then GoTo Line 11
10:  Link PGC 4
11:  Jump First Play

This reads the button number that was activated back out from SPRM 8 and divides by 1024 to get the simple button number. This is done directly in r2 so that the next time we enter this menu the same button that was activated will be selected when the menu is displayed.

Then if the first button was activated, (Loop All tracks), it sets r5 to 1. This means start at track 1, which is designated by the binary value 0001.

R6 is set to 15, all four bits on. This means play all four tracks.

It then jumps to the first title within the current VTS, which is VTS 1. This is because DVDSP 2 always puts all 4:3 menus in VTS 1. Since the track we want is also in the same VTS, we can jump there directly instead of navigating through the Video Manager domain which we will do when the target track is not in VTS 1.

If button 2 or 3 was activated, we link to another menu. The Jump to First Play is a safety valve in case the register had a value we didnt expect. It would be better practice to create a debugging menu for this purpose, so you could know for sure that you had a scripting error.

VTS 1 VTSM PGC 3 (non-entry)

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 3 (1 program):"
1:  Set r0 = r3
2:  Set r0 *= $400
3:  Set Button r0
4:  Set r1 = 2

This menu offers to loop each one of the four tracks, link to a multiple track loop menu, or return to the title menu.

It uses r3 to choose which button to highlight, and sets r1 to indicate we are on the second menu.

#PostCommands from "CorporateSimple:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 3 (1 program):"
1:  Set r0 = Button
2:  Set r0 /= $400
3:  if  r0 != 5 then GoTo Line 5
4:  Link PGC 4
5:  if  r0 != 6 then GoTo Line 7
6:  Link PGC 2
7:  Set r3 = r0
8:  if  r0 != 1 then GoTo Line 12
9:  Set r5 = 1
10:  Set r6 = 1
11:  Jump VTS TT 1
12:  if  r0 != 2 then GoTo Line 16
13:  Set r5 = 2
14:  Set r6 = 2
15:  Jump VMG PGC 2
16:  if  r0 != 3 then GoTo Line 20
17:  Set r5 = 4
18:  Set r6 = 4
19:  Jump VMG PGC 2
20:  if  r0 != 4 then GoTo Line 24
21:  Set r5 = 8
22:  Set r6 = 8
23:  Jump VMG PGC 2
24:  Jump First Play

When the user activates a button, control is transferred to the post commands. Here we test which button was hit by using r0, not r3. This is so we do not destroy the current contents of r3 if we choose to link to another menu. That way, this menu will always remember the last single track that was played from this menu, or be set to the default of Track 1.

First we check for the link to the multiple tracks menu, or to return to the previous (Title) menu. Once we are sure that it is neither of these, we go ahead and set r3 for the next time.

Then for each of the possible four tracks, we set both r5 and r6 to the same value: 0001, 0010, 0100, or 1000. This will result in a single track looping forever or until the user hits a button on the remote. (We expect the Menu or Title button). We then link to the first of the Boolean logic PGCs.

VMG PGC 2

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Manager Menus:English (3 menus):VMG PGC 2:"
1:  Set r0 = 1
2:  if  r5 & r0 then Jump TT 1
3:  Set r0 = 2
4:  if  r5 & r0 then Jump TT 2
5:  Set r0 = 4
6:  if  r5 & r0 then Jump TT 3
7:  Set r0 = 8
8:  if  r5 & r0 then Jump TT 4
9:  Jump First Play

Each pair of commands tests for the presence of a single bit in the current track register. It does so by doing a Boolean logical and with the value representing the bit we want to test for.

Because of restrictions in the DVD Spec on the format of commands, we must first put the value to be tested in another register; we cannot test directly for the value 1, for example, when combined with the Jump TT command.

So, what does r0 & r5 mean? It means, does at least one bit in the same position exist in both registers. It doesnt matter which register is named first or second, r0 & r5 means the same thing as r5 & r0.

Since we are concerned with only only four tracks, we can ignore the zeros that are in the high order bits of the two registers. Also since we know that only one bit can be present in each register (we deliberately set it up that way), the only possible legal values for r5 are:

0001
0010
0100
1000

The logical and says that the bit in each position is compared with the same bit in the other register, and if both bits are on, the resulting bit is set on. So we can see that in the very restricted case we are testing, the & comparison has the same result as the == comparison. We will give more examples in VMG PGC 3 when we get to it.

So, after testing the current track register, we jump to one of the Tracks. Each track is set up in exactly the same way, it plays through once and then control is passed to its post commands. Each track has exactly one and only one post command, and no other commands of any type.

VTS 1 PGC 1 TT1

VTS 2 PGC 1 TT1

VTS 3 PGC 1 TT1

VTS 4 PGC 1 TT1

#TFDVDEDIT Commands V1
#PostCommands from "CorporateSimple:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:  Call VMG PGC 3 resume C1

This transfers control to the Video Manager routing PGC, and saves the current resume point, cell 1 of the track.

VMG PGC 3 (non-entry)

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Manager Menus:English (3 menus):VMG PGC 3:"
1:  Set r5 *= 2
2:  if  r5 <= r6 then GoTo Line 4
3:  Set r5 = 1
4:  if  r5 & r6 then Link PGC 2
5:  GoTo Line 1

This is the other Boolean logic PGC. Its purpose is to check the tracks in sequence starting from the track just played and find the next track to play.

First we multiply the current track value (remember, 1, 2, 4 or 8) by two. This is what is known in Boolean programming as shifting the register left by one position. Here are the possible results:

Before     Shifted left

0001         0010
0010         0100
0100         1000
1000         10000

The next command compares the result to the play list mask, which can only have a value from 1 to 15. Since the play list mask must have contained the track just played, this command will branch (goto line 4) only if the result is possibly within the highest track number in the play list.

For example, if the play list is 0011 (play tracks 1 and 2) and the current track was 0001, it is becomes 0010 and that is less than 0011, so it branches. If the current track was 0010, it becomes 0100 and that is greater than 0011, so it does not branch.

If it did not branch, the current track is set to 0001, to start the testing all over again.

The next line does a logical and of the current track and the play list. If the bit in the current track is on in the play list, it links to PGC 2 and plays that track. If not, it repeats the entire command list.

Since we know the play list contains at least one bit, the loop is guaranteed to find a bit every time, even if it is the same bit it just played. (A single track was selected).

This concludes the Boolean logic. Once you understand these methods, they can be applied to many DVD authoring problems.

VTS 2 VTSM PGC 1

VTS 3 VTSM PGC 1

VTS 4 VTSM PGC 1

The remaining Video Title Set Menu PGCs are all identical, and are used to direct navigation back to the right place when the user hits the Menu Key on the remote. Note that these are all root menus.

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Video Title Set Menus:Title Set 4 Menus:English (1 menu):VTSM PGC 1:"
1:  Jump VMG PGC 4

Since the DVD Spec prohibits direct jumps between Video Title Sets, we jump to the Video Manager in order to jump back to the root menu of VTS 1.

VMG PGC 4

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Manager Menus:English (4 menus):VMG PGC 4:"
1:  Jump VTS 1 Menu Root

The only remaining PGC in the project is the Video Manager Title Menu, which is where navigation is directed when the user hits the Title Key on the remote.

VGM PGC 1

#TFDVDEDIT Commands V1
#PreCommands from "CorporateSimple:Manager Menus:English (4 menus):VMG PGC 1:"
1:  Set r1 = 1
2:  Jump VTS 1 Menu Root

We add the wrinkle here to set the current menu register r3 to the first menu, the Title Menu. Thus the Title Key on the remote will always take you back home, and the Menu Key on the remote will take you to the last menu visited.

Also notice that the Menu Key will toggle between playing the selected titles and returning to the menu where those titles were selected. That is because of the Call VMG PGC 3 resume C1 command that was executed after the playing of each track that command sets up the SPRMs to return execution to that track and cell when the Menu Key is hit. This example is much simpler than the abstraction layer version would have been, because only one set of variables are used, the memory variables are always self-consistent and represent a valid state of execution, and the commands are able to branch (jump, call, link, or goto) exactly the area they wish to.

Although this example uses seven registers, it could have compressed r1 through r4 into a single register if registers had been at a premium, using Boolean methods of bit extraction and replacement. A later example will illustrate these methods.

Larry

DVD Studio Pro 2.0 Abstraction Layer

The DVD Studio Pro 2.0 Abstraction layer uses a highly structured template approach. Many of the command sequences are identical in every project, or only differ in the values tested for at the end of the sequence.

Registers

The abstraction layer uses eight general registers (GPRMs) to keep track of things, registers 0 thru 7. It uses the other 8 GPRMs , registers 8 thru 15, for user scripts. The user scripts in DVDSP 2 refer to these registers as GPRM 0 thru GPRM 7, but they are actually r8 thru r15 in the DVD Spec commands.

R0 and r1 are used as scratch registers, which means that command sequences use them to decode what is in other registers so that the other registers are not destroyed. Register 1 is also sometimes used as a parameter passed from one PGC to another. Neither of these registers is ever relied upon between video plays. This means that TFDVDEdit 2 authors are free to use these registers as scratch or parameter registers also.

R2 is used as a parameter. Much of the code that tests r2 is never reached by the projects that I have checked. This would imply that DVDAfterEdit authors could use r2 to retain values between video plays, as long as their code is the first code executed after the play, and they clear it before going to abstraction layer code.

R3 is usually the Title Number.
R4 is probably the Sub picture stream number.
R5 is usually the Chapter Number.

R6 is the GetLastItem register. The abstraction layer code sets r6 to a unique value before playing video. Its use will be covered as we encounter it in the command sequences.

R7 is often set to be the same as r6. No code that tests r7 has been found yet.

All of the conclusions above and below are subject to change as we learn more about the abstraction layer.

First Play PGC

The first play PGC jumps to the asset that the user selected in DVDSP 2, after setting some register values that the abstraction layer will test.

Manager Menus

Every DVDSP 2 project has exactly eight Manager Menus, which are always used in the same way. Often a menu will be blank (contain no commands) if the feature supported by that menu is not used. So far there are no examples of code in PGCs 3, 5, or 7, though there are links to those PGCs that are never executed, since the register tested never contains the appropriate value to cause the link.

VMG PGC 1

This PGC is often similar to the first play PGC.

VMG PGC 2

This PGC is always the same in every project, except for the number of Titles in the project. A project with 6 Titles would read thus:

#Selected from PlayAllProject:Manager Menus:English (8 menus):VMG PGC 2:
1: Set r1 = 0
2: Set r2 = 0
3: if r3 & $ff00 then GoTo Line 5
4: GoTo Line 8
5: Set r5 = r3
6: Set r5 /= $100
7: Set r3 &= $ff
8: if r3 >= 6 then Link PGC 3
9: Set r0 = 1
10: if r0 == r3 then Jump TT 1
11: Set r0 = 2
12: if r0 == r3 then Jump TT 2
13: Set r0 = 3
14: if r0 == r3 then Jump TT 3
15: Set r0 = 4
16: if r0 == r3 then Jump TT 4
17: Set r0 = 5
18: if r0 == r3 then Jump TT 5
19: Jump First Play

We will examine this PGC in detail:

1: Set r1 = 0
2: Set r2 = 0

These instructions clear parameters that might be checked later.

3: if r3 & $ff00 then GoTo Line 5
4: GoTo Line 8

Line 3 tests to see if there is anything in the high-order byte of r3. If there is, it does further decoding at line 5. If there is not, it assumes that r5 and r3 are already fully prepared by the code that came here, and goes to the code which follows the decoding.

5: Set r5 = r3
6: Set r5 /= $100

This moves the high byte of r3 to r5, putting it in the low byte.

7: Set r3 &= $ff

This isolates the Title Number to be a value between 0 and 255.

8: if r3 >= 6 then Link PGC 3

This says if the title number is too large, go to PGC 3, which is empty. Presumably PGC3 could contain error recovery code, or could do something useful with values greater than 99 but less than 256, since the DVD Spec allows only 99 titles.

9: Set r0 = 1
10: if r0 == r3 then Jump TT 1
11: Set r0 = 2
12: if r0 == r3 then Jump TT 2
13: Set r0 = 3
14: if r0 == r3 then Jump TT 3
15: Set r0 = 4
16: if r0 == r3 then Jump TT 4
17: Set r0 = 5
18: if r0 == r3 then Jump TT 5

Each pair of commands checks for a particular Title Number in r3 and jumps to that Title if the number matches.

19: Jump First Play

One possible value of r3 is unaccounted for zero. In that case the DVD starts over at the First Play.

VMG PGC 4

This PGC jumps to a particular VTSM PGC depending on the value of r1. Sometimes there is only one interesting PGC, so r1 is not tested in that case. Often this PGC is called by the Post Commands of a Title. It can also be linked to from VMG PGC 8. Here is an example:

#Selected from PlayAllProject:Manager Menus:English (8 menus):VMG PGC 4:
1: Set r5 = 0
2: Set r2 = 0
3: if r1 >= 4 then GoTo Line 5
4: Jump VTS 1 VTS TT 1 Menu Root
5: Jump VTS 5 VTS TT 1 Menu Root
6: Jump First Play

Obviously the Jump First Play can never be reached. There is likely a more complex situation that could result it being used.

VMG PGC 6

This PGC is very similar to PGC 4, but uses r2 to determine the branch. Here is an example:

#Selected from PlayAllProject:Manager Menus:English (8 menus):VMG PGC 6:
1: Set r5 = 0
2: Set r1 = 0
3: if r2 >= $c then GoTo Line 5
4: Jump VTS 1 VTS TT 1 Menu Root
5: Jump VTS 5 VTS TT 1 Menu Root
6: Jump First Play

VMG PGC 8

This is the longest script in the abstraction layer, but we have not found a link to it yet in the simple projects we have examined. I deleted it from a project and verified to make sure that it wasnt referenced.

It is identical in all projects except for some of the values tested. It is particularly interesting for its splitting up of r2 into subfields, so we will examine it in detail.

#Selected from PlayAllProject:Manager Menus:English (8 menus):VMG PGC 8:
1: Set r0 = r2
2: Set r2 = 0

This moves the value of r2 to r0 in order to test it, and clears r2. The clearing of r2 is probably so that the same parameter would not be processed again if we came back here.

3: if r0 != $fff0 then GoTo Line 5
4: Link Resume

This tests for a single value in order to do a resume.

5: Set r3 = r0
6: Set r3 &= $f800
7: if r3 != $f800 then GoTo Line 15

This uses r3 as a scratch register to test r0, which originally came from r2. Then the lower 11 bits of r3 are masked off, so that we can test the higher 5 bits. If they are not all on, we skip over a fairly long section of code.

8: Set r3 = 0
9: Set r2 = r0
10: Set r2 &= $7ff
11: if r2 >= $c then Link PGC 7
12: Link PGC 6
13: Nop
14: Nop

We take the 11 bits that were masked off and isolate them into r2. Then if the value in them is greater than 12, we link to PGC 7. Otherwise we link to PGC 6. (Ignore the Nops). Since we havent seen an example of PGC 7 yet, we are missing a lot of the details.

15: Set r3 = r0
16: Set r3 &= $c000
17: if r3 != $c000 then GoTo Line 30

We now test to see if the high order 2 bits are on. Notice that we tested for the high order 5 bits earlier, which would have taken precedence.

18: Set r3 = 0
19: Set r3 = r0
20: Set r3 &= $3f80
21: Set r3 /= $80
22: Set r5 = r0
23: Set r5 &= $7f
24: Set r5 += 1
25: Link PGC 2
26: Nop
27: Nop
28: Nop
29: Nop

We isolate 7 bits in the middle, and move them to the lower part of r3. That must be a Title Number, since it takes 7 bits to show a value from 1 to 99. (We also noticed a Title Number in r3 in another PGC, earlier).

We then isolate the Chapter Number and put it in r5, and link to PGC 2. Notice that the value in the register was actually the chapter number minus one, since it added one to it.

If we look back at PGC 2, we will see that it uses the value in r3 to decide which Title to jump to. If we look ahead to the Title Set PGCs, we will see they use r5 to decide which Chapter to jump to.

30: Set r3 = 0
31: Set r1 = r0
32: Set r1 &= $ffe0
33: Set r1 /= $20
34: Set r4 = r0
35: Set r4 &= $1f
36: Set r4 += 1
37: if r1 >= 4 then Link PGC 5
38: Link PGC 4

The remaining case is when the two high order bits are not both on. The value is split into the high-order 11 bits in r1 and the lower 5 bits in r4. R4 is probably the sub picture stream number. Then depending on the value in r1, it links to either PGC 5 or PGC 4.

This concludes the Video Manager PGCs for now. Next will be an analysis of the Video Title Set Menu PGCs.

Editing in DVDAfterEdit

by Larry Applegate

You can edit most items in the right-hand pane of the window simply by clicking on their current value to get a text editing field, and typing a new value. Editing actions such as copy and paste work within these text fields as you expect.

In addition, some items within expandable groups have additional editing actions, to allow you to manipulate the groups as a whole, or to manipulate several items at once. The following kinds of items have additional editing actions: Prohibited User Ops, ISRC, Button Highlights, Colors, Color Schemes, Button Navigations, and Pre/Post/Cell Commands.

Using the Clipboard

This section applies to Prohibited User Ops, ISRC, Button Highlights, Colors, Color Schemes and Button Navigations. These are called copyable items, because they can all be copied to the clipboard, and of course pasted again later. Pre/Post/Cell Commands work a little differently, and are discussed in a separate section.

You place a copyable item on the clipboard by selecting it and choosing Copy from the Edit menu. You paste it by selecting any item of the same type and choosing Paste Over from the Edit menu.

Copying Multiple Items

You can also copy multiple Colors, Color Schemes and Button Navigations to the clipboard. First, select the ones you want (they must all be in the same item list): click to select, shift-click to select multiple items and command-click to select or unselect individual items. Note that the selection does not have to be contiguous, meaning you can have selected items with unselected items between them in the list. Then choose Copy from the Edit menu to place all of the selected items on the clipboard.

To paste multiple items, first select the items to you want to change. Again, they must all be in the same item list, but they don't have to be contiguous. Then choose Paste Over from the Edit menu, and the selected items are replaced in turn by the items on the clipboard. The first selected item is replaced by the first selected clipboard item, and so on. If there are fewer items selected than are on the clipboard, the excess clipboard items don't have any effect. If there are more items selected, the excess selected items aren't changed.

Copying Item Groups

Colors, Color Schemes and Button Navigations are arranged in groups (of 16, 3 and 36 items, respectively). You can copy and paste the entire group by selecting just the group item (that is, the one that expands to show the individual Colors, Color Schemes or Button Navigations) and using Copy and Paste Over from the Edit menu. Copying an entire group is no different from copying all of the component items. So, you can copy a group and paste over another group, or over individual items (remember: excess items are ignored when pasting), and you can copy all of the individual items and paste over a group item.

There is just one special consideration to keep in mind when doing this. You can only paste over a group item if there are enough individual items on the clipboard. This means you can only paste a Colors group item if you copied all 16 Colors in some other group (or if you copied a Colors group item, which amounts to the same thing). Similarly, you have to copy all 3 Color Schemes to be able to paste over a Color Schemes group item, and copy all 36 Button Navigations to paste over a Button Navigations group.

Paste Into

When you copy items from the right pane of the window to the clipboard, you can paste them into certain items in the left pane. Colors and Prohibited User Ops can replace similar items in program chains (PGCs) and dummy PGCs, while all of the kinds of copyable items can be pasted into navpacks. Simply select a right-pane item, choose Copy from the Edit menu, then select the PGC or navpack you want and choose Paste Into from the Edit menu.

For Colors, Color Schemes and Button Navigations, Paste Into works with item groups, which were discussed in the previous section. You have to select the entire group (the group item, or all of the items in the group) in order to be able to use Paste Into.

Paste Repeated

Sometimes you might want to paste a clipboard item more than once. For example, you might want to copy a single Color to the clipboard, then use it to replace all 16 Colors in a group. Or, you might want to copy a Color Schemes group, and paste it into multiple navpacks.

Paste Repeated on the Edit menu allows you to do these things. It can be used whenever Paste Over or Paste Into is allowed, if you have more items selected than are on the clipboard. When you choose Paste Repeated from the Edit menu, items from the clipboard are pasted over or into what is selected until they are all used. Then the items on the clipboard are used again for the next selected items, and again for the next, until all of the selected items have been changed.

Paste Deeply Into

Sometimes you might want to paste a clipboard item from a Nav Pack into all of the Nav Packs for (another) cell. Paste Deeply Into allows you to do this.

For copying and pasting of Nav Pack information, you must copy the information from a single Nav Pack. Then you can select a contiguous range of Nav Packs, and Paste Repeated into them as described above. For Paste Deeply Into, you may choose one or more cells, without having to open up the individual Nav Packs and select them, and then paste (Deeply) the Nav Pack info into all Nav Packs in those cells. You may also choose one or more Programs in order to Paste Deeply Into all Nav Packs in all cells of the Programs chosen. This function capability is NOT implemented at the PGC level or above.

For Button Highlight Information, Pasting Deeply Into will set the Button Highlight Status on the first Nav Pack of each cell to "All New Info", and subsequent cells to "Use Previous Vobu".

Pre/Post/Cell Commands

Pre/Post/Cell Commands can be copied and pasted in much the same way as other copyable items, but since they can also be deleted and inserted, you have more editing actions available to you: Paste After, Edit Command, Insert Command and Delete Command, as well as unlimited Undo and Redo.

Copy, Cut and Paste

You can select one or multiple Commands (Pre, Post or Cell) in a list of commands, and choose Copy from the Edit menu to place them on the clipboard. As before, your selection does not have to be contiguous. If you choose Cut from the Edit menu instead of Copy, the selected items are deleted after being copied to the clipboard.

You paste Commands by selecting one or more Commands in a list and choosing Paste from the Edit menu. Note that the menu says Paste instead of Paste Over, because pasting Commands is more like the regular text pasting you're already familiar with: the contents of the clipboard replaces whatever is selected. Depending on how many Commands are on the clipboard and how many selected, you may end up with more or fewer Commands in the list.

The Pre, Post or Cell Commands group item can be copied to the clipboard all of the Commands in the list are copied but currently, you cannot paste over a group item, but must select the individual Commands instead. This also means that you cannot paste Commands directly into PGCs in the left pane of the window. Instead, you must navigate to the PGC you want and select the appropriate Commands in the right pane before pasting.

Paste After

In normal text editing, you can always paste text from the clipboard between any two characters by clicking between them to place a flashing insertion point. Currently, there is no way to set an insertion point between two Commands in the right pane, so you have to follow a different strategy to paste Commands between existing Commands.

First, select the Command after which you want to paste the contents of the clipboard. To paste before the first command in a list, or into an empty list, just select the Commands group item at the top of the list. Then choose Paste After from the Edit menu, and the Commands on the clipboard are inserted after the selected item. (If you happened to have selected more than one item, the clipboard contents are inserted after the last selected item.)

Pasting Non-Contiguous Selections

If you have a non-contiguous selection (that is, unselected Commands interspersed between selected ones), its not obvious where you would expect pasted Commands to be placed. What actually happens is governed by a simple rule:

The first Command on the clipboard replaces the first selected Command, and so on until there are no more Commands on the clipboard or no more selected Commands. Then, if there are any remaining Commands on the clipboard, they are pasted after the last selected Command. Or, if there are any remaining selected items, they are deleted.

In fact, this same rule applies to all pasting of Commands, because it produces the expected result if the selection is contiguous.

Paste Repeated

Paste Repeated on the Edit menu works for Commands exactly as it does for other copyable items. Keep in mind that the number of Commands never changes as a result of this action, because only the selected items are affected.

Insert and Delete

Inserting a Command into a list is a little like pasting after: select the Command you want to insert after (or the Commands group item to insert before the first command), and choose Insert Command from the Edit menu and a Nop command is placed in after the selected item.

To delete Commands, select the ones you want to remove from the list and choose Delete Command from the Edit menu. The keyboard shortcut for this action is the Delete key (either Delete key if your keyboard has two).

Insert Command and Delete Command are also available on a contextual menu. After making a selection, control-click with your mouse (or just click the right button if your mouse has more than one button), and a menu will pop up from which you can choose the desired editing action.

Edit

You can edit a Command in one of two ways: with popup menus and with the Command assembler. With popup menus, you construct the Command by choosing the various parts of it from menus, and the menus change according to what you choose. With the Command assembler, you type the whole Command in a text field.

To start popup editing, expand the Command item by clicking on its expansion icon at the left of its command number. The item doesn't exactly expand, but it replaced by a series of popup menus. You can alternatively start popup editing by selecting the Command and choosing Edit Command from the contextual menu described in the previous section. Click on some other item to return to normal.

To start the Command assembler, just click on the text of the Command itself. Press Return or click elsewhere to return to normal.

Undo and Redo

All of the editing actions that change Commands edit, insert, delete, cut, paste and paste after are undo-able. Just as copying and pasting of Commands is not exactly like normal copying and pasting, undoing and redoing of Commands is not exactly like normal undoing and redoing.

After you make a change to Commands, you can undo the change by choosing Undo from the Edit menu. If you've made a series of changes, you can undo them one by one to go back to any previous state of the Commands. Once you've undone changes, you can redo them one by one, if you wish, by choosing Redo from the Edit menu.

Undoing is unlimited: you can undo all of the actions you made since you opened the VIDEO_TS file shown in the window.

Here's how undoing Commands is different from normal undoing: undoing is separate for each list of Commands. Undo doesn't function until you select a Command list that you've changed (or any Command in it), and then it only undoes the changes you've made to that list. If you select a different list, you can only undo changes you made to that list, and so on. However, it makes no difference how often you select something else and come back to a changed list all of the changes you made in that list since opening the window will be there waiting for you to undo or redo them.

From Simple to Play All: A DVDSP 2 Abstraction Layer Example

In analyzing the DVDSP 2 abstraction layer, it is easiest to start with a very simple project. First we will step through the Simple project on paper and examine how the abstraction layer commands accomplish their navigation. Then we will add commands with DVDAfterEdit to implement a Play All button, using mostly the abstraction layer registers themselves.

This document contains two sections: an analysis of the DVDSP 2 abstraction layer, and instructions for turning a VIDEO_TS folder built from the Simple project into the Play All version.

» Click here to download example files for this project.

You may skip the first section if all you want to do is use this project as a template; the instructions alone are sufficient to achieve this goal.

First Play PGC

The Simple project contains the following First Play commands:

#DVDAfterEdit Commands V1
#Selected  from "Simple:First Play PGC:"
1:	Set r5 = $2000
2:	Set r4 = 0
3:	Set r1 = 1
4:	Jump VTS 1 VTS TT 1 Menu Root

Examining the menus for Title Set 1, we see that VTSM PGC 1 has the Menu Type designation root. So this must be the target. It says:

#DVDAfterEdit Commands V1
#Selected  from "Simple:Video Title Set Menus:Title Set 1 Menus:English (7 menus):VTSM PGC 1:"
1:	if  r5 == $4000 then Link PGC 3
2:	Set r5 = 0
3:	if  r1 != 0 then Link PGC 6
4:	if  r2 != 0 then Link PGC 5
5:	Set r0 = VTS title
6:	Set r0 *= $100
7:	Set r0 |= Part title
8:	Nop
9:	Nop
10:	Nop
11:	Nop
12:	Nop
13:	Nop
14:	Nop
15:	Nop
16:	Nop
17:	Nop
18:	Link Resume

Following through the commands, r5 is not $4000, so we do not branch. We set r5 to 0. r1 is 1, so link to PGC 6. (That will be VTSM PGC 6 in the same title set).

So far we have the following values for registers which are non-zero:

R1 1

Remember that all registers are initially zero when execution begins. PGC 6 says:

#DVDAfterEdit Commands V1 #PreCommands from "Simple:Video Title Set Menus:Title Set 1 Menus:English (7 menus):VTSM PGC 6:" 1: Set r0 = r1 2: Set r1 = 0 3: Nop 4: Nop 5: Nop 6: Nop 7: Nop 8: Nop 9: Nop 10: Nop 11: Nop 12: if r0 == 1 then Link PGC 7

We test r1 by moving it to r0 first then clearing r1. Now all registers except r0 are zero. Remember that r0 is the scratch register, so we never need to remember it for very long. We link to PGC 7.

Notice that PGC 7 actually contains a program and a cell (it has video). If we preview it, we see the Title Menu. Its pre commands are:

#DVDAfterEdit Commands V1
#PreCommands  from "Simple:Video Title Set Menus:Title Set 1 Menus:English (7 menus):VTSM PGC 7 (1 program):"
1:	Nop
2:	Nop
3:	Nop
4:	Nop
5:	Nop
6:	Set r6 = $20
7:	Set r0 = r4
8:	if  r0 != 0 then GoTo Line 10
9:	Set r0 = 1
10:	Set r0 &= $3f
11:	Set r0 *= $400
12:	Nop
13:	Set r3 = 1
14:	Set Button r0
15:	Set r1 = 0

We first save a GetLastItem value in r6. Then we move r4 to r0, and see if it had anything in it. It didnt, so we load a value of 1.

We make sure that r0 has a value between 0 and 63. (It will actually be between 1 and 36 to be valid, but we dont check this). Then we multiply it by 1024, since the spec likes to put button numbers in the high part of the word. We set the button number into SPRM 8. We set r3 and clear r1. We now have:

R3	1

We have finished the pre commands with no obstacles (we didnt link out to anyplace else), so we display the title menu with button 1 selected.

Now let us look at the title menu itself. It has one program, one cell, and two nav packs. The button navigation is identical in the two nav packs, so lets not worry about the fact that there are two.

You will see that each of the first four buttons has a LinkTailPGC command. This will cause the post commands of the current PGC to be executed if the button is activated. The fifth button (the Play All) has a Nop, because it is not yet hooked to anything. We will hook it up later, but to a different PGC.

Let us now examine the VTS Menu post commands:

#PostCommands  from "Simple:Video Title Set Menus:Title Set 1 Menus:English (7 menus):VTSM PGC 7 (1 program):"
1:	Set r3 = 0
2:	Set r0 = Button
3:	Set r0 /= $400
4:	if  r0 != 1 then GoTo Line 8
5:	Set r3 = $101
6:	Jump VMG PGC 2
7:	Nop
8:	if  r0 != 2 then GoTo Line 12
9:	Set r3 = $102
10:	Jump VMG PGC 2
11:	Nop
12:	if  r0 != 3 then GoTo Line 16
13:	Set r3 = $103
14:	Jump VMG PGC 2
15:	Nop
16:	if  r0 != 4 then GoTo Line 20
17:	Set r3 = $104
18:	Jump VMG PGC 2
19:	Nop
20:	if  r0 != 5 then GoTo Line 24
21:	Set r3 = $101
22:	Jump VMG PGC 2
23:	Nop
24:	Nop

First we clear r3. Now all of the important registers are zero again. We fetch the button number out of the SPRM. (We convert it back to 1 thru 36 by dividing by 1024).

Now we have five sets of four commands which test for buttons one through five and jump to Video Manager PGC 2 with a value containing the button number in the low part of r3 and a one in the high byte of the word.

For button five it uses button number 1, which will jump to the first title for the play all.

Now let us look at VMG PGC 2:

#PreCommands  from "Simple:Manager Menus:English (8 menus):VMG PGC 2:"
1:	Set r1 = 0
2:	Set r2 = 0
3:	if  r3 & $ff00 then GoTo Line 5
4:	GoTo Line 8
5:	Set r5 = r3
6:	Set r5 /= $100
7:	Set r3 &= $ff
8:	if  r3 >= 5 then Link PGC 3
9:	Set r0 = 1
10:	 if  r0 == r3 then Jump TT 1
11:	Set r0 = 2
12:	 if  r0 == r3 then Jump TT 2
13:	Set r0 = 3
14:	 if  r0 == r3 then Jump TT 3
15:	Set r0 = 4
16:	 if  r0 == r3 then Jump TT 4
17:	Jump First Play

Remember if we get here we have a value of $101, $102, $103, or $104 in r3.

We test r3 to see if there is anything in the high order byte. There is, so we go to line 5. We take that value and move it to r5 and divide it by 256, resulting in r5 = 1 (the one that was in the high byte). We then and off the high byte and leave just the button number in r3.

Then we have a series of tests which result in going to the appropriate title for each button, TT 1 thru TT4. Since we know we came here with a valid button number, it can never take the Jump First Play branch.

Now let us look at the Video Manager in the left pane, and then expand the Title Play Map. We see that TT1 is VTS 1, the one and only chapter, TT2 is VTS 2, etc. etc.

Now let us look at a Title. Well start with TT1:

#PreCommands from "Simple:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:	Nop
2:	Nop
3:	Nop
4:	Nop
5:	Nop
6:	Set r6 = $c080
7:	Set r7 = r6
8:	Set r0 = r5
9:	Set r5 = 0
10:	Set r1 = 0
11:	Set r2 = 0
12:	if  r0 == 1 then Break

We set the GetLastItem register, r6, with a unique value. We also move the same value to r7. Line 12 is pointless since all a Break accomplishes is to skip any commands that follow and get right to the video display. At this point we have:

R3	$101
R6	$c080
R7	$c080

We now play Track 1. The other three titles pre commands are identical TT1 except for the GetLastItem value.

There are no cell or button commands in the tracks, so when the track is finished it automatically goes to the PGCs post commands.

#PostCommands from "Simple:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:	Set r4 = 0
2:	Set r1 = 1
3:	Call VMG PGC 4 resume C1

We now have the following register values:

R1	1
R3	$101
R6	$c080
R7	$c080

Lets see what PGC 4 says:

#PreCommands from "Simple:Manager Menus:English (8 menus):VMG PGC 4:"
1:	Set r5 = 0

2:	Set r2 = 0
3:	if  r1 >= 2 then GoTo Line 5
4:	Jump VTS 1 VTS TT 1 Menu Root
5:	Jump VTS 4 VTS TT 1 Menu Root
6:	Jump First Play

Since r1 == 1 it will jump to the root menu for VTS 1: (Weve seen this before!)

#PreCommands from "Simple:Video Title Set Menus:Title Set 1 Menus:English (7 menus):VTSM PGC 1:"
1:	if  r5 == $4000 then Link PGC 3
2:	Set r5 = 0
3:	if  r1 != 0 then Link PGC 6
4:	if  r2 != 0 then Link PGC 5
5:	Set r0 = VTS title
6:	Set r0 *= $100
7:	Set r0 |= Part title
8:	Nop
9:	Nop
10:	Nop
11:	Nop
12:	Nop
13:	Nop
14:	Nop
15:	Nop
16:	Nop
17:	Nop
18:	Link Resume

We can see that this will go to PGC 6, because r1 is not zero. Then PGC 6 will go to PGC 7, and r1 will be cleared.

Then PGC 7 will display the title menu again, highlighting button 1 because it is the default. (r4 is not set to anything).

If we look at the post commands for TT2, TT3, and TT4, they all set r4 to their own button number. Example for TT2:

#PostCommands from "Simple:Video Title Sets:VTS 2:PGC 1 TT 2:"
1:	Set r4 = 2
2:	Set r1 = 1
3:	Call VMG PGC 4 resume C1

So when navigation finally gets to the title menu, it will highlight the button which instigated the last track play.

Some Conclusions

It seems there is a lot of jumping back and forth between domains and PGCs. But the Video Manager and Video Title Set 1 domains are very close together, because there is no video in the Video Manager domain. The PGCs for a given Title Set are also close to each other. So the play head doesnt have to move very far on all these branches between PGCs in the menu domains and PGCs in the title domains.

However, since all DVDSP 2 scripts are placed in the Video Title Set 1 Menus, then any script checking what to do after playing a track must be jumped to from the track, and then it must jump back to the next track to be played. So any scripting we do in the track areas will be more efficient, and will execute more quickly if it can jump directly to the next track, if the DVD Spec commands allow it to do so. Certainly any scripting between markers (chapters) in the same VTS will go much more quickly.

I believe we have enough information to develop a play-all script directly in DVDAfterEdit.

Insert Commands for Play All

It turns out that to make the Play All button completely functional requires us to add 1 command to the title menu PGC, one command each to the title PGCs, and a single routing dummy PGC to the Video Manager Menus, with nine commands. It requires the use of one register.

VTSM PGC 7

In the last section of the post commands insert the following command at line 21:

#Selected  from "Simple:Video Title Set Menus:Title Set 1 Menus:English (7 menus):VTSM PGC 7 (1 program):"
21:	Set r8 = 1

This commands sets the variable that means we are in play all mode, instead of the normal play one track at a time mode.

VTS 1 PGC 1 TT 1

Insert the following command at line 3 of the post commands:

#Selected  from "Simple:Video Title Sets:VTS 1:PGC 1 TT 1:"
3:	 if  r8 == r1 then Call VMG PGC 9 resume C1

Insert this same command at line 3 of the post commands for each of the titles. (TT2, TT3, and TT4).

VMG PGC 9

Insert a dummy PGC in the Video Manager Menus. It will contain the following commands:

#Selected  from "Simple:Manager Menus:English (9 menus):VMG PGC 9:"
1:	Set r0 = 1
2:	 if  r4 <= r0 then Jump TT 2
3:	Set r0 = 2
4:	 if  r4 == r0 then Jump TT 3
5:	Set r0 = 3
6:	 if  r4 == r0 then Jump TT 4
7:	Set r8 = 0
8:	Set r4 = 5
9:	Link PGC 4

The first two commands check to see if we came from TT1, and if so jumps to TT2. The next four commands do similar logic for TT2 and TT3.

When we have finished TT4, the last track, we clear the play all variable (r8). Then we set the button number to 5 so that the title menu will highlight button 5 (the play all button) to indicate that is what we did last. Then it eases back into the abstraction layer at VMG PGC 4.

Pretty simple, huh?

Gain Access To DVD@CCESS, DVDAfterEdit Style

by Ben Weinrach

While finishing a complete re-authoring job the other day, I came to the realization that since the DVD's PGC structure was drastically changed, none of the eight(!) DVD@CCESS links would function. Oops! I procrastinated as long as possible and finally bit the bullet -- I had to figure out how to get these to things work. After some experimentation and testing, I was able to not only restore the DVD@ccess functionality, but completely reassign which PGC's triggered which URL's. This article will show you how to quickly regain control of DVD@CCESS -- the DVDAfterEdit way!

The DVD@CCESS data entries are stored in the VMG's "Text Data" area:

[inline:1=center,data entries stored]

Each link programmed in DVDSP has it's own line in DVDAfterEdit. When a DVD@CCESS-assigned PGC is played, it triggers the command, whether it's a file path, email address, or URL (please refer to the DVDSP manual for more information regarding these functions). Navigation must actually enter the PGC - moving past the Pre-Command area - in order for the command to execute. This is why DVDSP does not permit DVD@CCESS commands to be programmed for a button.

But with DVDAfterEdit, it's easy to make it seem like a button executes the command. Just duplicate the PGC with the desired button, and set the duplicate PGC as not only the button's target, but the DVD@CCESS trigger. Since the NavPacks in the duplicate PGC's are the same as the original, all of the button-commands will remain. To get everything programmed just right may require a bit more tweaking depending on the requirements of the DVD, but it's really that simple.

To program the PGC assignments in DVDAfterEdit, simply click on the field(s) shown in the image above. Content from these fields can be copied & pasted, but entirely new DVD@CCESS entries cannot be created. While this capability may appear in a future DVDAfterEdit update, in most cases the author would probably want to modify the original assets in order to inform the user of additional DVD@CCESS functionality. So how are these assignments derived?

All Bits Revealed!

[inline:2=center,bit definitions for text data]

Above are the bit definitions for the DVD@CCESS text data. Keep in mind that these definitions came about because of research and testing, not from any actual documentation - so the diagram may not be 100% accurate. Just like everything else we edit here, please remember to test thoroughly. Oh, and don't forget to include the DVD@CCESS .exe installer on the disc like the author who's DVD I just finished re-authoring! Otherwise this restored functionality won't work for a lot of potential users...

More Examples:

XESS000200020010060000021http://www.google.com = VTSM 2 PGC 6

XESS000200000010070000020http://www.tfdvd.com = VMG PGC 7

XESS000100000300010020039http://www.dvdafteredit.com/public/102.cfm = VTS 3 PGC 1 PTT 2

Some Notes:

  1. The "version info" should probably be left alone to avoid accidentally offsetting the other bits. The "2" at bit 7 is written as a "1" with DVDSP 1.XX, and you may notice that the DVDSP 2/3 DVD@CCESS .exe installer is a different version than that of DVDSP 1.XX.
  2. If bits 11 and/or 12 have assigned values, then it seems as though that bits 13 and 14 are irrelevant and should be set to "00." DVDSP sometimes puts values in all four of these bits, but if the trigger PGC is a VTSM, then the VTS number doesn't really mean anything - and vice-versa.
  3. I believe bits 13 and 14 are for the VTS #, but if the TT # (title) and VTS # are different and problems persist, try the TT # instead.
  4. If a VMG or VTSM is the trigger, a value of "1" will appear at bit 15. So for example, if a VMG PGC is the trigger, then bits 11 - 14 are set to "0000" and bit 15 is set to "1." Generally, if a VTSM is the trigger, bit 15 is still set to "1," which seems a little redundant.
  5. If the command is set to trigger at a PGC and no PTT # is specified, bits 19 - 21 will be set to "000." If chapter 1 of a track in DVDSP (or PTT 1) is set as the trigger, bits 19 - 21 are set to "001," which should have the same functionality in most cases (all cases?) as if those bits were set to "000."
  6. If a command is set to trigger at a PGC with bits 19 -21 set to "000," any related PTT's with DVD@CCESS commands (at chapter points) will not execute. In order for these following commands to execute, the PGC would need to have bits 19 - 21 set to "001" for chapter 1 (instead of "000" for the beginning of the PGC). Any PTT can execute a command as long as there is no other address associated with the parent PGC with bits 19 - 21 set to "000."
  7. The PTT is the lowest level of the DVD logical structure I found to trigger a DVD@ccess command. Assigning PG #'s or Cell #'s to the "unknown" value at bits 22 and 23 does not seem to have any effect. My guess is that these bits are currently reserved.
  8. Bits 24 and 25 represent the total number of characters for the command, up to a total of 64. If the command/address is in excess of 64 characters, the command will be truncated from right to left. Also, if these bits are set to a value lower than the number of required characters, then the URL, email address, or file path will be incomplete and will not function correctly.
  9. Each possible DVD@CCESS address can only trigger a single command.

Layer Breaks on DVD+-R

Currently there is no way to preserve a desired layer break with programs such as Toast, Nero, or Record Now. This is because they write a disc from a ViDEO_TS folder, which has no layer break information in it. So they choose the layer break algorithmically, giving preference to a non-seamless cell.

This is even less-likely to follow the author's wishes if he or she chooses to make layer 0 larger than layer 1 for Outside Track Path (OTP), since dual-layer media have no such restriction. Also of course if the disc has lots of room there are likely to be more legal candidates for the layer break.

There is a school of thought that if there are multiple non-seamless cells, it may not matter which one is chosen. But I haven't heard this viewpoint from a DVD author, only from a programmer such as myself, so I can't comment on that. At least we can hope that the current popular programs choose a non-seamless cell. Early reports were that some programs chose layer-breaks arbitrarily anywhere in the video stream.

As much as I wish we could do it, currently the only program capable of writing a dual-layer DVD+-R while preserving the desired layer break, except the original authoring program itself where the layer break was chosen, is Gear Pro Mastering Edition. This requires some calculation to figure out the offset of the desired cell, and there is no visual confirmation of the layer break as in DVDAfterEdit Mastering Edition. However if you know where your desired cell is in the video, you can use DVDAfterEdit ME to display the sector number (it is shown in the cell information of every cell on the disc).

However there is still one area that can trip you up when writing from any program that is not the one that built the VIDEO_TS folder, except for DVDAE ME. That is the desire to put each .BUP file in a different ECC block than its corresponding .IFO file. Unfortunately there is no hard and fast rule for how to do this, so each authoring system is free to choose its own algorithm. This isn't normally a problem if the .VOB file(s) between the .IFO and .BUP are at least 16 sectors long, which almost any video is, but in spec authoring systems there is no rule that there has to be a .VOB file at all in the VMG. DVD Studio Pro puts at least a dummy video in every menu domain to avoid this problem. It is 116K, and contains 1/2 second of black.

DVDAE puts the .BUP file at the next multiple of 16 if it needs to. I have heard of that Toast just adds 16 to the sector number. (I haven't tested that claim). So your results are going to fail on some players if there is a different adjustment made by the original authoring system and the burner program. That is because there are pointers in the Title Map to where the video starts. Those pointers can be ignored by the player, or not, depending on how it implements things. DVDAfterEdit fixes them, but never uses them, for example, since they were only provided as crutches to early DVD player processors with extremely limited memory, and serve no useful purpose for how we keep track of the data.

Another theory that I have is that pointing to the wrong place in the video isn't always noticeable, since it takes so many sectors to display even half a second of video, and some players may be tolerant to starting in the midst of a GOP.

DVD Studio Pro puts two files in each VIDEO_TS folder when it builds it. When that folder is written to DVD-R or DLT, those files are automatically left out. So if you burn with Toast or another burning program, be sure to remove them first. Some players get confused by the extra files.

We have considered putting writing to DVD+-R on our to-do list, but we would be committing to support for lots of different DVD burners, and haven't justified the development and support cost of such a feature yet.

It would be nice if some enterprising burner program provided a way to set the layer break via a text file in the VIDEO_TS folder or something. Then we could arrange to write such a file.

Regards,

Larry

MyDVD Play All Example

Presented here is a Sonic MyDVD project that was authored in DVDAfterEdit to implement a Play All button.

MyDVD does a play all if you activate the first menu. Activating subsequent menus plays that menu and continues to the end. Not a bad solution. We will change it to behave like the Play All examples authored with other programs.

In MyDVD, which uses a motion menu with a button for each clip, very much like iDVD, it creates a separate VTS for each clip. The motion menu is placed in the first Video Title Set Menu. I presume if there are submenus they would be placed in the next VTS, etc.

MyDVD has an abstraction layer layout somewhat similar to DVDSP 2. Each title set menu has three dummy menus, a root menu, a chapter menu, and a non-entry menu. Except they are not quite dummies they have a single frame of black. The motion menu is assigned as a fourth, non-entry menu. If the motion menu is present, the frame of black in the dummy menus is replaced by a frame of black followed by the starting frame of the motion menu.

There are a considerable number of VMG dummy PGCs. They also have a single black frame.

Here are the commands:

First Play PGC

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:First Play PGC:"
1:	Jump VMG PGC 9

VMG PGC 9

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Manager Menus:English (14 menus):VMG PGC 9 (1 program):"
1:	Set r15 = 1
2:	Jump VTS 1 VTS TT 1 Menu Root

Looking at the Video Manager Title Play Map, we see that the first title is VTS 1, as might be expected.

VTS 1 VTSM PGC 1 Menu Root

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 1 (1 program):"
1:	if  r15 >= 1 then Link PGC 3
2:	Set r15 = Title
3:	Set r15 &= 0
4:	Set r15 /= 1
5:	Set r15 = 0
6:	Link PGC 4

Since r15 == 1 we will link to VTSM 1 PGC 3

VTS 1 VTSM PGC 3 (non-entry)

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 3 (1 program):"
1:	if  r15 >= 3 then GoTo Line 7
2:	if  r15 >= 2 then GoTo Line 5
3:	Set r15 = 0
4:	Link PGC 4
5:	Set r15 = 0
6:	Link PGC 4
7:	if  r15 >= 4 then GoTo Line 10
8:	Set r15 = 0
9:	Link PGC 4
10:	Set r15 = 0
11:	Link PGC 4

Since r15 == 1, we will set it to zero and link to VTSM 1 PGC 4

VTS 1 VTSM PGC 4 (non-entry)

#DVDAfterEdit Commands V1
#CellCommands from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 4 (1 program):"
1:	Link PGC 4

Since this is the motion menu, it just plays (there are no pre commands) and when it reaches the end of the cell it plays again.

We must look at each button command to see what happens next. (The button commands are in the Nav packs; if you dont remember how to get to them see the ReelDVD Play All Example for a screen shot).

Button 1

#DVDAfterEdit Commands V1
#Selected  from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 4 (1 program):PG 1:Cell 1 (29 nav packs):Nav pack 2:"
1:	Jump VTS TT 1 PTT 1

Button 2

#DVDAfterEdit Commands V1
#Selected  from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 4 (1 program):PG 1:Cell 1 (29 nav packs):Nav pack 2:"
2:	Jump VMG PGC 13

Button 3

#DVDAfterEdit Commands V1
#Selected  from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 4 (1 program):PG 1:Cell 1 (29 nav packs):Nav pack 2:"
3:	Jump VMG PGC 12

Button 4

#DVDAfterEdit Commands V1
#Selected  from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 4 (1 program):PG 1:Cell 1 (29 nav packs):Nav pack 2:"
4:	Jump VMG PGC 11

Button 5

#DVDAfterEdit Commands V1
#Selected  from "MyDVD Play All:Video Title Set Menus:Title Set 1 Menus:English (4 menus):
VTSM PGC 4 (1 program):PG 1:Cell 1 (29 nav packs):Nav pack 2:"
5:	Jump VMG PGC 10

The first button jumps directly to the Title, since it is in the same VTS. But all of the others must route themselves through a Video Manager PGC, because of the DVD Spec limitation that you may never navigate directly from one VTS to another.

By the way, that is why the ReelDVD project is so simple since everything is in a single VTS those restrictions dont apply!

VMG PGC 13

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Manager Menus:English (14 menus):VMG PGC 13 (1 program):"
1:	Set r15 = 1
2:	Jump VTS 2 VTS TT 1 Menu Root

VMG PGC 12

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Manager Menus:English (14 menus):VMG PGC 12 (1 program):"
1:	Set r15 = 1
2:	Jump VTS 3 VTS TT 1 Menu Root

VMG PGC 11

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Manager Menus:English (14 menus):VMG PGC 11 (1 program):"
1:	Set r15 = 1
2:	Jump VTS 4 VTS TT 1 Menu Root

VMG PGC 10

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Manager Menus:English (14 menus):VMG PGC 10 (1 program):"
1:	Set r15 = 1
2:	Jump VTS 5 VTS TT 1 Menu Root

Button 1 proceeded directly to VTS TT1. (r1 is still set to 1). Each of the other command sequences sets r15 = 1 and goes to the root menu of the desired track.

Each of the root menus is identical, here is one:

VTS 2 VTSM PGC 1 (root)

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Video Title Set Menus:Title Set 2 Menus:English (3 menus):
VTSM PGC 1 (1 program):"
1:	if  r15 >= 1 then Link PGC 3
2:	Set r15 = Title
3:	Set r15 &= 0
4:	Set r15 /= 1
5:	Set r15 = 0
6:	Jump VMG PGC 2

Since r15 == 1, it links to PGC 3. Each of the non-entry menus is identical.

VTS 2 VTSM PGC 3 (non-entry)

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Video Title Set Menus:Title Set 2 Menus:English (3 menus):
VTSM PGC 3 (1 program):"
1:	if  r15 >= 2 then GoTo Line 4
2:	Set r15 = 0
3:	Jump VTS TT 1 PTT 1
4:	Set r15 = 0
5:	Jump VTS TT 1

Since r15 == 1, it will Jump VTS TT 1 PTT 1. That means to the first PTT in that VTS. Jump VTS TT 1 would seem to have the same result. So, by round-about ways we eventually played each track we wanted for each button in the motion menu.

To see what happens after playing the track, we look at the post commands for each track:

VTS 1 PGC 1 TT 1

#DVDAfterEdit Commands V1
#PostCommands from "MyDVD Play All:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:	Call VMG PGC 8 resume C1

VTS 2 PGC 1 TT 1

#DVDAfterEdit Commands V1
#PostCommands from "MyDVD Play All:Video Title Sets:VTS 2:PGC 1 TT 1:"
1:	Call VMG PGC 7 resume C1

VTS 3 PGC 1 TT 1

#DVDAfterEdit Commands V1
#PostCommands from "MyDVD Play All:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:	Call VMG PGC 6 resume C1

VTS 4 PGC 1 TT 1

#DVDAfterEdit Commands V1
#PostCommands from "MyDVD Play All:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:	Call VMG PGC 5 resume C1

VTS 5 PGC 1 TT 1

#DVDAfterEdit Commands V1
#PostCommands from "MyDVD Play All:Video Title Sets:VTS 1:PGC 1 TT 1:"
1:	Call VMG PGC 4 resume C1

So each track has an associated Video Manager PGC which is invoked after playing the track. Well take a look the first one.

#DVDAfterEdit Commands V1
#PreCommands from "MyDVD Play All:Manager Menus:English (14 menus):VMG PGC 8 (1 program):"
1:	Set r15 = 2
2:	Jump VTS 2 VTS TT 1 Menu Root

Each PGC 8 thru 4 unconditionally jumps to the next title. So now we know how to fix them. Just use another variable to mean play all and make the jumps conditional on that variable. Clear the play all variable when entering the title menu. Set it when invoked by the play all button.

I will leave the exercise to the reader.

ReelDVD Play All Example

Presented here is a ReelDVD project that was authored in DVDAfterEdit to implement a Play All button.

» Click here to download example files for this project.

In ReelDVD everything is placed into a single Video Title Set, even the menus. We created a title menu with four buttons to play each of the tracks, and a fifth unassigned button, labeled Play All. ReelDVD placed the title menu in PGC 1, the four clips in PGCs 2 through 5, and the play all button in PGC 6.

Here are the commands

First Play PGC

#DVDAfterEdit Commands V1
#PreCommands from "ReelDVDPlayAll:First Play PGC:"
1:	Jump TT 1

The first play jumps to the title menu.

VTS 1 PGC 1 TT 1 (Title Menu)

#DVDAfterEdit Commands V1
#PreCommands from "ReelDVDPlayAll:Video Title Sets:VTS 1 (6 program chains):PGC 1 TT 1:"
1:	if  r14 != 0 then GoTo Line 3
2:	Set r15 = Subpic lang
3:	Set r14 = 1
4:	Set r0 = 0

The first three lines are ReelDVD abstraction layer commands that for this project mean nothing. We have added line 4, which clears our Play All register flag each time we enter or reenter the title menu.

Each of the buttons in the Title Menu is already set up to play the correct track, except for the Play All button.

VTS 1 PGC 2 TT 1 (PTT 2)

#DVDAfterEdit Commands V1
#PostCommands from "ReelDVDPlayAll:Video Title Sets:VTS 1 (6 program chains):PGC 2 TT 1:"
1:	if  r0 == 1 then Link PTT 3
2:	Link PTT 1

After playing Track 1, the post commands are executed. If we are in Play All mode, we continue to Track 2. If not, we go back to the Title Menu.

VTS 1 PGC 3 TT 1 (PTT 3)

#DVDAfterEdit Commands V1
#PostCommands from "ReelDVDPlayAll:Video Title Sets:VTS 1 (6 program chains):PGC 3 TT 1:"
1:	if  r0 == 1 then Link PTT 4
2:	Link PTT 1

VTS 1 PGC 4 TT 1 (PTT 4)

#DVDAfterEdit Commands V1
#PostCommands from "ReelDVDPlayAll:Video Title Sets:VTS 1 (6 program chains):PGC 4 TT 1:"
1:	if  r0 == 1 then Link PTT 5
2:	Link PTT 1

Tracks 2 and 3 do the same thing as track 1, either continue or go back to the Title Menu.

VTS 1 PGC 5 TT 1 (PTT 5)

#DVDAfterEdit Commands V1
#PostCommands from "ReelDVDPlayAll:Video Title Sets:VTS 1 (6 program chains):PGC 5 TT 1:"
1:	Link PTT 1

The last track always goes back to the Title Menu.

VTS 1 PGC 6 TT 1 (PTT 6)

#DVDAfterEdit Commands V1
#PreCommands from "ReelDVDPlayAll:Video Title Sets:VTS 1 (6 program chains):PGC 6 TT 1:"
1:	Set r0 = 1
2:	Link PTT 2

The play all button sets the Play All register on and plays the first Track.

But how did the player get to the PGC Commands? It used the button commands in the Nav packs:

[inline:1=center,Nav pack button commands]

Notice that button 1 linked to PGC 2, which had no pre commands so it just played Track 1 and then went to the post commands, which we covered earlier.

So we set the button command for button 5 (the Play All button) to link to PGC 6. This will send it to the pre commands, which set the Play All register and then plays Track 1.

Highlighting the Correct Button

For some reason ReelDVD set the Force Selection button the button 1. Here we have cleared it, so it will remember which button was highlighted last when it gets back to the Title Menu.

[inline:2=center,highlight correct button]

Thats all, folks!

Replace VTS - Function and procedure

One of DVDAfterEdit's most powerful and frequently-used functions is the ability to replace a Video Title Set. This article describes briefly how to use it, while retaining all the exisiting navigation from your project. Common uses of this procedure would be to swap out a copyright message, company ident or even an updated element.

To get started, open up the build file of your project. DVDAfterEdit displays a representation of the information contained in the information (IFO) files of the DVD. You can see the Video Title Sets of your project by unfolding the arrow of the VTS node, in the Left Pane. Using Tracer or the Preview Window in the Right Pane, find the VTS you would like to Replace, unfold it's node arrow, and select the Title PGC (PGC_TT) node:

[inline:98-Video_Title_Sets.jpg=Video Title Sets]

The Right Pane is displaying all kinds of information about the VTS, but for the time being let's concentrate on the Pre-Commands. Unfold the arrow as shown above if you can't see them. These commands control the detailed navigation of the disc. Pre-Commands are executed before the video in the PGC is played, and Post-Commands are executed after it has been displayed. If you're a DVD Studio Pro user and have written "scripts" to control navigation or the selection of audio streams, for example, your commands will be here - although they may be difficult to find or recognise!

Don't worry - we don't need to understand these commands at all for this process - we just need to make sure we don't loose them when we Replace our VTS. We do that by making sure that the VTS TT_PGC node is selected as in the illustration above, and choosing "Copy PGC Commands" from the Edit menu. So all those commands are copied into the Paste Buffer, and will stay there until we've replaced the VTS with our new one containing the DTS audio stream. Then when the Replace function has finished, we can just paste them back in again.

[inline:98-select_replace_vts.jpg=Replace Video Title Set]

Try it, making sure the Project you're working on has been backed up first. Select the VTS node instead of the PGC_TT node, control-click on it and select "Replace VTS":

You'll get a requester like the one shown below. Browse your way to the VIDEO_TS folder of the project which contains your new VOB file, in this case the VTS_01_1.VOB:

[inline:98-select_VTS-VOB.jpg=select the VTS_01_1.VOB]

As you can see, DVDAfterEdit offers you the chance to Import any commands or menus associated with the VTS VOB you have chosen, but since we are taking the VTS from a project which has nothing to do with this one, we don't either of these options, so un-check both boxes, and click "Choose". This won't take too long, but for a larger VTS it will be some minutes. The program shows you a progress indicator.

[inline:98-progress_indicator.jpg=center,progress indicator]

Once the VTS has finished importing, select it's node arrow and unfold the arrow in the Right Pane to look at it's properties:

[inline:98-audio_stream_properties.jpg=center,access audio stream properties]

Bingo! We have a new VTS. We're not quite finished yet, though - if you unfold the VTS node arrow again and select the Title PGC again, you'll see that as expected, the VTS has no Pre or Post Commands - we chose not to import them, remember.

[inline:98-no_Pre_or_Post_Commands.jpg=center,no Pre or Post Commands ]

So now we simply have to select "Paste PGC Commands" from the Edit menu (while the title PGC is still selected), and the commands we copied to the Paste Buffer before starting the Replace VTS function will slot straight in. The navigation and/or scripting for the DVD will now behave exactly as it did originally, but with a new VTS where the dummy track was. All we need to do now is Save the project and we're done!

Summary

To recap, here is this procedure in outline:

  1. Open the project in TFDVDEdit and find the VTS you want to Replace with the new VOB
  2. Copy the PGC Commands of the current VTS Title PGC
  3. Replace the VTS, choosing not to import it's commands or menus
  4. Paste the old commands into the Title PGC of the new VTS
  5. Save

At this stage it's also worth using DVDAfterEdit to check all the other properties of the new VOB - aspect ratio, subtitle & audio streams and their languages and so on, just to make sure that everything is as it should be.

If your original VTS had a more complicated structure than just one title PGC, you would copy the commands from the whole project rather than just the Title PGC, and use DVDAfterEdit's Title List editor to create the correct VTS PGC structure before pasting those commands back in. This is also quite straightforward, and is covered in other articles.

Conclusion

Hopefully you can now see that DVDAfterEdit's Replace VTS function is both extremely powerful and extremely easy to use. Any VTS can be replaced, so you could insert a new version with DTS audio, for example, or a VTS with animated subpictures (overlays), or one with complicated subtitle requirements - in fact, any feature not currently supported by your authoring application can be added, allowing you to keep creative control of the rest of the project, and pass the savings in time and efficiency on to your customers rather than letting the work go elsewhere. I'm sure someone out there will come up with some truly innovative uses for this function, and I look forward to seeing them!

Sharing GPRM registers between DVDAfterEdit and your authoring application

or "Messages From Beyond The Build File"

by Ian Shepherd


This article describes a technique using DVDAfterEdit which will enable you to make DVD Studio Pro ( or any other authoring application ) "talk" to DVDAfterEdit, after the disc has been built. It was written several years ago, before DVD Studio Pro offered the possibility to skip past motion-menu transitions. I developed the technique for my own use to do exactly that, and wrote this article illustrating the technique. It must have been a popular request, because six months later Apple added the feature to DVDSP !

So, the article is a little out of date, but the method is still a very powerful technique with all kinds of possible uses, allowing you to pass variables from inside the authoring application, down to spec-level commands in 'Edit, and back again. There is lots of information here for people who are new to the ideas of "spec commands", the "abstraction layer" and to DVDAfterEdit in general, so I hope you will still find what follows useful and interesting.

Introduction

As DVD Authoring applications become more and more sophisticated, offering more and more clever features in ever more easy-to-use ways, the line between "Pro" and "Non-Pro" authoring applications is becoming more and more blurred. Traditionally, the "Pro" apps allow nearly unlimited control of the DVD at it's lowest level, meaning the author can do almost anything the format allows. However this usually also means the author needs a detailed understanding of the specification itself, and this is often far from user-friendly.

At the other end of the scale, "abstraction layer" (AL) systems like DVD Maestro and DVDSP hide most of this detail from the user, and have a correspondingly shallower learning curve. However their capabilities are often somewhat limited as a result, since if the writers of the AL authoring app didn't specifically decide to make it easy for you, it may be very difficult, if not impossible, to do it at all!

DVDAfterEdit's great strength is in offering spec-level control to everyone, including users of these AL programs. Even, at one extreme, allowing us to "nuke" all the abstraction-layer commands, and build up the functionality of the DVD from scratch at the spec-command level.

If you're like me, though, this isn't always what you want. Here I'm going to introduce a new technique which bridges the gap between the two extremes of either spec-level detail or easier-to-use-but-more-restrictive AL techniques. So we can take advantage of the ease-of-use and speed of implementation of the AL authoring apps, and add the high-power DVD spec commands where necessary.

The basic idea is very simple. It makes use of the fact that the "variables" we use when creating "scripts" in an AL authoring application like DVDSP are actually GPRMs - "general parameters" - ie. memory locations where we can store numbers of our choice - for example, to remember the user's answers in a quiz, say.

In DVDAfterEdit they are referred to as "registers", numbered r0 to r15. Apple have used r0 to r7 for DVDSP's abstraction-layer, but the others are available for us to use in any way we like. Incidentally, for some reason, DVDSP2 allows us to use registers r8 to r15, but calls them GPRM 0 to 7. So, GPRM 0 is r8, GPRM 1 is r9, and so on. Other applications like Scenarist correctly call r0 GPRM 0, r1 GPRM 1 and so on.

The DVD-spec commands visible in DVDAfterEdit are of course just as capable of testing and setting these variables as the scripts in DVDSP. Knowing this, all we do is set a GPRM in DVDSP to a special "code" values of our choice - "1", say, for simplicity - build the project, test that GPRM in DVDAfterEdit, and depending on the result of the test, carry out another command. The variable is set in DVDSP's script, and then "passed" over to the spec-level commands in DVDAfterEdit. Which, in theory, could change that same GPRM, or any other, and pass it back to the abstraction-layer scripting again! But more of that later. Let's look at a specific example of this idea in use, which is probably the best way to understand it. I'll assume you're using DVDSP2, but the same principles can be applied to any AL-based authoring application.

1- Skipping Menu Transistions

What are menu transitions, and why should I use them?

One of the key elements of a high-end "Pro" DVD is the quality of design of the menus and interface, and one feature that never fails to impress is a slick introduction to the disc perhaps the main menu "builds up" from different pieces in a clever animated sequence, or the menu buttons "fly in" from different areas of the screen.

This kind of effect is achieved by having a short section of video just for the menu introduction, which is known as a "Menu Transition". Having these in key areas of the disc can make all the difference between a "so-so" presentation and a really pleasing design. However, implementing these kinds of features needs a little more time and effort than straightforward motion menus.

Lets say you've designed a main menu with simple overlays, and an introduction sequence, for example if your buttons "fly in" from somewhere off the screen as part of your menu transition, there are several factors which are important:

  1. You don't want the button overlays visible from the very beginning, when the buttons are whizzing around, but only when the buttons have "settled in" to their final positions on-screen.
  2. When users return to the Main Menu after watching one the features of the disc, they won't want to sit through the whole introduction sequence again that would quickly become irritating.
  3. You want to be able to target specific buttons on each menu, depending on where the navigation has just come from. For example, the Bonus Features button should be highlighted if you've just come back from the Bonus Features menu.

Luckily, DVDSP2 allows us to solve Problem 1 using one of it's new features - menu Loop Points. Provided none of the buttons in a menu use any of DVDSP2's fancy new features (drop zones, shapes, text, assets), you can easily set a loop point in the General tab of the menu's Property Inspector. This has 2 functions - first, when the menu has played to the end, it will loop back to the loop point, not the beginning; and second, the buttons and their overlays only become visible once the loop point is reached, which is exactly what we want. When the menu intro has finished and the buttons have settled into their final positions, the overlays appear and the buttons become active, and when the menu reaches the end, it loops back to this point, rather than play the intro again (Incidentally, when you're designing a menu to work in this way, you'll want to make sure the last frame of the video matches the first frame of the loop point; so that when the loop happens, all the user sees is a brief pause. In the same way, it's best to have the audio fade down by the time the loop point is reached, otherwise when the menu loops it will "jump in" and spoil the slick effect).

So far so good - this is all something that DVDSP 1.5x couldn't do without using tracks as menus (See below). However, Problem 2 still stands. We don't necessarily want the menu's intro to play every time the menu is accessed, especially if it's the main intro to the whole disc. There are several ways this could be solved within DVDSP, but none of them are ideal. They are:

  1. Duplicate the menus. So, the first time the disc plays, your "First Play" menu, with intro transition and loop point, plays. Then, later on, if people choose to access the main menu, instead of returning to the "First Play" menu, they are taken to another copy without the intro and loop point. This works well for simple projects, but can quickly get out of hand if you are designing menu transitions for more than a few menus. Say you have a main menu with 4 sub-menus. That's 4 copies of the menu with the transitions to those menus,plus 4 without - plus another 4 copies of the main menu including the transition back again. So that's 13 menus where otherwise there would only be 5! It's easy to see how this can be very complicated to author, and take up lots of valuable space on the DVD.
  2. Have the transitions as separate menus, and only navigate to them when you want them. This avoids doubling up all the menus with and without transitions, but because there are no seamless joins between menus on DVDs, there will always be a noticeable pause between the end of the transition and the start of the menu. Keeping the transitions as menus, not tracks, minimizes this pause, incidentally.
  3. Use track assets with buttons-on-video as menus. This is how it had to be done in DVDSP 1.5x. Briefly, the menu clip with transition is assigned to a track asset, not a menu. You add a marker at the point where you want the menu to loop, and add buttons to this marker, so they only appear when playback reaches that marker. Then when the track gets to it's end you can set it to loop straight back to the marker. This works well, but has an important limitation - Point 3 from above isn't possible. You can't target a specific button at the marker point. So whereas all the best-authored discs will return you to the button you just pressed when you're retracing your steps through a menu system, using this method the first button will always be highlighted.

These may seem like small problems, but it's the sum total of many small but significant points like this that make a truly excellent DVD design.

2 - Looking at motion menus in DVDAfterEdit

Firstly, it's worth looking at how DVDSP2 sets up looping menus. We'll use this information to skip the transitions using DVDAfterEdit.

When a menu is built, it becomes a PGC (Program Chain), just like almost everything else on a DVD. More specifically, it becomes a Video Title Set Menu PGC, or VTSM PGC.

Set up a test project in DVDSP2 with a looping menu, and build it somewhere, so we can take a look at this.

[inline:101_set_gprm7_dvde2.jpg=center,DVD Studio Pro project as seen in DVDAfterEdit]

If you open up the project's VIDEO_TS folder using DVDAfterEdit, and unfold the arrow for the VTSMs, you'll see the DVD's VTSM Title Sets. All 4:3 aspect menus are in VTSM #1 (in DVDSP projects for a 4:3 DVD). Unfold it's arrow and the one for "English" and you'll see all the 4:3 menus for your DVD, plus some "dummy" PGCs which are put there by the abstraction layer programming. You can use DVDAfterEdit's Preview feature to figure out which menu is the one you're interested in - it'll be one of the ones with an arrow next to it. If you unfold it's arrow, you'll notice it has 2 "cells", PG 1 and PG 2.

A cell is essentially a subdivision of a video stream. There are different types of cells - chapter markers are special kinds of cells used for navigation. If you unfold the arrows for any VTS (track) in your project, you'll see the Chapters (Parts of Titles, or PTTs) are all cells. Any marker set in DVDSP2 where you un-tick the chapter box in the property inspector will show up as a cell but not as a chapter. So cells don't have to be chapters; they have other useful properties - they can have Cell Commands attached to them, for example.

Anyway, a looping menu from DVDSP2 will have 2 cells, one at the start, and one at the exact point where you set up the loop point back in DVDSP. This is the one we're going to jump directly to later, in order to skip the menu's intro. If you unfold the arrows down to the nav-pack level, you can even see that the nav-packs in PG 1 don't have button commands, whereas those in PG 2 do (assuming you've made some!), because as we saw earlier, the buttons aren't active until the loop point (PG 2) is reached.

The other thing to notice at this stage is the menu's Pre-Commands. If you select the VTSM PGC of any menu in the left-hand pane of DVDAfterEdit, in the right pane you'll see a section marked Pre-Commands and Post-Commands. These are the DVD-spec level commands which are executed before (Pre) and after (Post) each PGC is played. This is where we're going to put the command to skip past the cell containing the menu's introduction.

So, now we can look at the nitty-gritty of the method.

3 - Skipping menu intros

As we saw in the introduction, the idea is that if we want menu intros to be skipped after accessing a certain part of the disc, we set a particular GRPM of our choice to a certain "code" value using a script in DVDSP 2. Then, after building the project, we use DVDAfterEdit to test the value of this GPRM in the menu's Pre-Commands.

If the GPRM we choose has it's special value, the script will cause navigation to jump straight to the second cell of the menu, skipping the one with the intro sequence in it. If the GRPM doesn't have the value you've chosen, the intro will play as usual. I've chosen to set GRPM 7 = 1 as my special code for "yes, I want the intro to be skipped", but you could use any GPRM and value you like, provided you remember what it is.

So, in our example, we have a main menu with quite a long intro sequence to the whole disc, with the buttons eventually flying in to their final positions, at which point (the second cell, where you set the loop point in DVDSP2) the overlays appear. If the user chooses to play the "Main Feature" from this menu, but then uses the menu remote key to get back to the main menu again, we don't want them to have to sit through the whole intro again.

Stage one is to set up a script which will set our "code" variable - GPRM 7 = 1, or whatever you've chosen. I suggest you have just one script, and set it up as the Pre-Script for any menu or tracks where you want the menu intro to be skipped after they've played.

[inline:101_dvdsp_prescript.jpg=center,Set GPRM command]

So in DVDSP2, create a new script, name it "Menu Intro Skip" or something similar, and add just one command: 1 mov GPRM 7, 1 - which just sets GPRM to 1.

[inline:101_dvdsp_project.jpg=center,DVD-Studio Pro Prescript]

Now if you select any track, you'll see in the General tab of the Property Inspector that you can choose a Pre-Script in the Playback Options section. And all you have to do is choose your new script in the drop-down box.

Now, whenever the track in question is played, the Pre-Script we've chosen will be executed before it starts, and GPRM 7 will be set to "1". Then when we test GPRM 7 in the menu's Pre-Commands in DVDAfterEdit, the commands we add will ensure that because GPRM 7 equals "1", the menu intro will be skipped. If the user chooses to play a track where you haven't got your "Menu Intro Skip" script setup as it's Pre-Script, GPRM 7 won't be set to "1", and no commands are added in DVDAfterEdit, and the intro won't get skipped.

And that's it - in DVDSP 2 at least. Currently, the project isn't going to work as we want, because we haven't set up the code in DVDAfterEdit, but the ground-work is done.

The next stage is to build your project. And then test the value of SPRM 7 after the build is complete, ie. after it would normally be finished, which is why this technique is like getting messages from "beyond the build file"! So, open your newly built project in DVDAfterEdit, and as we saw earlier, unfold the VTSM arrows (VTSM 1 for 4:3 menus in a 4:3 project, VTSM 2 for 16:9 menus if your project has both) to find the main menu. Don't worry about the abstraction layer's dummy PGCs, just click on the ones with arrows next to them & use the Preview window to find the right one. It's also useful to bear in mind that the menus will be arranged in DVDAfterEdit's Left Pane in the same order as they are in the Contents>Outline window in DVDSP 2.

As we saw before, you'll see two cells in the menu, the first containing the intro, the second containing the looping part. If you select the second cell, the Preview window will display the exact I-frame where you chose your loop-point to be.

All we have to do now is make sure you've selected the VTSM PGC for your menu, so you can see the Pre and Post-Commands (these won't show up if you've selected individual cells or nav-packs):

- and add, at the END of the menu's Pre-commands: if r15 == 1 then Link PG 2

To do this, first select the last Pre-command for the VTSM PGC, in this case #15, and press Apple-K. A new command,16: NOP will appear. Then type if r15 == 1 then Link PG 2 in the command assembler :

Set DVD command

[inline:101_set_gprm_command.jpg=center,Set GPRM 7 in TFDVDEdit-2]

And press Enter.

Remember that for some peculiar reason, what DVDSP2 chooses to call GPRM 7 is actually register number 15, or r15. So we set GPRM 7 in DVDSP2, but now we test r15. If it equals "1", then the command links to PG 2, the second cell in the menu, which only contains the looping part, and the user won't see the intro which is contained in cell 1, assuming you out your loop point in the right place - bingo. Our special code variable has been "passed" to DVDAfterEdit's spec commands from beyond the build file, allowing us to add a function Apple didn't include in DVDSP2. And all with only 2 lines of code!

(We add the command to the END of the Pre-Commands, to make sure that all the others are executed. They have been added by DVDSP's abstraction-layer programming, and if we skip to the next cell before they're been executed, things may not behave as they should.)

Now we can add exactly the same command to the Pre-Commands of any other menus whose intros we also don't want to be played (if r15 = 1) in exactly the same way. If there's a menu where you always want the intro to play, obviously just don't add the command. Finally, in the Post-Commands of this menu PGC, add a new NOP command to the beginning (Select where it says Post-commands, and press Apple-K) and edit it to say Set r15 = 0, Register.

This just keeps things tidy, clearing GPRM 7 so that if the user navigates to another menu, it's intro won't be skipped. (Unless we want it to, in which case we would use set our "Menu Intro Skip" script as a Pre-Script again.)

So, just to re-cap, the Pre-Command for the looping menu checks whether r15 (GPRM 7) is set to 1. If it is, the command links to the second Cell of the menu, skipping the intro. If it isn't the menu plays normally. Either way, r15 (GPRM 7) gets reset to "0" afterwards.

Now, when designing the project in DVDSP 2, all we need to do is choose our "Menu Intro Skip" script as the Pre-Script of any track or menu whenever we want subsequent menu intros to be skipped, and keep an eye out for other places where this value needs to be manually reset. For example, if the end of the track is reached without the user pressing the remote menu key, and navigation then jumps to an "Extras" Menu, which itself has an intro which is set up to be skipped in some cases, but in this case we want the intro to be played; then we should add a script to the end of the track in DVDSP 2, to reset GPRM 7 to "0".

All of which will take some planning for very large projects! But hopefully you will have clever ideas about how to improve the method. One possibility is to have different "code" values for different menus, so if GPRM 7 = 1, the Main Menu (but no other) skips it's intro, if it's set to 2, the Main Menu Intro plays normally but the Bonus Features Menu skips it's intro... you get the idea.

Conclusion

We've seen how DVDAfterEdit can share registers r8-r15 with DVDSP2, where they're known as GPRMs 0 to 7, allowing us to "pass" commands across from the abstraction layer to PGC Pre and Post-Commands. If a GPRM is set to a certain value in DVDSP2, then we can execute a DVD-spec command in DVDAfterEdit, enabling functionality which otherwise wouldn't be available to us.

In our example, that was skipping directly to a later cell in a looping motion menu, but there's no limit in theory to what these commands might be - how about inserting a new piece of footage into the middle of a menu sequence, by jumping directly from the middle of one menu to another, say?

Or, while typing this article for the site, it's occured to me that it may well be possible to solve the intro-skip problem in another way - make all our menus tracks, as in Method C back towards the beginning of this article, with scripts storing button selections in GPRMs, and then using Pre and Post-Commands in DVDAfterEdit to ensure the right buttons are selected, even with buttons-on-video in tracks... I'll get back to you if it looks useful.

The only limit is our ability to come up with new ideas. I'm looking forward to everyone else's ideas on how to expand this!

Good luck,

Ian

Simple DVD Spec. Re-Authoring With DVDAfterEdit, Part 1

by Ben Weinrach


[please note that this page has many images and may load slowly]

[inline:ben-intro.jpg=right,Ben Weinrach]

While working at NAB with the DVDAfterEdit gang, I spent a lot of time talking to DVD authors. Many of them were experienced Maestro and DVDSP2 users looking for a little more control over their projects.

When I showed them the programming their favorite authoring application was doing behind the scenes, many were surprised at the complexity - especially for very simple projects. They understood that they could re-author with DVDAfterEdit, stripping away the excess commands and dummy menus, but were not quite sure where to begin.

I was able to relate with them. I explained how after working with DVDSP 1.X for over a year, I suddenly found myself having to learn a very popular spec-based authoring system in a hurry. After a while, the programming syntax and workflow became clear, and actually rather easy - at least for the types of jobs I was authoring. The amount of programming efficiency and organization is truly up to the author, which directly translates into navigation speed. Fewer commands and less jumping in and out of domains means a faster experience for the end user as well as less searching around the disc for the DVD player. When recordable DVD formats are used for delivery, this becomes even more important.

This article is going to show you how unbelievably easy and effective re-authoring with DVDAfterEdit can be. I'll demonstrate how to delete unneeded PGC's and how to wipe out all navigation commands, whether they were input by the author or added by the abstraction-layer authoring application upon build. Then we'll add the minimum Pre, Post, and Button Commands required to get the disc functioning as desired. The resulting VIDEO_TS folder will have a fraction of the commands and PGC's found in the original build. Once you have a solid grasp of these techniques, you'll find that the complete re-authoring of small projects can take just minutes and your authoring application may be downgraded to just the role of a multiplexer!

Let's briefly review the basic DVD structure

PGC (Program Chain): The basic object or building block in DVD structure. PGC's can contain instructions and/or video and audio. Menus and tracks are PGC's, and "dummy PGC's" are usually menus used to hold commands without video and audio assets. Think of a PGC as a container.

VMG (Video Manager): The upper-most level or "domain" of DVD structure; it contains various attributes of a disc that can affect playback, as well as contain menu and dummy PGC's.

First Play PGC: This PGC informs the player how to start playing a disc. Commands can be used to set GPRM's, get information about the setup of the player, and direct navigation.

VTS (Video Title Set): Usually holds a disc's program material, and can be comprised of multiple PGC's. DVD's can have multiple VTS's, much like the tracks of an audio CD. The VTS domain is under that of the VMG.

VTSM (Video Title Set Menu): Each VTS has a dedicated menu area, its own VTSM domain, which can contain multiple menu PGC's. These menus can only control the VTS PGC's in the same VTS domain as the menu. So for example, VTSM 1 can control a track in VTS 1, but not in VTS 2.

The Project

The project we are going to re-author contains a 15 frame/1 GOP First Play in VTS 5, 4 short tracks in VTS's 1 - 4, and a single menu in VTSM 1.

» Click here to download "4 Track" example files for this project, including DVDSP 2 original build and the final DVDAfterEdit build.

Here is the left pane of the DVDSP 2 build:

[inline:44_left_pane_dvdsp2.jpg=center,left pane of the DVDSP 2 build]

DVDSP2 put 8 dummy menus in the VMG, the Main Menu in VTSM 1 (if you expand the arrows further, you will see this listed as "program" in DVDAfterEdit) with 6 additional dummy menus, and 5 dummy menus in each of the other VTS's respective menu domains.

Upon further inspection, you'll notice line after line of Pre-Commands in many of these dummy PGC's (see image below). These dummy PGC's and commands are generated "behind the scenes" upon project build.

Popular abstraction-layer authoring applications (like Maestro & DVDSP 2) make programming navigation easy for the author, but create all these commands and dummy PGCs which are not required by the DVD Specification to get the disc to operate as desired. All of this extra stuff makes DVD players have to work harder, by running through a lot of commands just to search for and jump to another PGC with a lot of commands, etc., until navigation ultimately lands where needed.

We are going to delete everything we don't need (and want), while maintaining the original PGC structure and the project's functionality.

[inline:44_maintain_structre_functionality.jpg=center,maintain the original PGC structure and the project's functionality]

Step 1: Delete Dummy PGC's

Open the arrows for the VMG and select all 8 PGC's. Delete them by control-clicking and selecting the "Delete PGC" command. Notice how DVDAfterEdit keeps 1 PGC, as there needs to be at least one whether it will be used or not.

[inline:44_one_pgc_maintained.jpg=center,one PGC kept]

Next, open the arrows for VTSM 1, and delete all of the dummy PGC's. Keep PGC 7 (the Main Menu), which will automatically change to PGC 1.

Finish this step by deleting all of the PGC's in the 4 remaining VTSM domains. Each VTSM will keep 1 dummy PGC, which we'll need. The left pane should now look like this:

[inline:44_left_pane_with_dummy_pgcs.jpg=center,left pane with dummy PCG's]

Step 2: Delete All Commands

Now we need to delete all remaining Pre, Post, and Button Commands because these are now irrelevant since we no longer have all of those dummy PGC's. We could have done this step first.

In the "Edit" menu, select Project-wide Edits/Delete All Commands In Project.

[inline:44_select_project_delete.jpg=center,select Project-wide Edits/Delete]

Step 3: Change Menu Type & Entry PGC Designations

These parameters define a Menu PGC's function in the grand scheme of the disc. By changing these values, we are actually hard-wiring our DVD controller's "menu" and "title" remote keys. Although abstraction-layer authoring applications allow us to assign these remote keys to whatever we want, this "hard-wiring" is actually part of the DVD Specification.

If a VTSM is designated as an "entry PGC" with a "menu type" of "root," then when the menu remote key is activated in its respective VTS, navigation will jump to this menu. DVDSP 2 makes this root menu a dummy, in order to use its Pre-Command area to send navigation on its way. We will be using both of these techniques, but with far fewer commands.

The same scenario also applies to the VMG - when the "title" remote key is activated while in a VTS (track), navigation is directed to the VMG PGC designated as the "entry PGC."

Select VMG PGC 1, and look at the "entry PGC" line in the right pane. Notice that it's grayed-out (therefore unavailable for editing) and is set to "yes."

[inline:44_entry_pgc_yes.jpg=center,entry PGC set to yes]

Now select VTSM PGC 1. Change "entry PGC" to "yes" and "Menu Type" to "root." Now that this is a "root menu" and an "entry PGC," activating the menu remote key while playing Titles in VTS 1 will automatically call this menu PGC, first looking in the Pre-Command area for any instructions when it gets there. Since this menu is our Main Menu (FYI, DVDSP 2 seems to put all 4:3 menus in VTSM 1), the track in VTS 1 has the closest physical link to the Main Menu than any other VTS. In other words, it never needs to leave the VTS 1 domain to get to the Main Menu, unlike the VTS's in this project.

[inline:44_change_main-type_to_root.jpg=center,change Menu Type to root]

Check the other VTSM's. Notice how they are already set to "yes" and "root." DVDAfterEdit did this for us when we deleted all of the dummy PGC's. Since this project only has one menu, these VTSM's will function as dummies - but more on that in just a bit.

Step 4: Pre-Commands & Post-Commands

Since we've deleted unwanted PGC's and commands as well set up our menu designations, it's time for the bulk of our work: adding our commands (but we'll save the button commands for the last step as not all of our targets exist quite yet). There is a basic rule to keep in mind when setting up a disc's programming: navigation cannot jump between Video Title Sets - it must first enter the Video Manager domain. Here is the desired layout for this DVD:

First Play= Jump to VTS 5, then jump to the Main Menu in VTS 1. The Main Menu has 4 buttons with targets of VTS 1, VTS 2, VTS 3, and VTS 4. At the end of each VTS, navigation jumps back to the Main Menu.

Begin by programming the First Play. In the left pane, select "First Play" and insert a Pre-Command. We want the DVD to play VTS 5, so enter "Jump TT 5" as the Pre-Command. The "jump" command is used when navigation needs to leave one domain for another.

[inline:44_insert_pre-command_jump1.jpg=center,insert Pre-Command Jump TT 5]

[inline:44_insert_pre-command_jump1.jpg=center,insert Pre-Command Jump TT 5]

Once VTS 5 finishes playing, we want navigation to jump to the Main Menu. But since our Main Menu is in VTSM 1 and navigation is about to leave VTS 5, there is really only one place it can go in order to get there - the VMG. Select the program in VTS 5, and insert the Post-Command "Call VMG PGC."

[inline:44_insert_jump_menu_root.jpg=center,insert Post-Command Call VMG PGC]

VMG PGC 1 is the entry PGC in the Video Manager Domain and all navigation will be routed to this PGC including "title" remote key activation. But we want our navigation to go to the Main Menu in VTS 1, so let's give VMG PGC 1 a Pre-Command.

Select VMG PGC 1 in the left pane, and ." Now navigation will jump to the Main Menu in VTS 1 whenever navigation enters the VMG.

[inline:44_insert_two_pre-commands.jpg=center,insert the Pre-Command Jump VTS 1 Menu Root]

So now we're at the Main Menu, but we need to tell the DVD player which button navigation originated from (i.e. the button highlight). Since there is only one menu, all we need to do for this disc is move the value from SPRM 8 (which is where the last highlighted button number is stored automatically by the player) to a GPRM, which is referenced by a command to set the button highlight. Basically, we need two Pre-Commands.

Select VTSM PGC 1 and insert two Pre-Commands. For Pre-Command 1, enter "Set R0 = SPRM 8 Button." This means that GPRM register 0 is to have the same value as that of SPRM 8 - or that the value of SPRM 8 is to be moved to GPRM 0. SPRM 8 is a system parameter register that keeps track of the last selected/activated button number. Notice how DVDAfterEdit's SPRM pull-down menu conveniently displays the function of each SPRM.

[inline:44_select_set-button-gprm.jpg=center,insert two Pre-Commands]

For Pre-Command 2, select "Set Button GPRM r0." This tells the player to set the button number from the value stored in GPRM register 0 - which is the highlighted button number that we got in Pre-Command 1.

[inline:44_insert_jump-vmg-pgc.jpg=center,select Set Button GPRM r0]

That's all we need here, so let's assign commands to the other VTSM's.

We know the menu "entry PGC" and "root" designations we checked in step 3 are good to go and the menu remote key of a VTS is hard-wired to its respective VTSM. So when the "menu" remote key is activated in a playing VTS, navigation goes to its VTSM and first looks for instructions in the Pre-Command area. We need to tell navigation to jump from the VTSM to VMG PGC 1.

Insert the following Pre-Command for VTSM 2, VTSM 3, and VTSM 4: "." Now the activation of the "menu" remote key from VTS's 2, 3, & 4 will jump to the Main Menu in VTS 1 via VMG PGC 1. Remember, the "title" remote key automatically calls VMG PGC 1, so we do not need any other commands for that to work. Also remember that if VTS 1 is playing and the "menu" remote key is activated, we do not need to jump to VMG PGC 1 to get to VTSM 1. In fact, we couldn't do that if we tried, because the first stop on the navigation path would be to VTMS 1 anyway!

[inline:44_assign_end_jumps.jpg=center,Jump VMG PGC 1]

Before we move onto the Button Commands we need to assign the end jumps for the short programs in VTS's 1 through 4. Select VTS 1 PGC 1, insert a Post-Command and set it to "Call VTS menu." Once VTS 1 finishes playing, this will send navigation to the Main Menu in VTSM 1.

[inline:44_insert_call-vmg-pgc.jpg=center,assign the end jumps]

In order for navigation to get back to VTSM 1 from VTS's 2, 3, and 4, remember that we need to jump to the VMG first. So insert a Post-Command for those VTS's and set it to "Call VMG PGC 1."

[inline:44_navpack1_buttons.jpg=center,insert Post-command to Call VMG PGC 1]

Step 5: Button Commands And A Few Dummy VMG PGC's

Last but not least, we need to assign the four buttons on the Main Menu that target VTS 1 - VTS 4. Currently, the button commands found in Nav Pack 1 in VTSM 1 PGC 1 should look like this:

[inline:44_select_button_command-1.jpg=center,button commands found in Nav Pack 1]

Click the arrow next to Button Command 1 and set it to "Jump VTS TT." Since there is only a single title in VTS 1, we don't have a choice as to which one we select.

[inline:44_select_button_command-2.jpg=center,select Button Command 1]

[inline:44_insert_pre-command_jump-tt2.jpg=center,select Button Command 1]

Now, in order to jump from the Main Menu in VTS 1 to the program in VTS 2, we need to create a dummy PGC in the VMG because navigation cannot jump from VTS to VTS directly. Select VMG PGC 1, and control-click "Add Dummy PGC." Then insert the Pre-Command "Jump TT 2" into this new PGC, VMG PGC 2.

[inline:44_assign_button_command2.jpg=center,insert the Pre-Command Jump TT 2]

Create Dummy PGC's for VTS 3 and VTS 4, with Pre-Commands Jump TT 3 and Jump TT 4 respectively. Now, back at Nav Pack 1 in VTSM 1, assign Button Command 2 to "Jump VMG PGC 2" and repeat. The Button Commands should now look like this:

[inline:44_insert_pre-command_jump2.jpg=center,assign Button Command 2 to Jump VMG PGC 2]

You're finished! No more "obstruction layer" slowing things down. Go ahead - open the original and final VIDEO_TS folders and compare. Better yet, use DVDAfterEdit's "copy all PGC commands as text" function, paste into a text editor, and do a line count for each VIDEO_TS! The disc is down to the bare minimum of commands - and if we were to move the Main Menu in VTSM 1 to the VMG, we wouldn't need any dummy VMG PGC's either.

We'll actually try something like that in Simple DVD Spec. Re-authoring With DVDAfterEdit, Part 2, where instead of a project with 4 tracks, we'll re-author a similar project that has a track with 4 chapters, and an additional scene selection menu. Navigation originating from the scene selection menu will actually return there - unlike most "Hollywood" DVD's. The project will also feature greater use of GPRM's, Pre-Commands, and Post-Commands.

( We have Ian to thank (or stone, possibly?) for contributing "obstruction layer"... )

Simple DVD Spec. Re-Authoring With DVDAfterEdit, Part 2

Welcome to Part 2! Although the content is very similar, the layout of this project is very different from that of the 4 track project in Part 1, mainly, we're adding a scene selection menu, which will require a little more programming. I'll show you how to use 2 GPRM's and a decent variety of Pre- and Post-Commands to get this project working properly, and also discuss some DVD player default behavior governed by the DVD Specification. Spec. authoring gives the author more choices of how to organize and program a disc, and what is presented here is only one of several possibilities.

One quick note: this article refers to basic operations, terminology, and techniques found in Simple DVD Spec. Re-Authoring With DVDAfterEdit, Part 1. My intention is to focus on the new stuff, so please review Part 1 for more detail on certain subjects like "Title" and "Menu" remote key assignments, for example.

The "4 Chapter" project contains a 15 frame/1 GOP First Play in VTS 2, a track with 4 chapters in VTS 1, the Main Menu in the VMG, and the Scene Selection Menu in VTSM 1. There are no dummy menus (with one inconsequential exception), but there are a lot more commands. Unlike most Hollywood DVD's I've seen, navigation originating from the Scene Selection Menu on this disc returns there, even if the "Menu" remote key is activated. Activation of the "Title" remote key always returns navigation to the Main Menu with the proper button highlighted.

I chose to put the Main Menu in the VMG as it is the top-most menu in this disc's structure, while the Scene Selection Menu remains in VTS 1. Placing menus in the VMG can make programming easier and speed-up navigation as projects grow in size and complexity. Although the Scene Selection Menu could also reside in the VMG, this example will show some techniques for moving navigation between the VMG, VTSM, and VTS domains.

The file called "4CHAP.zip" contains the before and after DVDAfterEdit builds, and can be found in the member download area.

Adjusting The Layout

Here's the left pane of the DVDSP 3 build:

[inline:45_left_pane_dvdsp3.jpg=center,left pane of the DVDSP 3 build]

The first thing we need to do is move the Main Menu in VTSM 1 PGC 7 to the VMG. Select "VMG Menus" in the left pane, and then in the File menu select the "Replace Menu Vob�Ķ" command.

[inline:45_select_replace-menu-vob.jpg=center,select the "Replace Menu Vob�Ķ" command]

Choose VTS_01_0.VOB in the 4CHAP_ORIGINAL VIDEO_TS folder. VTSM menus are always located in the VTS_XX_0.VOB file, and DVD Studio Pro 3 always places 4:3 menus in VTS 1. The "Import Commands With VOB" option doesn't affect this project, since we'll be deleting them anyway. A progress bar will appear at the top of the right pane. This will finish quickly due to the size of the VOB being imported.

The like this in the left pane:

[inline:45_vmg_menus_displayed.jpg=center,VMG Menus now displayed]

Let's delete the dummy PGC's we don't need - which is almost all of them! Delete every PGC in the VMG except VMG PGC 7 (Main Menu). Notice how VMG PGC 7 has been automatically changed to VMG PGC 1. Then set its "entry PGC" parameter to "yes" so this PGC becomes the target for the "Title" remote key. As a quick reminder, I've included the two pictures below from the "4 Track" project discussed in Part 1. Please review the articlefor more information regarding these assignments.

[inline:45_4-track_project1.jpg=center,4 Track project]

[inline:45_4-track_project2.jpg=center,4 Track project]

Next, delete every PGC in VTSM 1 except for VTSM 1 PGC 8 - this is the Scene Selection Menu. Be sure to change its "entry PGC" and "Menu Type" parameters to "yes" and "root," respectively, so this PGC becomes the target for the "Menu" remote key.

Now delete all of the PGC's in VTSM 2. This remaining PGC is where our only dummy menu resides. This dummy PGC doesn't really serve any purpose for this disc because VTS 2 is the target of the First Play and has all user operations disabled. It will never call or navigate to its VTS menu.

Finally, delete all commands in the project with my favorite DVDAfterEdit 3 command, "Delete All Commands In Project." The left pane should now look like this:

[inline:45_delete_all_commands.jpg=center,Delete All Commands In Project]

GPRM Definitions

Now that the project's layout is set, it's time to dive into the fun stuff. I'm using only 2 GPRM's for this disc and their definitions follow below. I'll go into greater detail when we look at the programming for each area of the disc.

r0 = Menu Status

This GPRM is used to keep track of which menu navigation is going to and coming from. It keeps track of from where VTS 1 was activated - whether from the Main Menu or the Scene Selection Menu. It also handles what happens when the Title and Menu remote keys are activated, so navigation gets directed to the correct location. It also assists with how button highlights are determined for the Main Menu. This will be clearer in just a bit.

r1 = Scene Selection Menu button highlight

This GPRM is used to define which button will be highlighted while on the Scene Selection Menu. More detail to come...

All Commands Revealed!

The picture below shows all of the PGC's in this project and their respective commands. Feel free to insert all of these commands at any time. Details about their functions follow, PGC by PGC.

[inline:45_all_commands.jpg=center,All commands]

First Play

I use the First Play Pre-Command area to set up all of the values needed to start the disc. This can also be accomplished in various Pre- or Post-Command areas prior to the Main Menu, depending on the project. Here are the Pre-Commands:

[inline:45_first_play_pre-commands.jpg=center,First Play Pre-Commands]

GPRM 0 is set to a value of 0, and then navigation to jumps to VTS 2. Notice that the "Set" command set is being used. If you click on the command pull-down menu, you'll see several "Set" commands, including "Set GPRM." Although we are setting a GPRM, the generic "Set" is more versatile, allowing us to set several things, including values from SPRM's - which we'll do shortly. Also - in this instance - it has a cleaner look. If "Set GPRM" were used, the First Play Pre-Commands would look like this:

[inline:45_set-gprm_first-play.jpg=center,First Play Pre-Commands with GPRM set]

VTS 2: 15 Frames/1 GOP

Since navigation arrives here after the First Play, we may as well follow it. I make it a habit to start my discs with a track, and if there isn't any content that needs to display before the main menu, I use this - a VTS with 15 frames (1 GOP) of video and audio.

The only command in this PGC is a Post-Command that "calls" VMG PGC 1, which directs navigation to the Main Menu.

VTSM 2: Dummy PGC

Might as well get this out of the way - again (just being thorough...). To recap., this PGC serves no purpose except to exist - though technically I don't think it even needs to do that. As of now, we cannot delete the VTSM without deleting the entire respective VTS - which we don't want to do. So "just in case," I've inserted the "Jump VMG PGC 1" command. Before we move onto the bulk of the commands in this project, let's take a look at VTS 1.

VTS 1: Track w/4 Chapters

VTS 1 is the main "show" on this disc, and has 4 chapters. These chapters are accessed from the Scene Selection Menu by using Jump VTS_PTT as a button command. VTS 1 has the following Post-Commands, but no Pre-Commands:

[inline:45_vts1_post-commands.jpg=center,VTS 1 with Post-Commands]

Line 1: If GPRM 0 is equal to a value of 1, then navigation goes to line 3, skipping the command in line 2.

Line 2: So if GPRM 0 is not equal to a value of 1, then navigation "Calls" (or jumps) to the Main Menu, which is VMG PGC 1.

Line 3: This line instructs navigation to jump to the VTSM of VTS 1, which is the Scene Selection Menu.

Setting up VTS 1 like this prevents any unnecessary domain and/or PGC jumping. Wherever navigation originated to get to this VTS, it immediately returns. Of course Pre-Commands could be inserted depending on what is required by the disc. But keep in mind that when a PTT (chapter) in a VTS (show) is being directly accessed via the Jump VTS_PTT command, navigation visits the Pre-Command area of the PGC before jumping to the chapter - so any commands there will execute. In fact, a lot of things happen before navigation gets to the chapter via Jump VTS_PTT, according to the DVD Specification:

1) Stop the current presentation.

2) Discard the RSM [Resume] Info (if it exists), Assign '0' to SPRM 9 to stop the Nav timer.

3) Set SPRM 1 and SPRM 2 [Audio Stream & Subpicture Stream]

4) Execute the command in the Pre-Command Area of the PGC in which the PTTN [Part of Title Number] is found.

5) Start the presentation of the PTT [Part of Title a.k.a. chapter], which is specified by the PTTN and VTS_TTN [Video Title Set Title Number] within the current VTS-space.

So in order for this disc to operate correctly as programmed, no Pre-Commands have been inserted in VTS 1.

VMG: Main Menu

Here are the Pre-Commands for the VMG:

[inline:45_vmg_pre-commands.jpg=center,Pre-Commands for the VMG]

Isolated in this way, these Pre-Commands may be a little tricky to understand since they work in relation to other commands in the project. I'll review them line by line, and you may find it helpful to look at the picture above that shows all of the commands in the project.

Line 1: If GPRM 0 is equal to a value of 0, then go to line 4. Remember that GPRM 0 is used to keep track of menu-related navigation. At the First Play, since GPRM 0 is set to the value of 0, navigation moves to line 4 - skipping the commands in lines 2 and 3 the first time through.

Line 2: So if GPRM 0 is not equal to a value of 0, navigation forces a value of 2048 into SPRM 8, in order to highlight button number 2.

Line 3: Once the button is set, navigation skips to line 5.

Line 4: This command sticks a value of 1024 into SPRM 8 in order to have button number 1 highlighted.

Line 5: GPRM 0 gets reset back to a value of 0, since navigation has arrived (and will currently stay) at the Main Menu. If navigation originated from the Main Menu (or the First Play), this value is already set to 0 - so nothing changes.

The "GoTo Line" commands set up a bunch of conditions, and are configured in such a way as to control exactly what happens when navigation enters the Main Menu. So for example, if the disc is started and the show is activated by button 1 on the Main Menu, GPRM 0 will stay equal to 0. When the show is finished playing, navigation will first execute the Post-Commands in VTS 1. If navigation is directed back to the VMG/Main Menu, it checks the first line, skips to line 4, sets button 1 to highlight, and finally resets GPRM 0 to 0 (which it already is). This may seem like quite a few steps just to get button 1 to highlight, but how many steps do abstraction layer authoring applications use? They send navigation all over the place, jumping from PGC to PGC and line after line of commands, slowing the responsiveness of the DVD. These Pre-Commands also function correctly if the Title and Menu remote keys are activated. Since the Title remote key is hard wired to VMG PGC 1, whenever it's activated navigation comes here first. If you look at the disc's layout picture above, there are Pre-Commands in VTSM 1 ( which VTS 1's Menu remote key is hard wired to ) that will redirect navigation to the Main Menu if that is where it originated. For more detail on how this works, please see Part 1.

The Button Commands are simple enough:

[inline:45_vmg_button_commands.jpg=center,VMG Button Commands]

Button 1's instruction jumps navigation to VTS 1, which has no Pre-Commands. Button 2's Link TailPGC instruction jumps navigation to the Post-Command area of VMG PGC 1 - the current PGC. Since a button can generally only have a single command, this is a great alternative to jumping to a dummy menu if more instructions are required. In this case, we need to change a GPRM value and set a button (force a new value into SPRM 8) before we jump to the Scene Selection Menu, our final target. The Link TailPGC command is part of the Link Sub-Ins (Link Sub-Instruction) command set. "Link" commands are often used to move navigation within a PGC, like to a different Cell. A common example is the use of Link TopC (Link Top Cell) to loop a motion menu.

Here are the Post-Commands for the VMG PGC 1, which in this project are only accessed from button 2 of the Main Menu:

[inline:45_vmg_post-commands.jpg=center,Post-Commands VMG]

GPRM 0 gets changed to a value of 1, the button number gets set to 1, and navigation leaves the Main Menu and jumps to VTSM 1, the Scene Selection Menu. I'm using the "Set Button" command to force the value of SPRM 8 to 1024, because the first time navigation arrives at the Scene Selection Menu, button 1 should be highlighted. If this command is not used, then button 2 will be highlighted because the last selected/activated button was button 2 on the Main Menu, which would make the value of SPRM 8 equal 2048. Later I will go into some detail concerning some DVD Specification rules that govern how DVD players determine which button to highlight in certain situations.

VTSM 1/Scene Selection Menu

These are the Pre-Commands for VTSM 1:

[inline:45_vtsm_pre-commands.jpg=center,Pre-Commands for VTSM]

Line 1: If GPRM 0 is equal to a value of 1, navigation skips to line 3. There is only one instance when navigation would not skip to line 3, but move down to line 2. Pop quiz: do you know when this would happen?

Answer: if VTS 1 was activated from the Main Menu (GPRM 0 == 0) and the menu remote key was activated during the show. If you are not clear on why this is, check Part 1 of this article series! : )

Line 2: Navigation not skipping to line 3 gets sent to the Main Menu.

Line 3: This command assigns the value of SPRM 8 to GPRM 1.

Line 4: The value in GPRM 1 assigns the button highlight.

Before I explain what is happening here, let's take a quick look at the Button Commands:

[inline:45_vtsm_button_commands.jpg=center, VTSM Button Commands]

Buttons 1 - 4 jump to their respective PTT's (Parts of Title - or chapters). Button 5 sends navigation to the Main Menu.

In order to get the correct button to highlight upon arrival (or return) to the Scene Selection Menu, I'm using GPRM 1 to set the button highlight from the value in SPRM 8. When navigation gets sent to the Scene Selection Menu from the Main Menu, button 1 is highlighted because a value of 1024 was forced into SPRM 8 upon leaving the Main Menu.

If chapter 3 is played by the activation of button 3, 3072 is immediately stored in SPRM 8. When the show finishes (or the menu remote key is activated) and navigation returns, the commands instruct GPRM 1 to grab the value of SPRM 8, and set the button highlight accordingly.

No VTSM 1 Post-Commands are necessary for this example project.

Do We Really Need All Of These Commands?

The majority of commands in this project are used to 1) highlight the desired button, and 2) select the menu that the button was activated from in the first place - no matter the cause (end of show, Title or Menu remote key activation, etc.). The DVD Specification has a few default rules DVD players are supposed to follow that apply when there is no forced button selection:

a) When Force Select Button is set, the value of Force Select Button is assigned to SPRM (8).

b) When Force Select Button is not set,

b-1) If the current value of SPRM (8) is equal to or less than the number of Buttons during the period, SPRM (8) is unchanged.

b-2) If the current value of SPRM (8) is greater than the number of Buttons during the period, the value of SPRM (8) is set to the largest BTNN.

Force Select Button is usually assigned in the authoring application. DVD Studio Pro 3 refers to this as "Default Button." The parameter can also be assigned with DVDAfterEdit, and can be found on the 2nd to last line of "Button Highlights" in the Nav packs.

[inline:45_force_select_button.jpg=center,Force Select button parameters]

The 4 Chapter project does not use any Force Select Buttons - the button highlights are assigned throughout the various Pre- & Post-Commands. To see how these rules work, first take a look at this modified version of the 4 Chapter disc:

[inline:45_mod_version_4-chapter.jpg=center,modified version of the 4 Chapter disc]

Notice how nearly all of the commands to control button highlights have been removed, with only three exceptions. A "Set Button 1" Pre-Command has been added to the First Play so the correct button highlights when the DVD starts (just for safety), a "Set Button 2" command remains in the VMG Pre-Command area, as well as a "Set Button 1" command in the VMG Post-Command area. Otherwise, the Pre-Commands are only used to direct navigation when the show finishes playing, or if the Title or Menu remote keys are activated. This version of the 4 Chapter project will behave just like the more elaborate previous version in DVDAfterEdit's 3's Tracer function, and in theory, all DVD players. Let's apply the above DVD Specification rules - here they are again:

a) When Force Select Button is set, the value of Force Select Button is assigned to SPRM (8).

b) When Force Select Button is not set,

b-1) If the current value of SPRM (8) is equal to or less than the number of Buttons during the period, SPRM (8) is unchanged.

b-2) If the current value of SPRM (8) is greater than the number of Buttons during the period, the value of SPRM (8) is set to the largest BTNN.

a) Doesn't apply. SPRM 8 keeps track of that last selected/activated button, and a Force Select Button replaces whatever value was previously in that register. Though this project does have three instances of a "Set Button" Command forcing the value of SPRM 8 to change, navigation always determines which button should be highlighted, not the Force Select Button parameters. If the Force Select Button parameters were set, the highlighted button number would never change for a given menu.

One quick thing - the first two VMG Pre-Commands are only there to ensure that button 2 is highlighted if the Title remote key is activated when navigation originates from the Scene Selection Menu. If they are removed that functionality is lost, but the Force Select Button rules will highlight the correct button automatically for all other situations. Here's how it works:

b-1) To play the show from the Main Menu, button 1 needs to be activated. When this happens, a value of 1024 is immediately stored in SPRM 8. When the show finishes playing, navigation returns to the Main Menu, and sees that it has two buttons. Since the number of buttons hasn't changed, SPRM 8 is unaffected, and the DVD player highlights button 1 by referencing the value of SPRM 8.

To navigate to the Scene Selection Menu, button 2 on the Main Menu needs to be activated. When this happens, a value of 2048 is immedately stored on SPRM 8. Before navigation leaves the Main menu, however, it's instructed to change SPRM 8 to 1024, because button 1 should be highlighted upon arrival. What happens if the value of SPRM 8 isn't changed? Button 2 would be highlighted on the Scene Selection Menu upon arrival, because the DVD player would find a value of 2048 in SPRM 8. Since the Main Menu has only two buttons as compared to the five buttons on the Scene Selection Menu, the value of SPRM 8 will always be less than the maximum value of SPRM 8 that the Scene Selection Menu can accommodate (5120 is the value for button #5). So in this instance, SPRM 8 will not be affected (remember, by player default), according to rule b-1, because the Main Menu's maximum SPRM 8 value is only 2048.

Another example of how b-1 works would be if button 4 (Chapter 4) were activated on the Scene Selection Menu. Navigation would play chapter 4 then return. Since the number of buttons hasn't changed, SPRM 8 would not be affected, and button 4 would be highlighted. Now, rule b-2...

b-2) To navigate from the Scene Selection Menu to the Main Menu, button 5 needs to be activated - which will make the value of SPRM 8, 5120. When navigation reaches the Main menu, 5120 cannot be directly accommodated, as there are only two buttons. According to rule b-2, the highest button number will be highlighted - in this case button 2.

So, are all these commands that control the highlighted button numbers really necessary? Just a little while ago, I mentioned that this modified 4 Chapter disc will behave in DVD players the same way as the slightly more elaborate version - in theory. The truth is, not all DVD players are created equal - hence the ongoing issue that even replicated DVD's that are supposedly 110% perfect may not be compatible with every DVD player ever made - let alone all of the other DVD's floating around out there. For the sake of compatibility, and the fact that as DVD authors, we need to control how a disc functions as opposed to the player, these commands are... well... recommended. They don't allow the DVD player to make any decisions - it will just follow instructions - something players usually do well. As long as the instructions are good, everything should work as expected.... in theory!

Conclusion


I hope you have found these first two articles helpful, and I hope they inspire you to spec. re-author your discs. The more I re-author in DVDAfterEdit, the more necessary I believe it is. Just recently, a client of mine even noticed the difference. I updated his DVD with some new content, and then re-authored the project, eliminating all of the "obstruction layer" commands and PGC's. He commented that the disc is much more responsive than before, even in his old PowerBook - which often has problems with all kinds of DVD's.

These techniques are expanded further in Simple DVD Spec. Re-Authoring With DVDAfterEdit, Part 3, where I will show how to add a Scene Selection menu that "knows" which chapter has just been played; using composite commands and a different way of tracking button highlights.

Simple DVD Spec. Re-Authoring With DVDAfterEdit, Part 3

by Ben Weinrach

(Editors note: Just so you know, it is best to start with Part 1 and Part II of this series before beginning this Part 3 installment)

Adding a Second Scene Selection Menu and "Composite Commands"

Ready for some more spec. re-authoring fun? Great! The project discussed in this article is similar to the previous project, but with two significant differences. While the "show" still has four chapters and the structure is basically the same, there is now a second scene selection menu. In addition, the button highlight upon return to the scene selection menus is not handled by the last activated button like before, but is determined by the last chapter/PTT that played. This project also introduces "Composite Commands," which are used here to set a GPRM and link to another PGC, all within a single command line. Composite Commands can be extremely handy when used with buttons, since buttons can only have one command.

Using the last PTT to determine the button highlight is not very common, but some (if not all) of the more recent releases by the Criterion Collection use this technique. Though possibly a little disorienting at first, I think it makes a lot of sense, depending on the content. Once a chapter is activated from a scene selection menu, the show plays as usual. Whether the user allows the show to play through to another chapter or skips a chapter with the remote (backwards or forwards), the button that corresponds to the current playing chapter is highlighted upon return by the activation of the remote menu key. Note that if this button is on a different scene selection menu from the button that activated the show originally, the DVD player will display the correct menu! So the disc is not telling us where we started, but where we ended - or what we were just watching. This is exactly how the demo project presented here functions, though on a much smaller scale than a feature length movie with more than 20 or so chapters.

This article refers to basic operations, terminology, and techniques found in Simple DVD Spec. Re-Authoring With DVDAfterEdit, Parts 1 & 2. My intention is to focus on the new stuff, so please review the previous articles for more detail on certain subjects like "Title" and "Menu" remote key assignments, for example.

The "2 Scene Select PTT" project contains a 15 frame/1 GOP First Play in VTS 2, a track with 4 chapters in VTS 1, the Main Menu in the VMG, and Scene Selection Menus in VTSM 1 PGC 1 and VTSM 1 PGC 2. There are no dummy menus (still with one inconsequential exception).

» Click here to download before and after DVDAfterEdit build files for this "2 Scene" example project. Note that the original build is not fully programmed and will not play correctly, if at all.

Please note that as of this writing, this new demo project will not simulate 100% correctly with Tracer, as the use SPRM 7 has not been fully integrated yet.

Adjusting The Layout

Here's the left pane of the finished structure:

[inline:46_finished_left_pane.jpg=center,left pane of the finished structure]

The first thing we need to do is move the Main Menu (VTSM 1 PGC 7) to the VMG - same as before. Once imported with the "Replace Menu Vob" command, delete all of the PGC's except for PGC 7. Be sure to double check that the Main Menu PGC's "entry PGC" parameter is set to "yes," in order for the remote title key to function.

Next, delete every PGC in VTSM 1 except for PGC 8 and PGC 9 - these are the Scene Selection Menus. Again, check the newly renamed PGC 1 (which is the menu for Scenes 1-2) to make sure its "entry PGC" and "Menu Type" parameters are set to "yes" and "root," respectively, in order for this PGC to become the target for the "Menu" remote key.

Now delete all of the PGC's in VTSM 2. This remaining PGC is our only dummy menu.

And to finish the structure use my favorite step, "Delete All Commands In Project."

GPRM Definitions

Now that the project's layout is set, it's time to re-author. I'm using only 2 GPRM's for this disc and their definitions follow below. I'll go into greater detail when we look at the programming for each area of the disc.

r0 = Menu Status

This GPRM is used to keep track of which menu navigation is going to and coming from. It keeps track of from where VTS 1 was activated - whether from the Main Menu or either of the Scene Selection Menus. It also handles what happens when the title and menu remote keys are activated, so navigation gets directed to the correct location. It also assists with how button highlights are determined for the Main Menu.

r1 = Ultimately determines the button highlight for the Scene Selection Menus

This GPRM is used to define which button will be highlighted while on the Scene Selection Menus, but is a little more complicated than before. There are more possible values for r1 this time around because... well, I'll get to that shortly!

All Commands Revealed!

The picture below shows all of the PGC's in this project and their respective commands. Go ahead and insert all of these commands now. Details follow for only the PGC's that are different from those in Part 2.

[inline:46_all_commands.jpg=center,All PGC's in this project]

First Play

This is exactly the same as in Part 2...

VTS 2: 15 Frames/1 GOP

This is also exactly the same as in Part 2...

VTSM 2: Dummy PGC

Same as Part 2...

VTS 1: Track With 4 Chapters

Not quite the same as Part 2 - finally!

[inline:46_vts1_track_4chapters.jpg=center,VTS 1: Track With 4 Chapters]

Line 1: If GPRM 0 is equal to a value of 1, then navigation goes to line 3, skipping the command in line 2.

Line 2: So if GPRM 0 is not equal to a value of 1, then navigation Calls VMG PGC 1, which is the Main Menu.

Line 3: This sets GPRM 1 to a value of 5, setting a value for "end of show" status, which will be explained later.

Line 4: This line instructs navigation to jump to the root-designated VTSM of VTS 1, which is the Scenes 1-2 Selection Menu.

VMG: Main Menu

Surprise! These are the same Pre-Commands and Button Commands as before, but the post-Commands are slightly different:

[inline:46_vmg_main_menu.jpg=center, VMG Main Menu]

Line 1: GPRM 0 gets set to a value of 1.

Line 2: GPRM 1 gets set to a value of 0.

Line 3: Navigation jumps to the root menu of VTS 1, which in this disc is VTSM 1 PGC 1.

VTSM 1 PGC 1: Scenes 1-2 Selection Menu

Here are the Pre-Commands for VTSM 1 PGC 1 - all lucky thirteen lines worth. This gauntlet isn't too scary...

[inline:46_vtsm1_pre-commands_13lines.jpg=Pre-Commands for VTSM 1 PGC 1]

Line 1: If GPRM 0 is equal to a value of 1, navigation skips to line 3.

Line 2: If GPRM 0 is not equal to a value of 1, then navigation jumps to the Main Menu/VMG.

Line 3: If GPRM 1 is not equal to a value of 0, then navigation skips down to line 6.

Line 4: If GPRM 1 is equal to a value of 0, then it is set to a value of 1024 in order for button 1 to highlight.

Line 5: After GPRM 1 is set to 1024, navigation is instructed to skip down to line 13.

Line 6: If GPRM 1 is not equal to a value of 5, then navigation skips to line 9.

Line 7: If GPRM 1 is equal to a value of 5, then it is set to a value of 4.

Line 8: Once GPRM 1 is set to a value of 4, navigation jumps down to line 11.

Line 9: This sets GPRM 1 to the value stored in SPRM 7, which is the last PTT or chapter that played.

Line 10: If the value of GPRM 1 is less than 3, then navigation skips to line 12.

Line 11: If the value of GPRM 1 is equal to 3 or greater (i.e. 4), then navigation links to VTSM 1 PGC 2, which is the Scenes 3-4 Selection Menu.

Line 12: This command multiplies the value of GPRM 1 by 1024, in order to get the correct button to highlight. Notice in the pulldown menu for *= the other possible operations available.

[inline:46_command_button_hilite.jpg=command to get correct button to highlight]

Line 13: This sets the button to highlight from the value stored in GPRM 1.

There are some interesting things going on here. Here's how it works:

Scenario 1: The Show in VTS 1 is played by the activation of the "Play Movie" button on the Main Menu. If the user activates the menu remote key during playback, navigation will target VTSM 1 PGC 1 because it is the root menu of VTS 1. Since the value of the Main Menu is 0 (r0 == 0), navigation will immediately exit this PGC and jump to the Main Menu.

Scenario 2: The "Scene Selection" button on the Main Menu is activated. GPRM 0 is set to 1 because navigation is going to the Scenes 1-2 Selection Menu. GPRM 1 is set to a value of 0, in order to indicate that navigation will be entering the Scenes 1-2 Selection Menu from another menu. Once at the Pre-Command area for the Scenes 1-2 Selection menu, navigation will skip down to command line 3 because r0 = = 1. Since r1 = = 0 at this point, the value of r1 is changed to 1024. Button #1 is then set to highlight at line 13.

Scenario 3: The show is played via activation of button # 1(Chapter 1), located on the Scenes 1-2 Selection Menu. Before reaching PTT 2/Chapter 2, the menu remote key is activated. Navigation returns to the root menu of VTS 1, checks the first Pre-Command, and skips down to line 3. Since the value stored in r1 is currently 1024, navigation skips down to line 6. Obviously 1024 is not equal to 5, so navigation skips down to line 9. Here, the value of r1 is change to the value stored in SPRM 7, which is 1, for PTT 1/Chapter 1. At the next line, navigation checks if the value of r1 is less than 3, which it is. This determines which Scene Selection Menu is the final destination. The value of r1 is then multiplied by 1024, in order to get a legal button number value. Button 1 finally is set to highlight.

Scenario 4: The show is played via activation of button # 1(Chapter 1), and the menu remote key is activated between Chapters 2 and 3. Everything works just like Scenario 3, except at line 9, the value stored in SPRM 7 is now 2. Since 2 is less than 3, navigation remains in this PGC, and button 2 is set to highlight because r1 is now equal to 2048.

Scenario 5: The show is played via the activation of either button 1 or 2 on the Scenes 1-2 Selection Menu, and the menu remote key is activated between Chapters 3 and 4. Once back at line 9, r1 gets changed to a value of 3 (for PTT 3). Since 3 is not less than 3, line 11 executes and navigation links to PGC 2 - which is the Scenes 3-4 Selection Menu.

Scenario 6: The show is played via the activation of any Scene Selection Menu button, and plays until its end. In VTS 1's Post-Command area, navigation skips to line 3 because r0 = =1. At line 3, r1 is set to a value of 5, and then navigation jumps to the Pre-Command area of VTSM 1 PGC 1. Navigation gets to line 6, and since 5 = 5, r1 is then set to a value of 4. Navigation then skips down to line 11, where it links to VTSM 1 PGC 2.

Although Chapter 4 should be the last PTT that played in Scenario 6, I'm using the "end of show" value of 5 in r1 as a safety net in case the DVD player gets any ideas about changing the value of SPRM 7 after navigation leaves VTS 1. This way there are instructions for the DVD player to follow for every possible navigation scenario.

Unlike the project in Part 2, the chapter selection buttons have no relation to what button gets highlighted upon return. The user could also skip chapters while playing the show - forwards or backwards - activate the menu remote key, and the Per-Commands take care of the rest!

Here are the Button Commands for VTSM 1 PGC 1:

[inline:46_button_commands_vtsm1.jpg=center,Button Commands for VTSM 1 PGC 1]

Buttons 1 and 2 (for Chapters 1 and 2, respectively), target the corresponding PTT, just like the previous project. Button 3, which targets the Scenes 3-4 Selection Menu, is using what's called a "Composite Command." GPRM 1 is set to a value of 3, and the "link" option is enable in order to link to PGC 2. Two instructions, one command line! They're great for use with buttons, since buttons can only have a single command line. The "link" option allows for jumping - or linking - to PGC's within the same domain, PG's and Cells within the PGC, and the other DVD Spec. legal operations shown in the pulldown. Lastly, Button 4 jumps to the Main Menu.

[inline:46_link_option.jpg=link options]

[inline:46_link_to_pgc.jpg=link to PGC's]

VTSM 1 PGC 2: Scenes 3-4 Selection Menu

Here are the Pre-Commands:

[inline:46_vtsm1_pre-commands.jpg=VTSM 1 PGC 2 Pre-commands]

Line 1: If GPRM 1 is not equal to a value of 4, navigation skips to line 4.
Line 2: If GPRM 1 is equal to a value of 4, then GPRM 1 is set to a value of 2048, in order to highlight button 2.
Line 3: Once the GPRM is set in line 2, navigation skips to line 5.
Line 4: Target of line 1 - GPRM 1 is set to a value of 1024.
Line 5: Button highlight is determined by the value stored in GPRM 1.

Remember that a menu remote key activation during playback of VTS 1 cannot target this menu directly, as it is not designated as root. That being the case, fewer Pre-Commands are needed here because the PTT value has already been determined by the time navigation enters this PGC. Another thing to keep in mind is that while the PTT values for the chapters on this menu are 3 and 4, the buttons to be highlighted are 1 and 2. If the value of r1 were changed to 3072 or 4096 prior to entering this menu (by pre-Command line 12 in VTSM 1 PGC 1), these values would need to be changed again to get the correct button to highlight once navigation reached Pre-Command line 5. An alternative might be to use "Set Button" commands targeting specific buttons instead of referring to a GPRM, but this may not reduce the total number of command lines.

Here are the Button Commands:

[inline:46_vtsm1_button_commands.jpg=VTSM 1 Button Commands]

They are very similar to those of VTSM 1 PGC 1. Buttons 1 and 2 target PTT's 3 and 4 respectively, and a Composite Command is used for Button 3. This time r1 is set to 0, which is the same state as if navigation originated from the Main Menu via the activation of the Scene Selection button. Again, Button 4 jumps to the Main Menu.

Conclusion

Though not very common, this highlight via PTT technique may prove useful for various navigational needs. Hopefully, it has also shown how other SPRM's can be used to assist in determining the highlighted button number, besides that mundane SPRM 8...

Spec. Authoring Menu Transitions & A Multi Stream VTS

by Ben Weinrach
Requires DVDAfterEdit Standard

Well, it had to happen sooner or later - the project discussed in this article doesn't really qualify as "simple" spec. re-authoring. Not because it's overly complex, but because there are a lot of things going on thanks to DVDAfterEdit programmer Larry Applegate. Some time ago, Larry put this "Liquid Lifestyles" DVD together and was kind (?) enough to pass it along to me for further DVDAfterEdit optimization. Thanks Larry!

» Click here to download example files for this project.

This DVD project contains a First Play with 15 frames/1 GOP black video (VTS 2), a main program containing four chapters with two audio and subtitle streams, a main menu, and three sub-menus (chapter, audio, and subtitle selection). All of the menus feature intro and outro transitions with audio. The primary area of interest from the DVDAfterEdit point of view is that all of the menus and their respective transitions reside in the same VMG VOB. This design allows for not jumps, but links between all of the menus - therefore reducing (if not eliminating) DVD player menu search time. Navigation performance is fast thanks to the absence of DVDSP 3's abstraction-layer programming. If you've ever wondered why many "Hollywood" DVD's have quick navigation and low DVD player search times when using transitions, read on!

From the spec. authoring point of view, this project also introduces an important DVD feature not covered in my previous articles: the main program featured on this disc contains two audio and two subtitle streams. These streams can be setup either via their respective menus or via the remote audio and subtitle keys while the show is playing. The disc is authored in such a way that if the user changes streams... well, mid-stream (sorry!) during the show, the button highlights upon return to either of the stream setup menus will automatically reflect this change. In addition, the stream settings "stick" until the user changes them again. Whether the show is exited via the remote title or menu keys or is allowed to play until its end, the DVD player will check the status of the audio and subtitle streams and update two GPRM's and button highlights accordingly.

As usual, only a minimum of programming was completed in DVDSP 3. In fact, it's impossible to author this disc as it currently functions and performs with DVDSP 3. Menus setup this way can only be assembled in a DVDSP 3 track, and buttons residing in a track cannot be specifically targeted - let alone buttons residing at various markers throughout the track's timeline! Also remember that DVDSP 3 does not give the author access to the Video Manger Domain. Unlike previous articles, however, only the final DVDAfterEdit build is available in the member download area due to the relatively large file size. Although the assets are encoded at extremely low bitrates, there are a total of fourteen pieces of video (with matching audio) required for the menus and transitions.

If you haven't checked out Ian's recent Advanced Techniques - Manipulating Menus article, please do so. He goes into great detail regarding menu VOB's, the setup of which is briefly outlined in the next section. This article also assumes you have reviewed previous Spec. Re-Authoring articles. If you need more information about DVDAfterEdit functionality or some of the programming techniques and etiquette presented here, please refer to those articles.

[Please note that as of this writing, Tracer does not simulate this project correctly]

Menu Setup In DVDSP 3

Below is a picture of the menus and transitions built in a DVDSP 3 track:

[inline:43_menus_transitions.jpg=center,menus and transitions built in a DVDSP 3 track]

These menus and transitions were assembled in FCP, and then output as individual video and audio files. The video files were then converted to MPEG-2 and the audio files were individually encoded with A.Pack - nothing out of the ordinary. All of these assets were then imported into DVDSP 3, and finally assembled on a track's timeline. Here's how the menus are organized on the timeline:

  1. DVD Intro to Main Menu transition
  2. Main Menu
  3. Main Menu to Chapter Selection Menu transition
  4. Chapter Selection Menu
  5. Main Menu to Audio Selection Menu transition
  6. Audio Selection Menu
  7. Main Menu to Subtitle Selection Menu transition
  8. Subtitle Selection Menu
  9. Chapter Selection Menu to Main Menu transition
  10. Main Menu
  11. Audio Selection Menu to Main Menu transition
  12. Main Menu
  13. Subtitle Selection Menu to Main Menu transition
  14. Main Menu

These menu bits are designed in such a way that each menu is comprised of 2 Cells. The first Cell is the transition into the menu, and the second Cell is the menu itself. Outro transitions that leave a submenu to go back to the main menu are handled the same way - they are "attached" as Cell 1 to the menu being navigated towards, not Cell 3 of the menu they are leaving. The key is to prevent the pause between the transition and the menu; to do that for this disc the main menu has to appear four times on the DVDSP track timeline, since there are four transitions leading to it.

Having four Main Menus may seem a little strange, but if done correctly this will never be apparent to the user (unless you want it to be). The only possible pitfall is not so much the extra programming (which is quick and easy), but the greater disc space required. If your DVD is tight for space but you want to use transitions, one option is to avoid using outro transitions back to the main menu. Transitions from sub-menus back to the main menu are not very common and may require main menu duplication depending on the design. Another alternative would be to avoid using audible audio during the transitions (or just the outro transitions) because audio dropping out is more jarring than a slight video pause in most cases.

Notice how the audio is broken into separate segments. Although a single stream could be used instead, the use of segments can help to better and more easily define the audio in regards to the PGC/Chapter boundaries. Although to have "complete" PGC's all menus should contain an audio stream, there is another practical purpose. Surround-Sound systems generally auto-detect the audio stream. This auto-detection will be faster and smoother if the presence of an audio stream remains the same from menu to menu. Sometimes DVD's that have audio on some menus (but not all menus) will have their audio clipped at the beginning of a menu because the system is trying to figure out if a stream is present. If all of the PGC's/menus contain audio (whether it is audible or not), this is less of a problem. Please remember that all audio streams in menus need to be of the same file & channel format.

When assembling all of the files on a DVDSP track timeline, be careful to make sure there aren't any video gaps, and that the individual audio files are aligned correctly. Since audio files do not adhere to a frame count, they may not match the video exactly - they are often offset by less than a frame. Just make sure to match the marker/chapter and audio segment start times. If an audio segment exceeds the start of the next marker, trim its length if this prevents the proper alignment of the next adjacent audio file. At this stage, don't worry about small audio stream gaps you may see on the timeline until you check the final build. If you can hear them, then worry!

No programming of this soon-to-be menu VOB is required (or even worthwhile) at this stage since it won't be used. Remember to draw/setup the buttons for each overlay and be sure to double-check that each overlay is set to "force display."

[inline:43_force_display.jpg=center,set each overlay to force display]

VMG Import And Setup With DVDAfterEdit

Once the track containing all of the menus has been multiplexed with DVDSP 3, it's ready to be imported into the VMG with DVDAfterEdit's "Replace Menu VOB" command. To do this, open the desired VIDEO_TS folder in DVDAfterEdit and click on "VMG Menus" in the left pane. Then in the "File" menu select "Replace Menu VOB." Once the VOB containing the menus has been selected, DVDAfterEdit will import the VOB into the VMG. Note that since these menus were created in a DVDSP track, the file is labeled as VTS_XX_1.VOB, not VTS_XX_0.VOB. For more detail regarding this procedure, please refer to Simple DVD Spec. Re-Authoring... Part 2 and/or Advanced Techniques - Manipulating Menus.

In this example, revealing the VMG PGC's shows a single PGC with fourteen programs - one for each menu "chapter" listed above. These various menu chapters need to be organized into separate PGC's, each with their own command areas. This DVD requires three Dummy PGC's (1, 9, & 10) and seven Program PGC's (2 - 8). Since these PGC's are connected via Link Commands (i.e. all in the same domain), their respective PGC numbers probably do not make much difference because the physical location of each Cell remains the same in the VOB. The most important thing is the use of adjacent Cells for transitions into menus. Below is how the PGC's were created for this project:

  1. Control-click VMG PGC 1, select "Add Dummy PGC" - this PGC is set as the "entry PGC" - the target of the title remote key
  2. Control-click VMG PGC 1, select "Duplicate PGC" - repeat until there are eight Program PGC's
  3. ontrol-click any VMG PGC, select "Add Dummy PGC" - repeat one time
  4. Delete VMG PGC 1 - notice how DVDAfterEdit changes the PGC numbers

Now we need to adjust the program PGC's so they contain the desired menus. For this, we use DVDAfterEdit's powerful Program Chain Program Map Interface:

[inline:43_program_chain_program_map_interface.jpg=center,Program Chain Program Map Interface]

The left side displays the Cell(s) present in the selected PGC; the right side displays all of the available Cell(s) in the VOB. Adjusting which Cell goes where is as simple as drag & drop. In this case, each PGC is only supposed to contain two Cells; so twelve Cells need to be removed from each PGC. Simply select each undesired Cell from the left pane and drag it to the "Available Cells" pane. Here's how the Cells are organized on this disc:

PGC 2: Cell ID 1 (DVD Intro to Main Menu transition) & Cell ID 2 (Main Menu)
PGC 3: Cell ID 3 (Main Menu to Chapter Selection Menu transition) & Cell ID 4 (Chapter Selection Menu)
PGC 4: Cell ID 5 (Main Menu to Audio Selection Menu transition) & Cell ID 6 (Audio Selection Menu)
PGC 5: Cell ID 7 (Main Menu to Subtitle Selection Menu transition) & Cell ID 8 (Subtitle Selection Menu)
PGC 6: Cell ID 9 (Chapter Selection Menu to Main Menu transition) & Cell ID 10 (Main Menu)
PGC 7: Cell ID 11 (Audio Selection Menu to Main Menu transition) & Cell ID 12 (Main Menu)
PGC 8: Cell ID 13 (Subtitle Selection Menu to Main Menu transition) & Cell ID 14 (Main Menu)

It may seem a little inefficient to remove twelve Cells for each PGC instead of just creating a new PGC and dragging the two required Cells into it. But the key thing to remember is that these Cells will not work correctly if they don't contain audio and subpicture stream information. This original PGC must be duplicated at least once (then the newly created Program PGC further duplicated, etc.) - creating new dummy PGC's will not work. New Program PGC's must be created from Program PGC's, not Dummy PGC's because dummy PGC's do not contain any audio or subpicture stream information. The image below compares Program and Dummy PGC parameters:

[inline:43_comparing_program_dummy_PGC_parameters.jpg=center,comparing Program and Dummy PGC parameters]

There are quite a few important parameters missing from the Dummy PGC. Although Cell ID's can be dragged & dropped in Dummy PGC's, if stream information parameters are not present, the DVD will not function correctly in all players!

All Commands Revealed!

The image below shows all of the commands per PGC used for this DVD. Since the image is so large, I recommend printing it on US legal (14") paper using OS X's Preview application (which will do a serviceable job of automatically scaling the image).

[inline:43_all_PGC_commands.jpg=center,all PGC commands]

Why so large? Well, there are a lot of menu PGC's with several buttons each, in addition to a few important dummy PGC's. But most of the "action" takes place in VTS 1, which is the main "show."

GPRM Definitions

GPRM 0: This register is used to keep track of whether a menu transition needs to be played. At each menu, navigation checks to see if this value has been updated. If it has not, the value is updated and the menu transition is played. If it has been updated, navigation skips the menu transition. These are the value assignments:

0 = DVD start
1 = indicates DVD Intro has played/Main Menu status
2 = indicates Chapter Selection Menu transition has played/Chapter Selection Menu status
3 = indicates Audio Selection Menu transition has played/Audio Selection Menu status
4 = indicates Subtitle Selection Menu has played/Subtitle Selection Menu status

The values of 2, 3, and 4 are used in such a way that only a value of 2 could be used instead. The three individual values are used only for organizational purposes.

GPRM 1: SPRM 8/button highlight values are "dumped" here when needed.

GPRM 2: This register is used to store the audio stream values of 0 and 1 for the English and French streams, respectively.

GPRM 3: This register is used to store the values for the subpicture streams. Here are the values used:

0 = DVD start
64 = SPRM 2 value for subpicture stream 0 (English) "on" status
65 = SPRM 2 value for subpicture stream 1 (French) "on" status
62 = SPRM 2 value for all subpicture streams "off" status

The reasons for this will be made clearer later. The DVDSP 3 manual is a good reference for more SPRM and SPRM value information.

Here are explanations for all of the commands, PGC by PGC:

First Play

Nothing special here - just insuring that the three GPRM's used for this disc are setup before navigation is directed to VTS 2.

VTS 2: 15 frames/1 GOP black video

Just following good DVD start up procedure by filling the DVD player's resume buffer with some info. Navigation then jumps to VMG PGC 1.

VTSM 2: Dummy PGC

This is the root menu associated with VTS 2. If for some bizarre reason navigation arrives here it is redirected to VMG PGC 1.

VMG PGC 1: Dummy PGC/entry PGC

When the title remote key is activated, this is where navigation is directed as this VMG PGC is set as the "entry PGC." Here are the Pre-Commands:

  1. GPRM 2 is set to the value reported in SPRM 1 (audio stream).
  2. GPRM 3 is set to the value reported in SPRM 2 (subpicture stream).
  3. If the value of GPRM 0 is less than a value of 2, navigation skips to line 5.
  4. If the value of GPRM 0 is not less than a value of 2, button 2 is set to highlight and navigation links to PGC 2 (Main Menu).
  5. If the value of GPRM 0 is less than a value of 2, then button 1 is set to highlight and navigation links to PGC 2.

The first two Pre-Commands set GPRM 2 and GPRM 3 with the values reported in SPRM 1 and SPRM 2, respectively. This is done to determine how the audio and subpicture stream were last set in VTS 1. Whether the streams were set from a sub-menu or the user changed streams while playing the show, the DVD player will act accordingly.

VMG PGC 2: Main Menu

Pre-Commands:

  1. If the value of GPRM 0 is less than a value of 1, navigation skips to line 3.
  2. If the value of GPRM 0 is not less than a value of 1, GPRM 0 is set to a value of 1 and navigation links to Cell 2.
  3. If the value of GPRM 0 is less than a value of 1, GPRM 0 is set to a value of 1.

These Pre-Commands are designed to determine if the DVD Intro was played (Cell 1). If it wasn't played, then GPRM 0 is set to a value of 1 because it is about to be played. If it has played, then GPRM 0 is reset to a value of 1 (as it may be a value of 1 or 2 at this point) and navigation links to Cell 2, therefore skipping Cell 1 (which is the DVD Intro).

Cell-Commands:

  1. When the end of Cell 2 is reached, the Link C2 Cell-Command executes instructing navigation to loop to the top of Cell 2.

This Cell-Command is present for all menu PGC's (they all loop) and will not be mentioned for future PGC's.

Button-Commands:

  1. "Play Movie" instructs navigation to jump to VTS 1, which is the "show."
  2. "Chapters" sets button 1 to highlight and instructs navigation to link to PGC 3, which is the Chapter Selection Menu.
  3. "Audio&quot: links to PGC 4, which is the Audio Selection Menu
  4. "Subtitles" links to PGC 5, which is the Subtitle Selection Menu.

VMG PGC 3: Chapter Selection Menu

Pre-Commands:

  1. GPRM 1 is set to the value reported by SPRM 8, which is the highlighted button value.
  2. The highlighted button is set by the value stored in GPRM 1.
  3. If GPRM 0 is equal to a value of 2, then navigation links to Cell 2, skipping Cell 1 (the menu transition).
  4. If GPRM 0 is not equal to a value of 2, then it is set to a value of 2.

This is the same programming strategy used in the project featured in Simple DVD Spec. Re-Authoring... Part 2 article, with the addition of commands that determine if the menu transition needs to be played. There are only three ways to arrive at this menu; the most obvious of which is from the Main Menu. It can also be reached from either end of show or via the activation of the remote menu key while the show was being played (as long as it was navigated to from the Chapter Selection Menu). While we want to see the transition from the Main Menu, we don't want to see it if after exiting the show.

Button Commands:

Unlike previous projects, all buttons that seemingly connect to a specific chapter actually use the same command: Jump TT 1. This is because the Chapter Selection Menu now resides in the VMG (remember, it's part of the VMG VOB!), and is not permitted to directly target PTT's by the DVD Specification. You may be wondering, "So if the chapter buttons all use the same command, how can specific chapters be targeted?" Well, what value is unique to each button? If you are not sure, feel free to take another look at VTS 1 in the diagram above - this will be explained more clearly a little later.

Last but not least, button 5 sets button 2 to highlight, then instructs navigation to link to PGC 6 - which contains the Main Menu preceded by the outro transition.

VMG PGC 4: Audio Selection Menu

Pre-Commands:

  1. If GPRM 0 is equal to a value of 3, then navigation links to Cell 2, skipping Cell 1 (the menu transition).
  2. If GPRM 2 is not equal to a value of 0, navigation skips to line 5.
  3. If GPRM 2 is equal to a value of 0, then button 1 is set to highlight.
  4. After the button highlight is set, navigation skips to line 6.
  5. If GPRM 2 is not equal to a value of 0, then button 2 is set to highlight.
  6. GPRM 0 is set to a value of 3.

These Pre-Commands are used to determine if the transition needs to be played, and if it does, which button should be highlighted upon arrival at the Audio Selection Menu.

Button Commands:

  1. "English" instructs navigation to link to PGC 9, which is a dummy PGC used to setup values for the audio streams.
  2. "Français" instructs navigation to link to PGC 9.
  3. "<Main" sets button 3 to highlight, then instructs navigation to link to PGC 7 (Main Menu preceded by the outro transition).

VMG PGC 5: Subtitle Selection Menu

Pre-Commands:

  1. If GPRM 0 is equal to a value of 4, navigation links to Cell 2, skipping the menu transition in Cell 1.
  2. If GPRM 3 is not equal to a value of 64, then navigation skips to line 5.
  3. If GPRM 3 is equal to a value of 64, then button 1 is set to highlight.
  4. Once button 1 is set in line 3, navigation skips to line 9.
  5. If GPRM 3 is not equal to a value of 65, then navigation skips to line 8.
  6. If GPRM 3 is equal to a value of 65, then button 2 is set to highlight.
  7. Once button 2 is set in line 6, navigation skips to line 9.
  8. If GPRM 3 is any other value other than 64 or 65, button 3 is set to highlight.
  9. GPRM 0 is set to a value of 4.

Just like in PGC 4, these Pre-Commands are used to determine if the transition needs to be played, and if it does, which button should be highlighted upon arrival at the Subtitle Selection Menu.

Button Commands:

  1. "English" instructs navigation to link to PGC 10, which is a dummy PGC used to setup values for the audio streams.
  2. "Français" instructs navigation to link to PGC 10.
  3. "None" instructs navigation to link to PGC 10.
  4. "<Main" sets button 3 to highlight, then instructs navigation to link to PGC 8 (Main Menu preceded by the outro transition).

VMG PGC's 6, 7, and 8: Three Main Menus with Three Different Outro Transitions

These three Main Menus are almost identical, except they use different Cell ID's. These PGC's have a single Pre-Command that sets GPRM 0 to a value of 1. The other Pre-Commands used in PGC 2 Main Menu are not used here because PGC's 6, 7, and 8 are only used when navigation returns from a sub-menu. So if the show is playing and reaches end of show or the title or menu remote keys are activated, navigation will not be directed to any of these PGC's - therefore the additional Pre-Commands are not needed. The Button Commands are the same as those found in PGC 2.

VMG PGC 9: Dummy PGC Used For Setting Audio Stream Values

This PGC is accessed if buttons 1 or 2 are activated from the Audio Selection Menu. The Pre-Commands first determine which button brought navigation to this PGC, then set the appropriate GPRM 2 value. Once GPRM 2 is set, button 3 is set to highlight and navigation returns to the Audio Selection Menu. Notice that no "Set Stream" Commands are used here - that's because they can't be used. Set Stream Commands that target a VTS can only be used in the VTS and VTSM domains, not the VMG domain. Since these menus are in the VMG, GPRM 2 values are set and will be referenced only when needed by VTS 1 in order to determine which audio stream to play. This strategy also makes it easy to add additional streams or add additional multistream VTS's in a modular way. It also makes the setting of button highlights that reflect the current stream status easy as well. In addition, notice how the Button Commands leave PGC 4, perform some operations at this Dummy PGC, and return to PGC 4. This is done for compatibility, as there are DVD players that crash if button navigation does not ultimately leave the PGC. In this case, since a dummy VMG PGC is used, navigation does what it has to do quickly and safely - no domain or VTS jumps of any kind.

VMG PGC 10: Dummy PGC Used For Setting Subtitle Stream Values

This PGC works in exactly the same way as PGC 9, except its used to set subtitle values. Notice how Pre-Command line 8 sets GPRM 3 to a value of 62. Technically, this would indicate that all subpictures are set to "off" status, but a GPRM is being set, not a SPRM. As you will soon see, however, GPRM 3 set to a value of 62 is of little importance other than the fact that it is not a value of 64 or 65. The value of 62 was only chosen so it would be consistent with its ultimate function to change all subtitle streams to "off" status.

VTSM 1: Dummy PGC

This PGC is the root menu of VTS 1 and is only used to direct navigation if the menu remote key is activated during the show. Just like VMG PGC 1, which is also a Dummy PGC, the first two Pre-Commands set GPRM 2 and GPRM 3 with the values reported in SPRM 1 and SPRM 2, respectively. This is done to determine how the audio and subpicture streams were last set in VTS 1. The remaining Pre-Commands are used to determine where to direct navigation. If navigation originated from the Main Menu, button 1 is set to highlight and is sent to PGC 2. Likewise, if navigation originated from the Chapter Selection Menu, it is directed back to PGC 3.

VTS 1: Main Program

Here's where all of the DVD Spec. magic happens: audio and subpicture streams get set and navigation determines which chapter to play. I've separated the Pre-Commands into three sections:

  1. If GPRM 2 is not equal to a value of 0, then navigation skips to line 4.
  2. If GPRM 2 is equal to a value of 0, then audio stream 0 (English) is set.
  3. Once line 2 executes, navigation skips to line 5.
  4. If GPRM 2 is not equal to a value of 0, then audio stream 1 (French) is set.
  5.  

  6. If GPRM 3 is not equal to a value of 64, then navigation skips to line 8.
  7. If GPRM 3 is equal to a value of 64, then subpicture stream 0 (English) is set to "on" status.
  8. Once line 6 executes, navigation skips to line 13.
  9. If GPRM 3 is not equal to a value of 65, then navigation skips to line 11.
  10. If GPRM 3 is equal to a value of 65, then subpicture stream 1 (French) is set to "on" status.
  11. Once line 9 executes, navigation skips to line 13.
  12. If GPRM 3 is any a value other than 64 or 65, subpicture 0 is set to "off" status.
  13. If GPRM 3 is any a value other than 64 or 65, subpicture 1 is set to "off" status.
  14. If GPRM 0 is equal to a value of 1, navigation links to the first chapter of the show.
  15.  

  16. If GPRM 0 is not equal to a value of 1, then GPRM 1 is set to the value stored in SPRM 8.
  17. If button 1 was activated, then navigation links to chapter 1.
  18. If button 2 was activated, then navigation links to chapter 2.
  19. If button 3 was activated, then navigation links to chapter 3.
  20. If button 4 was activated, then navigation links to chapter 4.

In section 1, the DVD player sets the audio stream according to the value of GPRM 2, and then skips to section 2. Since audio streams are always "on," the SPRM 1 and GPRM 2 values directly correspond. A SPRM 1 value of 0 is equal to audio stream 0, which is the first stream. Subpicture streams are a little different...

While the setting of subpicture streams in section 2 is very similar to the setting of audio streams in section 1, there is a crucial difference. Subpicture streams have both an "on" and an "off" status. A SPRM 2 value of 0 means that subpicture stream 0 is off, while a SPRM 2 value of 64 means that stream 0 is on. A SPRM 2 value of 1 means that subpicture stream 1 is off, while a value of 65 means it's set on. When activating the "None" button on the Subtitle Selection Menu, navigation is sent to PGC 10, where a value of 62 is set in GPRM 3. When navigation enters section 2 of the VTS 1 Pre-Commands, the GPRM 3 value of 62 actually turns subpicture streams 0 and 1 off because it is not a value of 64 or 65. This value was selected only for convenience; it does not have any other function in this instance.

The Pre-Commands in section 3 check to see if navigation originated from either the Main Menu or the Chapter Selection Menu. If navigation came from the Main Menu, then the DVD player is instructed to immediately link to PG 1, which starts the show. If navigation originated from the Chapter Selection Menu, the DVD player checks to see which button was activated in order to determine which chapter to play.

Another added benefit of this programming strategy is that the show will always start from the beginning when the "Play Movie" button on the Main Menu is activated. Most DVD's I've encountered (including some of mine!) seem to have only the show's respective VTS the target of the "Play Movie" button, so if any part of the target VTS was played then exited before end of show, the play button acts as a resume. Though the play button is not programmed as a resume button, the DVD player references its resume buffer before proceeding to play the show. In the case of this Liquid Lifestyles disc, since specific instructions as to which PG should be played are provided for the player, whatever is stored in the resume buffer in regards to the target VTS is irrelevant. This does not mean, however, that if resume functionality is desired it could not be implemented... but that's another article...

Conclusion

Hopefully I've been successful in explaining how this DVD is programmed and why. Although there's a good amount going on here, there really is no single complex element - just a bunch of little bits brought together. When planning to re-author with DVDAfterEdit, I first figure out the PGC layout. I default to putting menus in the VMG, but that may not be the best solution for every disc. Maybe a combination of VMG and VTSM menus will provide the fastest navigation and most simple programming. Then, I look at what types of functionality are required and break everything down into individual "modules." So for example, taking care of the button highlights is one module or function, and dealing with chapter menu navigation is another. I work with each section of the DVD in DVDAfterEdit until the programming is assembled, and then look to see if there is a better way to integrate these modules in order to improve the whole.

The less time spent clicking things in abstraction-layer applications can translate into more time for authoring at the DVD Specification level - which directly translates into more efficient and less complicated programming - which directly relates to better, more responsive and compatible DVD's - which directly relates to happy customers and end users - which directly relates back to the DVD author!

The Quick and Dirty Guide to Pilates, an enhanced 24-clip Playlist DVD

"The Quick and Dirty Guide to Pilates" is an exercise DVD that was created in DVD Studio Pro and then programmed with DVDAfterEdit. It was shot in 24p and compressed with BitVice. It is an exercise video that was shot from 3 angles, and allows the viewer to choose their own set of exercises, up to as many as 24 and in any order, for each exercise session. It includes a home menu, a design menu, an exercise menu, a web link menu, two alert menus, and a comprehensive set of setup menus.

The main "movie" track plays seamlessly from the home or exercise menu, and includes a startup logo and warning, introductory credits, up to 24 individual chapters, and final credits. There is also a contextual explanatory track that is invoked by buttons on video, an overall introductory track, and a contextual help track. The DVD is available for purchase at Amazon.com and through other retail distributors. A free copy will be sent to members on request. (See Recent News).

Included in the DVD ROM section is a demo version of DVDAfterEdit which allows you to trace through the navigation of the DVD to see how the playlist works. To run this demo requires a Macintosh. Inclusion of the demo on the DVD is by arrangement with Debdoot Das, the producer and director of the "Quick and Dirty Guide to" series of DVD's, of which there are more to come.

Digifilm (Debdoot's company) and I are currently working on a template project that will be available for download to Mastering Edition owners. This project will mimic the structure of the actual DVD exactly, but will have much smaller, "stand-in" assets for the tracks. It will use the menus from the actual DVD.

This template project should satisfy the needs of many exercise, concert, instructional, and corporate DVD's that can be poured into the mold of this template. Doing so completely relieves the author from all programming of the DVD, as it is already done for you. Just replace the assets with your own, and follow the short instructional video that will walk you through the process, with screenshots every step of the way. All of the navigation commands for the entire DVD are pasted in from a single text file in one step.

This brief description will be expanded as the project is completed.

Tips For DVD Studio Pro Authors

One of the challenges for new users is "finding your way around" your familiar project using the DVDAfterEdit Interface. This section gives some hints, tips and rules-of-thumb for DVD Studio Pro users.

Finding Tracks and Menus

If you are using "Manual VTS allocation", you will already know where to look for your assets - in the VTS you chose for them. Otherwise, the following rules of thumb may be useful.

Finding Tracks

  • Track 1 is in VTS 1, PGC 1
  • Track 2 is in VTS 2, PGC 1
  • Track 3 is in VTS 3, PGC 1 ...etc.

Stories start in PGC 2 of each VTS, in the same order as in DVDSP.

( Nb: Things become a little more complicated when you have more than one aspect ratio - use the "VTS View" in DVDSP to see exactly where your Tracks are. )

Finding Menus

  • For a project with only one aspect ratio ( ie. either 4:3 or 16:9 ) all the menus are contained in VTS Menu 1 ( VTSM 1 )
  • For a project with both 4:3 and 16:9 footage, all the 4:3 menus are in VTSM 1, and all the 16:9 menus are in VTSM 2
  • When you select a VTSM in DVDAfterEdit, the first 6 PGCs are always "dummies" - think of them as Scripts that DVDSP automatically adds to control navigation. So, to see Menu 1 in your DVDSP project, open VTSM 1 and select PGC 7.
  • Menus with Transitions will contain two Programs ( PG ) or Cells - these are like chapters. The transition "into" your menu is contained in the first PG, the menu itsefl with buttons, is contained in the second.


Tracer Tutorial, Part 1

by Larry Applegate and Ben Weinrach

This tutorial is an introduction to the Tracer interface and its basic functionality. The sample DVD project demonstrated here is that from the article "Simple DVD Spec. Re-Authoring with DVDAfterEdit 3, Part 3" by Ben Weinrach and is available in the download area. Please refer to the Tracer User Manual for more detailed information regarding the relevant topics discussed below.

When you pop a DVD into your player you are usually presented with a Copyright warning, some introductory logos, and then a main menu from which you can choose a few options. When you make choices, you are "navigating" through the DVD, and the DVD is navigating through various commands - just like a computer program. Navigating can be quite simple, or in the case of a trivia or other game, quite complex.

DVD Authoring applications give you various levels of control over the programming of this navigation, from very simple ones with fixed choices, to much more capable applications with complex "behind the scenes" abstraction layers, all the way to the most complex "Spec. Level" programs that provide access to all or most of the complete DVD Specification. None of these applications gives anything approaching the level of debugging control that is taken for granted by software engineers working in C++, Pascal, or even Basic. This can make it difficult for a DVD author to be really sure that his or her DVD will navigate correctly in all players, and to track down what is causing misbehavior.

Tracer is a tool to give you that control, in a visual and interactive environment. This tutorial will explain and demonstrate many of its features.

[inline:104_initial_tracer_window.jpg=Initial Tracer Window]

Above is the Tracer window as it first opens for the current active project, which simulates the player status of when a DVD is first inserted. Since we have just opened the DVD, Tracer displays the First Play PGC and its Pre Commands (see image above). The window is divided into several panes (or sections) containing everything we need to know about the status of the DVD's navigation. Explanations for each pane of the Tracer window follow below.

System Parameters

There are 21 System Parameters, also known as SPRMs, numbered from 0 through 20. In Tracer, most of these can be displayed in two notations: decimal or hexadecimal.

Some SPRMs represent user player settings and preferences, such as what language is "preferred" in menus (SPRM0). Another choice, or player characteristic, is the Region Code (SPRM20). Other SPRMs are the direct result of DVD navigation. Some system parameters can also be edited directly or indirectly by user operations on the remote, like the subtitle stream, for example.

SPRM14 is both a preference and a result. The preference is whether the screen is 16 x 9 or 4 x 3, and if 4 x 3, whether to choose pan and scan if available in 16 x 9 content, or letterbox. The result is how the player has chosen to play the current video, if video is playing, which depends both on the preference and on flags in the video attributes.

Those SPRMs which are preferences are saved in the general preferences file any time they are changed in Tracer. They are not saved in the project preferences.

To change the notation to decimal, click on Hex, found at the top of the SPRM pane. This will cause all of the numeric values to be displayed in hexadecimal, and change Hex to display as Decimal. To change back to hexadecimal notation, click on Decimal at the top of the SPRM pane. In addition, you may click on an individual SPRM description, which will change that particular SPRM to the opposite notation.

The SPRMs may be edited either by typing directly on the SPRM value or by choosing a popup where applicable. This is not "normal" in a DVD player, of course; the author in many cases may not change SPRM values - only create programming that reacts to them. The ability to edit SPRMs gives the author the power to test for all end-user player variables, ensuring that the DVD will function as intended.

General Parameters

There are 16 General Parameters, also known as GPRMs, numbered 0 through 15. GPRMs are registers similar to SPRMs, but are user-definable, controllable, and flexible. Generally, abstraction-layer DVD authoring applications take control of some GPRMs, in order to make programming certain kinds of functionality more easy for the user. In the command areas, in both the main and Tracer windows, they are referred to as simply r0 through r15, to save space and typing (r = register). The GPRMs may also be edited directly in the Tracer pane, and their notation changed between hexadecimal and decimal.

Resume Parameters

The Resume Parameters contain all of the information that the player saves when playback of a title is "interrupted," often by hitting the Title or Root Menu Call keys on the remote (various players use other names for these keys, such as Top Menu and Menu). This information is used to "Resume" play at the interrupted point. At this time the Resume Parameters are not editable.

Status Information

There are two lines of status information just below the Resume Parameters. The first line identifies the current location in the DVD structure, the largest unit of which is a Program Chain (PGC). PGCs are found in the following domains: First Play, Video Manager (VMG), Video Title Set Menu (VTSM), and Video Title Set (VTS). The status information displays the domain, and the relevant PGC, Title (TT), Program (PG), Cell, and Nav Pack numbers.

The second stus line identifies which category of commands are displayed, if any: Pre Commands, Post Commands, Cell Commands, or Button Commands. If there are no commands displayed, the second line will normally say "Waiting for Remote key...." When video is actively playing, this line will not display any information.

Remote

Tracer's remote offers full control over standard DVD player functionality. To simulate a DVD player's onscreen display when activating functions with potential multiple options (subtitle streams, for example), popup menus appear displaying all relevant and available choices. Additionally, some buttons will invoke a dialog box.

Many of these buttons correspond directly to "User Operations" in the DVD Spec. Most user ops can be permitted or disallowed at various times during the playing of the DVD, at the author's discretion. For example, most Hollywood DVD's force the user to watch the Copyright warning before you can start playing the movie. This is accomplished by disabling buttons that would allow the user to skip the warning and go directly to the main menu.

Buttons in Tracer are grayed out if the corresponding user op is disabled at the moment. Buttons are also (independently) italicized if their function is not appropriate or cannot do anything at the moment, even if it might be enabled. For example, if there is only one audio stream available, the remote prevents you from trying to choose another.

Rather than describe the button functions here, examples of their respective uses are given throughout the tutorial.

Trace Buttons

The Trace buttons control the execution of commands in Tracer. In a DVD player, the commands are always executed immediately when encountered; Tracer's Run mode is comparable to normal DVD player operation and playback.

The Step button executes commands one at a time, so the changes resulting from those commands in the Parameter Panes can be viewed step by step (System, General, and Resume). When a value changes, it is drawn in red for one command cycle.

The Stride button executes commands in groups, such as all of the pre commands in a PGC, and stops at each branch (Jump, Link, or Call) to another Cell, Program, PGC, or play of a group of Nav Packs with the same button highlights.

The back button steps backwards to the previously executed command.

The Show button reveals the current PGC in the main window of DVDAfterEdit 3, making the PGC available for further editing immediately.

Trace Slider

The Trace Speed Slider allows you to slow down or speed up the execution of commands as they display in the command pane.
The speed you set is remembered in the general preferences for the next use.

Preview Slider

The Preview Slider controls the video playback speed, from 1/15th to 15 times full speed.

The First Play PGC Pre Commands

Let's return to the sample project. After clearing GPRM0, the First Play jumps to Title 2. If you look in the main window and select Video Manager (VMG) in the left pane, and open up the Title Play Map in the right pane, you will see that there are two titles, one in VTS 1 and one in VTS 2. Each title is also labeled VTS_TT 1. That means it is the first (and only) title in that Video Title Set (VTS).

Strike the 'S' key, click the Step button, or choose Step from the Tracer Menu. You will see the arrow that was pointing at "1: Set r0 = 0" advance to point at the second command, "2: Jump TT 2". Nothing changes in the General Parameters since GPRM0 was previously a value of 0.

Now let's take a side trip to examine the Stop and Play keys in the Remote pane. The Stop key has the common square icon found on many set top remotes, and to its left is the Play key, the familiar hollow triangle icon. They're both near the lower left area of the remote.

Click on the Stop key. Notice that the status area now displays "Player stopped - waiting for user to start play". Now click the Play key; the First Play Pre Commands reappear. This is a simple way to start over in the Tracer window, and is also DVD Specification-compliant.

If video is playing when the Stop key is clicked, it will stop as in the previous example, but clicking the Play key will resume the video from where it was stopped. However, clicking the Stop key twice if video is playing will cause Tracer to navigate to the First Play PGC. This behavior is recommended in an addendum to the DVD Specification and is implemented in most players.

Now Step twice to execute both commands in the First Play PGC. Here is the resulting display:

[inline:104_first_play_pgc.gif=First Play PGC]

Not much has changed, except that now there is a black preview pane, and the status line displays:

"VTS 2, PGC 1 TT 2: PG 1, Cell 1, NavPack 1"

Click the Show Trace button. You will see PGC 1 TT 2 (1 program) highlighted in the left pane of the main window. If you open the triangles (drill down) to the lowest level, you will see each of the items in the status line above. Holding down the option key while clicking on a triangle will open all lower-level items.

Notice that the QuickTime Controller at the bottom of the Preview pane shows the play head at the very end of the black video. Since we used Step to get to this point, Tracer stopped after the last frame of video instead of going directly to the Post Commands. Click Step again; the following Post Command is displayed in the status information:

"Call VMG PGC 1 resume C1"

(continued...)

Tracer Tutorial, Part 2

The Title Menu Pre Commands

When you click Step again, the command area will change to the following:

1: if r0 == 0 then GoTo Line 4
2: Set Button 2
3: GoTo Line 5
4: Set Button 1
5: Set r0 = 0

These are the Pre Commands for the Title Menu. If you press the Show button, DVDAfterEdit will highlight VMG PGC 1 in the left pane of the main window, and if you click on it, you will see "entry PGC yes" in the right pane . This is the VMG entry PGC, which will always be executed when the viewer presses the Menu Call Title Key in the remote.

[inline:4=center,VMG entry PGC]

The video preview still has not changed. Try stepping backwards to the beginning of the First Play, and then forwards again to these Pre Commands. You should be starting to get the idea of how DVD navigation works. A DVD is split up into "Domains," and the commands are quite flexible within the current domain but somewhat limited on how they can travel to different domains. So far we have started in the First Play domain, jumped to the Title Domain to play half a second of black video, then called back to the Video Manager domain in order to eventually display the Main Menu.

The primary function of the above Pre Commands is to determine which button will be set to highlight upon arrival at the Main Menu. Now look at the General Parameters; notice that since GPRM0 (r0) is still 0, navigation will skip over lines 2 and 3 to Pre Command line 4, where Button 1 will be set to highlight. Line 5 will ensure that r0 is set to 0 again, so the next time navigation returns to this PGC, the DVD player will highlight button 1 unless r0 is changed somewhere else. This is a case of the author (Ben) trying to make things easy for the viewer by having the DVD player highlight the last button activated from the Main Menu (such behavior is, of course, up to the author to decide).

Now Step again; Tracer leaves the Pre Commands, and displays the video for VMG PGC 1, which is the Main Menu.

[inline:3=center,main menu]

The status line displays "Waiting for Remote Key...," which means that the Tracer is waiting for the user to activate a remote button. The Button Highlight pane to the left of the Preview pane shows the hot spot borders of all visible buttons contained within the current PGC. Notice the solid white box in the same relative position as the words "PLAY MOVIE" in the image; this indicates that the "PLAY MOVIE" button is currently selected.

Interestingly, if we were to go back to the First Play and start over, clicking Run this time instead of Step, you will see all of the above navigation take place without stopping (except to fetch data from the disk and build a QuickTime preview) at a speed determined by the setting of the Trace Speed slider. For still menus like the one in this example, the player will stop when input is required from the viewer. For motion menus, Tracer will continue playing the video as instructed by the programming, while permitting you to select and activate the buttons.

Selecting Buttons in the Title (Main) Menu

Inside the Remote pane you will see the Enter button surrounded by four directional keys. The arrow and enter keys on the keyboard are shortcuts for these, and are also available from the Tracer menu. When you press the up or down arrows, the button highlight pane will change to show the newly selected button as a solid white box. The right and left arrows are not active for this PGC, which is representative of the way Ben authored the DVD.

If you return to VMG PGC 1 in the left pane of the main window and drill down through the DVD structural levels to the (only) Nav Pack, you will see entries for Button Navigation 1 and Button Navigation 2. When expanded, you will see the button navigation information, including which button is selected when each of the four directional buttons is pressed. If you wish, you may change the entries for "Button no. to select if 'Left' pressed", etc., and when you switch back to the Tracer window the behavior will be changed.

Activating the PLAY MOVIE button

From the Main Menu of the sample project, make sure that the top button is selected, then press the Enter button found in the Remote pane. This will activate the button, just like a normal DVD player, causing the associated button command to execute. In this example, the entire movie will play through its four chapters. You may adjust the preview speed at any time by dragging the Preview slider, or by clicking on the <- Scan and Scan -> keys in the remote pane.

[inline:2=center,drag Preview slider]

In Tracer, the QuickTime movie controller at the bottom of the Preview pane (see image above) is always set to show the duration of the current PGC. For this project, the main movie resides in VTS 1 and consists of a one-sequential PGC. This PGC is broken into four parts, and each part is, at the same time, a Part of Title (PTT), a Program (PG), and a Cell. This type of simple DVD structure is common, though sometimes Programs are are not PTTs, and Programs can have more than one Cell.

As the video begins to play, you will notice that one fourth of the controller's location slider is drawn in dark gray and the rest in light gray. When the first chapter finishes, the dark portion changes to the next one-fourth of the controller length. Tracer subdivides each PGC into its unique sections contained within, all the way down to the Cell level, and even to each group of Nav Packs with similar button highlight information. This enables the user to control playback and tracing to the lowest structural level of the DVD specification.

Setting a Breakpoint

To see how the this DVD navigates from the Main Menu to the Scene Selection Menu, let's look at the commands in the Main Menu PGC and its one and only Nav Pack. When the movie has been played, the DVD navigates to the Main Menu, highlighting the first button. Now press the Show Trace button; this highlights VMG PGC 1 in the left pane of the main window (we did this earlier when examining the Title Menu Pre Commands).

Option-click on the VMG PGC 1 disclosure triangle, then click on Nav Pack 1 in order to select it. In the Button Navigation section in the right pane, you will see two Button Commands (click on the disclosure triangles if they are hidden):

1: Jump TT 1 2: Link TailPGC

These Button Commands correspond to the two Main Menu buttons. Control-click on command 2 (for button 2) and choose "Set Breakpoint" from the contextual menu. The disclosure triangle will change to red, which means that Tracer will stop if this command is encountered while emulating the DVD.

Go back to the Tracer window, and click on the down arrow found in the Remote pane (or use the arrow key). You will see the button selection change from the PLAY MOVIE button (button 1) to the SCENE SELECTION button (button 2) in the Button Highlight pane. Now press the Enter remote button. Tracer displays the following image:

[inline:1=center,choose scene selection]

Notice how Tracer stops playback at the "Set Breakpoint" location and the command-line cursor is now red. The Link TailPGC Button Command navigates to the Post Command area of the current PGC. Press the 'S' key (or click Step) and you will see the following commands in the Command pane:

1: Set r0 = 1 2: Set r1 = 0 3: Jump VTS 1 Menu Root

You may Step (or Stride) through these commands, which will navigate to the Pre Command area of VTS 1 Menu Root (VTSM PGC 1). The following commands are displayed (values are in hexadecimal notation):

1: if r0 == 1 then GoTo Line 3
2: Jump VMG PGC 1
3: if r1 != 0 then GoTo Line 6
4: Set r1 = $400
5: GoTo Line 13
6: if r1 != 5 then GoTo Line 9
7: Set r1 = 4
8: GoTo Line 11
9: Set r1 = Part title
10: if r1 < 3 then GoTo Line 12
11: Link PGC 2
12: Set r1 *= $400
13: Set Button r1

Selecting the Scene Menu and the Button to Highlight

As explained in Ben's article (http://www.dvdafteredit.com/public/107.cfm), these commands decide which of the two scene selection menus to display and which button is set to be selected. Since this is the first time we have navigated to the Scene Selection Menu, we would expect to display the first Scene Selection Menu with the first button selected, and indeed that is what happens:

[inline:5=center, display the first Scene Selection Menu]

Conclusion

You should now have enough familiarity with Tracer to navigate through the remainder of the paths in this relatively simple DVD. Experiment and observe how the logic works. If you have little experience in this kind of scripting/programming, please refer to Ben's explanations in the original article for further help. If these concepts are new to you, it is much easier to understand them when you can see how things happen step-by-step with Tracer.

One difficult aspect of DVD commands is the limitation built in to each command, particularly how they navigate from one domain to another. Examining the various types of commands listed in the popups while working in the right pane of the main project window can be quite instructive in that regard, since the popups will only show those options that are valid in the relative context being viewed. For example, commands that may be part of the DVD Specification in a VTSM PGC but are not relevant to a VMG PGC are not displayed. We will also be adding more explanations and examples to the site to further assist users. Stay tuned!

Understanding Hexadecimal, Nibble by Nibble

Why should we learn hexadecimal notation?

In DVD Spec commands, there are only 8 registers available to the author, if he or she is using an abstraction-layer authoring system such as DVD Studio Pro, or 16 if there is no abstraction layer, such as in Creator or Scenarist, or if you replace the abstraction layer and author from scratch in DVDAfterEdit.

To make better use of these registers, each register can be split up into individual "fields" to be treated individually. Since registers contain 16 bits, there could be 16 individual bit fields that each kept track of a single on/off state. (Binary bits are either on or off). Or it could be split up into 4 fields of 4 bits each. (It is quite often useful to do this).

Bit fields don't translate to decimal values very well. For example, the rightmost (lowest) bit in a register has a value of 1. The highest bit has a value of 32768. The next highest bit has a value of 16384. (Notice these are all powers of 2). Combining or doing arithmetic on groups of these bits in decimal would be very tedious and confusing. But good news! Once you understand hexadecimal, it becomes much easier.

Hexadecimal

Hexadecimal is base 16 arithmetic. This means that each digit in hex has 16 possible values, instead of 10 in decimal or 2 in binary. This is very good for three reasons:

  1. Sixteen is a power of two, 2 ** 4.
  2. Base 16 numbers require four bits to represent them.
  3. Four bits is evenly divisible into the 16 bits in a register.

These facts all combine to make it easy to work in hexadecimal, as you will discover as you continue reading this document. If you plan to do extensive DVD Spec "scripting", it would be a good idea to buy an inexpensive hex calculator.

In hexadecimal notation, each digit is commonly referred to as a "nibble". The possible nibble values are:

[inline:51_hex_nibbles.gif=hexadecimal nibble values]

The DVD Spec uses registers that are 16 bits long. This equates to four nibbles of four bits each. This means a register can hold a value from 0 to FFFF in hex, which is 65,535 in decimal.

Two's complement arithmetic

Typically in the DVD Spec, all values are positive numbers only. But almost all microprocessors, including all of those in DVD players, use "two's complement" arithmetic, which essentially allows you to think of these values as negative values if you wish. In two's complement arithmetic -1 is represented as $FFFF (we will use $ to represent hexadecimal numbers from here on out).

As an exercise let us add one to 9999 (decimal). We add one to the lowest 9, and get 10. We write down the zero and carry the one. We add the carry to the next digit, also 9, and get a similar result. When we finish we have 10000.

Now let us add one to $FFFF. We add one to the lowest F and get $10 (16). We write down the zero and carry the one, etc. When we are finished we have $10000. But only four nibbles fit in our register, so the last carry is thrown away, and the result is zero.

So you can see that in two's complement arithmetic, -1 + 1 still equals zero. For scripting purposes, we don't really need to know much more than that, except that it would is possible to store a negative value in a register, and our good old hex calculator will tell us what that value should be, if we need to know.

Binary bits

The DVD Spec uses the Boolean operators "and", "or", and "exclusive or". These operators only make sense using binary notation. But hex is a good way to organize your binary data into manageable chunks. With a little practice it is very quick to translate a hex number into binary by drawing out the nibbles on a piece of scratch paper, thus:

$06FF:
0000 0110 1111 1111

$1ABC:
0001 1010 1011 1100

(Please refer to the table, above, to get each nibble of the 16-bit hexadecimal number).

Then you can isolate the piece of the GPRM or SPRM you are interested in by drawing a long vertical line between the appropriate bits (counting from the right as bit 0), and apply the Boolean logic to it. (I'll explain Boolean logic in a moment).

For example, button numbers are stored in SPRM's and referenced starting with button number one having a value of 1024, or $0400. Button two is $0800, button 3 $0C00, etc.

So my example of button number one would be drawn thus:

0000 01|00 0000 0000

(On paper you would make the vertical bar taller.) If you draw all of the possible buttons out you will see that the 10 bits to the right of the button number are always zero. This means that scripting can keep track of a button number and still have 10 more bits to play with in the same GPRM!

This concept is extremely powerful, and is what permits complicated navigation with only 16 GPRM's. Essentially, GPRM's are very expensive, and commands are cheap since you can have up to 128 of them in each PGC, and you can have tons of PGC's.

Boolean Logic

The three Boolean operators used in DVD Spec commands are "and", "or", and "exclusive or". These operands are usually represented by the operators "&", "|", and "^".

Boolean operators are applied one bit at a time to two operands, and each bit in an operand is compared to the same bit in the other operand. The result of the compare is stored in the destination operand. (In DVD commands, the destination is always a GPRM, or a "temporary value" (never stored) in an if statement).

"and": If both bits are true (1), the resulting bit is true.

"or": If either bit is true, the resulting bit is true.

"exclusive or": If either bit is true, but not both, the resulting bit is true.

Some examples:

$0010 & $0011 = $0010
$0011 & $1000 = $0000
$0001 | $0010 = $0011
$0000 | $abcd = $abcd
$8000 ^ $8000 = $0000
$e000 ^ $4000 = $a000

etc.

An abstraction layer example

Following is an abstraction layer example from DVDSP 1.5, which was written before DVDSP 2.0 was shipped. Although the abstraction layers for the two products are different, the principles are the same.

This example was also written before DVDAfterEdit supported the hexadecimal preference for commands. Here in this update we will show the hexadecimal. For those who have read the previous version of this document, you will see that this makes the code much easier to follow.

If you look at a typical DVDSP 1.5 project, at the Video Title Set Menus, you will see that the first 20 lines of PGC 2 are always identical.

1: Set r15 = r8
2: Set r15 ^= $E000
3: if r15 & $8000 then GoTo Line 7
4: Set r14 = r8
5: Set r14 &= 7
6: Set Stream Audio r14
7: if r15 & $4000 then GoTo Line 13
8: Set r14 = r8
9: Set r14 /= 8
10: Set r14 &= 63
11: if r14 != $3F then Set r14 |= 64
12: Set Stream Subpic r14
13: if r15 & $2000 then GoTo Line 18
14: Set r14 = r8
15: Set r14 /= 512
16: Set r14 &= 15
17: Set Stream Angle r14
18: Set r8 = 0
19: Set r15 = r13
20: if r15 == 0 then Link Resume

This code is using a single GPRM, r8, to hold three flag bits and three values. Before reading any further, notice that $E000 has three bits on, $8000 has one of those same bits on, $4000 has another, and $2000 has another. Gee, there must be a method to this madness!

Here is a picture of the bits as they are arranged in register 8:

[inline:51_bits_arranged_reg8.gif=center,bits as they are arranged in register 8]

Now to describe each command line and what it does:

  1. This brings register 8 into a "work" register, r15, so that we can see what is in it without destroying register 8.
  2. "Exclusive or" the register with the value $E000. This will invert the top three bits in the register and leave the lower 13 bits unchanged.
  3. This tests the work register against the value $8000. If it is on, we skip over the next few lines. This means that the high-order (leftmost) bit was off originally, since we "flipped the bit" by exclusive or'ing it with a one bit in that position (the $8000 part of $E000).
  4. We move the original register 8, the interesting one, into another work register, r14. We use another one because we are not through with the current value of r15, see below.
  5. We "and" the value of r14 with 7. This eliminates any extra bits to left of the first three (bits 0 thru 2), yielding a result that is guaranteed to be in the range 0-7.
  6. We now set the audio stream to a legal value.
  7. This tests the work register against the value $4000. If it was originally off (now on), we skip to line 13.
  8. We move that same register r8 to the second work register.
  9. We divide the value by 8. This removes the three bits that might have contained an audio stream, and moves the next interesting 6 bits to the rightmost part of the register. Any time we divide by a power of 2 (8 = 2 ** 3), it is the same as shifting the bits in the register to the right by the power number positions.
  10. We "and" the value with $3f. This isolates 6 bits of a sub picture stream. The sub picture SPRM uses values 0-31 for stream numbers, and a value of 63 to indicate a "dummy stream".
  11. If the value is not 63 we "or" in another bit, 64 (bit #6). This bit "on" means display the sub picture stream. This bit off means do not display it.
  12. We deposit the register (r14) into the SPRM (SPRM 2).
  13. We test the work register against $2000, and skip to line 18 if it was originally off.
  14. We get the interesting variable.
  15. We divide it by $200, getting rid of the nine bits we have already used up.
  16. We "and" it with $f, leaving a number between 0 and 15.
  17. We deposit the angle (1 thru 9) into the SPRM. We assume the angle number is correct, since it was generated by the abstraction layer.
  18. We have used up the register 8, which held up to three values that needed to be transferred to their SPRM's, so we clear it to zero so that the next time we won't have to repeat the steps above, since the SPRM's will keep track of it handily.
  19. We get r13 so we can test it.
  20. If r13 was zero, we do a Link Resume.

From here on out, the individual menus "do their thing", usually testing r13 for particular values to go to particular places.

Notice that the abstraction layer coding isn't particularly efficient in the number of instructions used, but is very efficient in its use of the bits in general parameters.

For example, the abstraction layer designer could have reversed the meaning of the three high-order bits in register 8, which would have saved the instructions which had to move the bits to another register and invert them in order to test each bit. But this sort of optimization is unimportant in typical navigation, since commands themselves execute in microseconds and there is room for 128 of them in each PGC. It is only when we actually jump to other domains and areas that navigation slows down.