Making DGIndex Project Files

Now that you've ripped the VOB files, you need a way to access them. Some editing software can edit mpeg2 natively but this is often slow and inaccurate. So, to access our vob footage we are going to first index it with DGIndex.

This is a program that was previously known as DVD2AVI but due to various updates and a change of focus the programs previously associated with this method have been collected and renamed into a package called DGMPGDec. This package (supplied with the AMVapp) includes the program DGIndex which indexes mpeg2 files for use in programs like avisynth and DGDecode.dll which is the avisynth plugin that reads the DGIndex project files.

What DGIndex does

Let me take a minute to explain what we're going to be doing as it may not be instantly obvious. We are going to make DGIndex project files (*.d2v). These files can be read by other things and they help programs access DVD footage with greater speed and accuracy.

When DGIndex makes a project file, it indexes the mpeg2 data. It looks at the footage and records information about it so that it is easier for software to find a certain frame in the stream. It's the video equivalent of writing an index in a history book to help you find the page about Davy Crockett.

This allows a greater amount of stability than you will find in more direct ways of accessing the DVD footage (such as using DirectShow like many editing applications do).

Loading your Vob Files

Open DGIndex and go to the 'File' menu. Choose Open [F2], select all the vobs you want to open and click ok. If they have loaded in the wrong order you can move them around using the Move Up and Move Down buttons.

When you have opened a series of vobs you can add extra vobs to the end as you see fit but it is recommended to try and not mix vobs from different VTSes as they may be encoded differently. Appending extra episodes is usually fine but keep extras seperate if you can.

It is up to you to decide how many vob files you load into a single project. I personally like to have one project file for each dvd - other people rip their vobs by episode and choose to have one project file per episode. You can even have one project file per vob if you really like. It doesn't matter as long as you remember how you created the project so, if you need to, you can easily do it again another time. One piece of advice I will give is that the fewer project files the better when editing vob footage directly in programs like Premiere.

Once you have all the vob files you want for this project listed and they are in the order you need, press ok.

You should be able to use the bar at the bottom to browse your footage. If it's a bunch of blocks then it hasn't been ripped correctly and you should go back to your dvd ripper software and try again and see why it isnt decoding the encrypted footage.

The frame seeking in the DGIndex interface only searches through keyframes so you will not be able to find exact frames. Like VirtualDub, you can select an In and an Out point using the [ and ] buttons but you should not do this. As I've said previously, one benefit of using dvd files is being able to reconstruct the footage later. You cannot do this if you select an area because it is incredibly hard to recreate later.

Now that you have your footage loaded, let's have a preview of the footage. Press F5

Footage Properties

DGIndex Preview Information

Pressing F5
shows a preview of the footage and gives you all sorts of useful information about your mpeg2 stream. The items listed below will be important, so you may wish to write their values down somewhere.

Aspect Ratio: This can either be 4:3 or 16:9. If the aspect ratio is 16:9 then the DVD is anamorphic.

Frame Rate: This can be 29.97fps (for NTSC), 23.976fps (for FILM) and 25fps (for PAL). It can actually be anything depending on the way the mpeg2 source is encoded but these are the conventional standards. With newer versions of DGIndex like the one included in the AMVApp, it actually displays much more accurate framerates, as shown in the image above. Because its impractical to write or even remember the framerate with such accuracy, people generally just refer to them as 29.97, 23.976, and 25 fps (well, 25 fps is perfectly accurate, actually).

Video Type: This can be NTSC, PAL, FILM or a mixture (hybrid). It is very important if you get a DVD that is 95% or more FILM as I will explain later.

Frame Type: This is a flag on the footage which gives us info on how it is being stored and hence how to decode the video. Interlaced means the footage is probable encoded a field at a time instead of a frame at a time. Progressive means that the footage is encoded a frame at a time. You may find some sources change because of the way they have the flags set - I will explain these when we analyse the footage later.

Audio Format: This can be DD (Dolby Digital), DTS, MPEG2 or PCM (uncompressed). In this picture DD 2/0 192 means that it is a 2 channel (2 front, 0 back) Dolby Digital audio encoded at 192 kbps. This is quite common for some TV series and older anime. A newer series or a movie might report something more like "DD 3/2 448". That would mean that it is a 5.1 channel (3 front, 2 back) dolby digital audio encoded at 448 kbps. Unless you plan to use some of the audio from the DVD, you don't even need to worry about this.

Before telling you what settings you will need to put into DGIndex it is important that you understand about some of the basic video types you will come across when doing this preview.

16:9 'Anamorphic' Footage

Anamorphic dvd encoding is designed to squish the footage horizontally to fit a regular 4:3 image size. Most dvds within a standard are encoded with the same resolution (720x480 for NTSC and 720x576 for PAL). This resolution is chosen to show a 4:3 image on a TV (as TVs have 'rectangular' pixels). When a movie is anamorphically encoded, a 16:9 image is squished in order to fit into 720x480 or 720x576. What happens later is that this image is then fed to a Widescreen TV and it is displayed to fill the screen, restoring its aspect ratio. This avoids having to use letterboxing (adding black borders) on a DVD and hence improves image quality. However, as it makes everyone look squished you need to fix this somewhere down the line if you want to use this footage (unless you want to produce an ananmorphic dvd).

Interlaced NTSC and Progressive FILM Video

Interlaced video (when done right) is encoded on DVDs as fields instead of as frames. Each field is encoded seperately and then weaved together to make the interlaced video - if you have read the Theory Guides this will make some sense. Progressive footage, however, does not have interlacing and so it can be encoded one entire frame at a time.

Progressive footage is usually found on FILM sources. When I say FILM I mean that the footage on the dvd has been taken and encoded directly from a movie film source (24fps - converted to 23.976fps). This is the a high quality way to encode video. The only problem is that NTSC needs 29.97fps - which is why progressive FILM encoded dvds have the ability to Telecine (do 3:2 Pulldown) during playback which interlaces them to 29.97fps so that the video looks correct on a TV. The actual video isn't interlaced, the dvd player interlaces it during decoding using a fixed telecine pattern. Again, the theory guides will make some sense of this. This telecine process is completely optional during decoding and if we wish we can Force FILM on these sources in order to get the original progressively encoded frames at 23.976fps. This is perfect for digital video editing. If you have a progressive source, be happy.

Progressive FILM encoding is usually only to be found dvds of movies produced for cinema. There are some anime dvds that are truly progressive but if you are working from TV shows then they are more likely to be plain NTSC. You can definitely use force film on Princess Mononoke, Spirited Away (and many other Disney-released Ghibli movies) but Adolescence of Utena is not progressive. You should always check by pressing F5 or even better scrolling to the middle of a source and pressing F6 to see what the pattern is in the middle (as some studio bumpers are interlaced when the movies themselves are actually progressive).

DGIndex Settings

Stream Menu

This is a new menu in DGIndex which is designed for people who are using transport streams. You will not need this menu as it doesn't apply to DVD footage.

Video Menu

iDCT Algorithm: This selects the accuracy of the decoding... but it's a level of accuracy that you are unlikely to notice visually - it's actually hard to notice it mathematically. Skal SSE MMX is default and the best option for most people's processors.

Field Operation: This is an important option and what you choose here will depend entirely upon the Video Type you observed when you previewed with F5 as there is a chance that your video is progressive, as already discussed. If you have a source whilch is more than 95% FILM then you can choose Force FILM in order to return the original progressive frames. However, be careful with this option as it can sometimes be inaccurate especially if it is not perfect 100% FILM. Never choose this if it is obvious that you have a hybrid source with a large amount of NTSC. PAL users will never want to set Force FILM. If your source was NOT more than 95% FILM then you should choose Honor Pulldown Flags, which happens to be the default setting.

YUV -> RGB: PC Scale is the default option, and is what should be chosen here.

Luminance Filter: This is to increase brightness. Out of date an unnecessary. The same thing can be done in avisynth.

Clip and Resize: This is another function that should not be used as Avisynth can do exactly the same thing and is easily reconfigurable. Doing it here will not speed up the cropping, so do it in avisynth so you can change the settings later.

Audio Menu

The audio menu is to set up how (if at all) you want to decode any audio streams that are part of these vobs. Remember, if you don't plan to use audio from the DVD, then you won't be needing the audio!
Output Method: If you don't want to use any of the audio then select Disable. It will be much quicker to process that way. Otherwise there are a few things you can do. Demux (which is best quality) or Decode to Wav which isn't as good quality for AC3 but is just like demuxing for Wav.

Track Number:
The audio track you want to process. DVDs can have any amount of audio tracks but generally only a few are used. Unfortuantely DGIndex has no way of knowing which language is on which track. Sometimes Japanese is first and English second, sometimes it's the other way around - so to be certain of getting the track you want, you should select 'demux all tracks' in the output method.

Dolby Digital Decode:
Dolby Digital audio should be should be demuxed and decoded externally if you want the best quality - see the Audio Guides. You wont need these options.

48 -> 44.1Khz: This converts dvd's native 48Khz audio to 44.1Khz which is that used by CDs. The only reason you would want to do this is incase you have a very old soundcard that cannot play 48Khz audio. In such a case you could probably do with a new soundcard :)

Normalization: When decoding, this will boost the audio so it is as loud as it can be without clipping. This is a useful feature when decoding PCM wav audio but does not apply when demuxing.

Making a Project File

Once you've got all these settings right, you are ready to save a DGIndex project file. So, select "Save Project" from the File Menu, or just hit F4. Make sure you save you project file somewhere sensible. If it takes much more than about 20 minutes with these settings then you need a serious defrag or you need to stop using your USB 1.0 Hard Drive :) When it is done you should hear a nice ping sound and have a .d2v file to play with. If you have processed audio it will be in the same folder.

One final piece of advice is that DGIndex project files refer to the drive and folder that the footage is stored. If you move your vob files at any point then you will need to remake the project file. The project file, however can be moved or copied anywhere you like.

Using the DGIndex Project in AVIsynth:

Just as DGIndex is the best way to index a dvd, Avisynth is the best way to access that index.

By this point you should be fairly familiar with Avisynth, having used it in both the Avisynth tutorial and when looking at the features of VirtualDubMod. What we need to do is make an Avisynth Script that imports our .d2v file.

Any AMVapp users are lucky, as they will already have an .avs file created for each .d2v file thanks to a template that DGIndex can use. If you are not using the amvapp, you will need to create your avs file manually. You can do this by using a text editor, as before, to make a .avs file that contains the following command:


Or you can import the d2v file using the Open via AviSynth option in VirtualDubMod and select the MPEGG2Source (mpeg2dec.dll) template. It will automatically create an avs file for you.

Load the avs file into VirtualDubMod using the regular 'Open video file...' option (or drag and drop). Please. A lot of people jump straight into trying to load their avisynth script into an editing program like Premiere and get all confused when it doesn't work. Premiere is not going to give you any useful information, you should test your scripts in VirtualDub(Mod) or Windows Media Player at the least.

If you are given an error you should refer to the Testing the AMVapp page. The AMVapp tests are there to make sure there is nothing wrong with the actual software you use. If all the tests work fine then you have made some mistake somewhere, either in the d2v creation or in making your avs script.

With the right avs script and the AMVapp installed then everything should be working fine. If you have installed the software manually then you will need to make sure that Avisynth is correctly installed and you have DGDecode.dll in your default plugin folder.

Here is a quick summary of possible errorsthat you might get, just in case:

"avs is an unrecognized file type" - This error, or one similar to it, is what you can get if avisynth isn't installed correctly - particularly if it isn't registered correctly. Using the amvapp should solve this.

"MPEG2Source: unable to load file "somethingorother.d2v" in something.avs, line something" - This error will occur if your MPEG2Source command isn't pointing to a d2v file or you've made a typo.

"Unrecognized exception: The memory at blah blah blah is unreadable" - This is a nasty error, but it's not always uncurable. You may need to cleanse your system of avisynth, mpeg2dec/dgdecode and dvd2avi/DGIndex and start again. Doing a purge, installing the AMVapp and remaking the d2v files should fix this. If it still occurs it may be a real memory issue but this should not happen with just one script and not with the versions of the programs included in the newest AMVapp. This error often occurs when using newer versions of DGIndex without updating DGDecode.dll

"Unknown command MPEG2Source" - This will occur if you'd made a typo or if the plugin that the command is for hasn't been loaded - in this case the plugin is DGDecode.dll and should be in the Avisynth Plugins folder.

"obsolete d2v" - This will happen if you use an old DVD2AVI-created d2v file with the new dgdecode. It won't work, you should remake your d2v project file with DGIndex for greater quality and stability.

However, if all has gone well you should see your footage appear in VirtualDubMod.

Before we analyse the footage that you have, there is one last thing to tell you about and that is the Post Processing setting in the MPEG2Source command.

MPEG2Source("C:/yourfolder/yourprojectfile.d2v", cpu=6)

This setting called cpu designates the strength of the post-processing. The values are from 1 to 6 with 6 being the strongest. Some people find that 6 blurs the material a little but most everyone would agree that a setting of 4 would simply improve quality. If you dont want any postprocessing to be done, then simply omit the cpu parameter, or set it to 0.