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. I recommend you check out the "Getting Started" article before reading this, if you haven't done so already.

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 betw