What is DGIndex? | Table of Contents |
DGIndex, part of the DGMPGDec package, is primarily designed to create an index of an MPEG video stream, containing the location of each frame in the input stream, and some additional information about each frame. This index, or project file, is used by the companion Avisynth filter DGDecode to provide frame-accurate serving of the video via an Avisynth script. DGIndex is able to decode and index most MPEG1/2 streams including elementary streams, program streams, VOBs, VCDs, SVCDs, PVA files, and transport streams. Additional features include: video demuxing (m1v/m2v), audio demuxing (ac3, dts, aac, mpa, and lpcm), optimized iDCTs, luminance filtering, cropping, and more.
DGIndex is an evolution of Chia-chen Kuo's DVD2AVI and is baselined off DVD2AVI v1.77.3.
The evolved version was renamed to DGIndex to avoid naming confusions, to reflect the significant divergence of functionality, and to clearly link it with neuron2's companion tools in DGMPGDec. Neuron2 wants to take great pains to acknowledge the origins of DGIndex as described in the Credits section below.You can get the latest binaries and source code of DGMPGDec at http://neuron2.net/dgmpgdec/dgmpgdec.html.
DGIndex is free software distributed under the terms of the GNU GPL v2 license. You must agree to the terms of the license before using the program or its source code. Please see the License section for details.
This document is a reference manual for DGIndex. Please refer to the accompanying documents for quick start information, frequently asked questions, and guidance on actual usage of DGIndex in typical scenarios.
File Menu | Table of Contents |
Open | Table of Contents |
Use this option to open one or more source files. If you open more than one file, their contents will be concatenated in the order in which the files are listed in the File List dialog. Demultiplexing or frame serving will produce a single output stream that is a concatenation of the source files. When you open multiple files, all the files must be of the same type; e.g., you cannot open MPEG1 and MPEG2 files at the same time, you cannot open program streams and transport streams at the same time, etc.
Clicking on File\Open causes one of two things to happen:
If no files have yet been selected, the Open dialog will appear.
Multiple files may be selected by holding the SHIFT or CTRL keys during file selection.
Click "Open" to proceed to the File List dialog.
If one or more files have already been selected, the File List dialog will open.
Files can also be loaded by dragging-and-dropping them onto the DGIndex window. This causes the File List to be opened with the list containing the drag-and-dropped files.
When the File List dialog opens with newly selected files, it sorts them (using an intelligent multifield sorting algorithm) and lists the selected files. In rare cases, the order produced may not be what the user requires. This can be corrected by using the list editing buttons. The following buttons are available for list management:
When the list is arranged satisfactorily, click "OK" and the contents of the File List will be loaded into DGIndex as a continuous sequence.
Sometimes due to cutting or editing, video streams may start with several frames that cannot be decoded properly (because their reference frames are missing). When this is the case for the first file in your file list, DGIndex will warn you by popping up a dialog box containing this message: "WARNING! Opening GOP is not closed. The first few frames may not be decoded correctly." This is just a warning and does not prevent DGIndex from operating correctly. In this case, DGIndex replaces the first few frames with copies of the first good decodable frame. Note that this warning and replacement occurs only for the first file in the file list.
Load Project | Table of Contents |
Use this option to open existing DGIndex (d2v) project files.
When a project file is loaded, DGIndex opens the project's files in the correct order and restores the following settings from the project file:
Save Project | Table of Contents |
Use this option to generate a DGIndex project file (d2v file). The project file is used by DGDecode (or DGVfapi) to frame-serve the video.
DGIndex builds a project file containing the paths to the source files, the video settings, and MPEG indexing information. For more information on the structure of d2v files, refer to Appendix A.
When the project is saved, the timeline selection points are honored, that is, the served video and the demultiplexed audio will contain only the portions of the input streams selected by the timeline selection points.
Generation of the project file can take several minutes depending on the size of the project and the speed of your computer.
Note that the source file names and path locations cannot be changed after a project file is generated. If you need to change their names or move them, you will either have to regenerate the project file using Save Project after moving them, or you will have to edit the paths given in the top of the d2v file.
Save Project and Demux Video | Table of Contents |
Use this option to generate a DGIndex project file (d2v file) as described in the section "Save Project" above, and at the same time demultiplex the video to a separate MPEG elementary stream file (m1v or m2v file). Elementary stream files are sometimes needed for use with other applications (such as DGPulldown and DVD authoring programs). DGIndex provides this functionality as a convenient tool for the sophisticated user; elementary streams are not required for frame serving via DGDecode (or DGVfapi).
The elementary stream file will be generated in the same directory as the project (d2v) file, and its name will be created by concatenating the base name of the project file with ".demuxed.m1v" for MPEG1 streams, or ".demuxed.m2v" for MPEG2 streams. For example, if the project file is named "movie.d2v" and it contains MPEG2 video, the elementary stream file will be named "movie.demuxed.m2v".
Note that demultiplexing always generates a single elementary stream file containing all the video of the project, even if the project file refers to multiple source files.
Demux Audio Only | Table of Contents |
Some streams contain only audio, and so it is not possible to do Save Project. To allow for demuxing the audio from such streams, this option is provided. It may also be used on streams that contain video, but the selection range is ignored and the entire stream is demuxed.
The demuxed audio file will be generated in the same directory as the source stream file(s), and its name will be created by using the base name of the first loaded source file.
Note that demultiplexing always generates a single elementary stream file containing all the audio of the project, even if the project file refers to multiple source files.
Save BMP | Table of Contents |
Use this option to save the current frame on display in the DGIndex window to a Windows BMP file. When this option is selected, a file dialog will open that allows you to specify the desired name and location for the BMP file.
Preview, Play, Stop, Pause/Resume | Table of Contents |
Use these options to control video playback in the display window. Keyboard hotkeys are given in parentheses.
Play and Preview play only video and not audio.
The video playback speed is controlled by the playback speed control options available via the Options/Playback Speed menu.
The Play command does not decode frames prior to the current position to obtain reference frames, so you may see macroblocking on the first few frames of a Play operation if you jump around on the timeline. Note that this is purely a display quirk in DGIndex, it never occurs in the frame-served video or in demultiplexed video files.
Play and Preview automatically pop up the Information Panel.
Exit | Table of Contents |
Use this option to close all open files and terminate DGIndex.
Stream Menu | Table of Contents |
Detect PIDs: PAT/PMT | Table of Contents |
DGIndex can open transport streams. Transport streams can contain multiple programs, each of which contains audio and video streams. The Stream menu allows the user to list the programs and to select the desired program to be decoded. The stream menu is disabled if the input stream is not a transport stream. Transport streams periodically send data tables called the PAT/PMT tables that specify the programs and tags (PIDs) for the associated audio and video streams. By setting the PIDs for the desired audio and video streams, you thereby select the desired program.
Use the "Detect PIDs: PAT/PMT" option to list the programs and their associated streams, and to select the desired streams to be decoded. DGIndex will parse the first input file for the PAT/PMT tables and, if found, will display the programs and their PIDs in a list box. If PAT/PMT tables cannot be found, an error message will be shown instead, in which case the list box should be closed and the "Detect PIDs: Raw" option used instead.
To select the desired video stream, highlight it by selecting it with a mouse click. Then click on the "Set Video" button. To select the desired audio stream, highlight it by selecting it with a mouse click. Then click on the "Set Audio" button. When you have selected your PIDs, click on the "Done" button to close the list box. The video should now be displayed in the DGIndex window.
The PIDs are stored in the DGIndex.ini file and so will be retained across DGIndex sessions.
Note that selecting an audio stream as video, or vice versa, will produce undefined operation and may crash DGIndex. For that reason, both PIDs come up by default to 0x02, which is a reserved value. However, because the DGIndex.ini file retains PIDs from a previous session, you may run into this. If you get strange behavior or crashing, then manually set the audio and video PIDs to 0x02 using the "Set PIDs" option before loading your input file(s), and then detect and set your PIDs normally.
DGMPEGDec currently does not support audio-only streams. This will be fixed in a future version.
Detect PIDs: Raw | Table of Contents |
Rarely, a transport stream may lack PAT/PMT tables. In such cases, the PIDs of the audio and video streams can be displayed and selected using the "Detect PIDs: Raw" option. Because raw PID detection does not show which audio and video streams go together, some trial and error may be required to find which audio and video PIDs belong together (commonly encountered pairs of associated video/audio PIDs are 11/14, 21/24, and 31/34). For that reason "Detect PIDs: PAT/PMT" should always be tried first.
The operation of the "Detect PIDs: Raw" list box is the same as described above for the "Detect PIDs: PAT/PMT" list box.
Set PIDs | Table of Contents |
Use this option to manually specify PIDs using hexadecimal notation, or to query the selected PIDs. If you use this dialog to specify your PIDs, DGIndex will not detect PIDs and will simply use the specified PIDs to select the audio and video streams.
Note that selecting an audio stream as video, or vice versa, will produce undefined operation and may crash DGIndex. If you get strange behavior or crashing, then manually set the audio and video PIDs to 0x02 using the "Set PIDs" option before loading your input file(s), and then detect and set your PIDs normally.
Video Menu | Table of Contents |
iDCT Algorithm | Table of Contents |
Specify which iDCT algorithm will be used by DGIndex and DGDecode.
Algorithms that are not supported by your processor are automatically deleted from the menu, so you may not see all of the above options.
The iDCT algorithm that you should use depends primarily on what CPU you have, and to a lesser degree on the desired iDCT accuracy. All of the available options are IEEE-1180 compliant. For more information on iDCTs please see the DGDecode manual.
Quality: IEEE-1180 Reference > 64-bit Floating Point > Remaining iDCTs.
Speed: SSE2MMX is the fastest. IEEE-1180 Reference is the slowest.
Note that the selected iDCT algorithm is placed in the D2V file. DGDecode can be configured to use this setting (default) or it can be overridden via the "idct" parameter.
This setting is also stored in the DGIndex.ini file and therefore is saved across DGIndex sessions. If you edit the DGIndex.ini file, or the D2V file, to specify an iDCT algorithm that is not supported by your processor, then DGIndex and DGDecode will demote your setting to the next available setting that is supported by your processor.
Field Operation | Table of Contents |
MPEG2 video provides a syntax element (RFF flags) that allows a single field of any frame to be repeated automatically during display ("pulled down"). The extra fields do not occupy space in the MPEG2 stream but are simply created by copying when the stream is decoded and displayed. This facility is most often used to display film rate clips (23.976 fps) at the NTSC rate (29.97 fps), a process called 3:2 pulldown. In practice, however, pulldown in various different patterns is commonly encountered. It can be used, for example, to display 25 fps PAL at the NTSC rate. You can learn about telecining and pulldown at this web site.
Understanding the theory and practice required to properly set this option for a given application is nontrivial. Here we can only define the operations and give some general guidance. There is ample additional material available in existing guides.The Field Operation setting allows the user to specify how the pulldown (RFF) flags are to be handled.
The Field Operation is perhaps the most important option to understand when using DGIndex. Most users should first preview the project using the Honor Pulldown Flags option. If the clip is not PAL or MPEG1, and the Video Type field in the Information window indicates Film 95% or higher, it is likely that the clip can be treated as 3:2 pulldown material, and so the Force Film option should be selected for generation of the D2V file.
If the percentage is much lower than 95% or the Video Type indicates a Video percentage, then you should leave this option set to Honor Pulldown Flags for generation of the D2V file. If the result is combed (because the source is interlaced, hybrid interlaced/3:2, field blended, etc.), you may want to apply a deinterlacer or inverse telecine (IVTC) filter in your Avisynth script.
If the film percentage is low but still mostly film, you can try using Force Film and see what you get. You may find some stray combed frames in the output. You can fix those by post-processing with FieldDeinterlace(full=false). If the result is satisfactory to you, then fine. If not, there are more advanced ways to handle hybrid, hard-telecined, field-blended, and other pathological video. These more advanced methods almost always require the video to be served with the Honor Pulldown Flags option.
When assessing the FILM percentage using a preview operation, it is important to use a lengthy portion of the film itself, because introductions and credits are sometimes rendered differently than the main movie content.
Almost invariably, if you know the source is not mostly 3:2 pulled-down NTSC, you will want to select Honor Pulldown Flags and then post-process as required. Keep in mind that if there are no pulldown flags, there is nothing to honor, so this option just delivers the encoded frames.
The Ignore Pulldown Flags option should be necessary only for advanced users who want to see just the exact coded pictures in the MPEG stream.
You should also read this article for additional information on using Force Film vs. external IVTC.
Note that the Honor Pulldown Flags option was formerly called None, and the Ignore Pulldown Flags option was formerly called Raw Encoded Frames.
YUV->RGB | Table of Contents |
When you use DGVfapi to frame serve, the video is always converted to RGB. This option specifies how the colorspace conversion to RGB is to be performed.
This option affects conversion to RGB, which occurs in only two places in DGMPGDec: 1) in the display window of DGIndex, and 2) the video served by DGVfapi. Generally, unless you have a good reason to clip the RGB, you should select the PC scale option.
Two well-known situations for using TV scale are as follows:
Luminance Filter | Table of Contents |
Use this option to perform luminance adjustments.
Use the checkbox in the upper left corner to Enable or Disable this filter. Position the Gamma and Offset controls until desired results are achieved. DGIndex stores the luminance adjustment settings in the D2V file and DGDecode reads them and applies the same luminance adjustment to the served video, so that what you see in the DGIndex window is what you get in the served video.
Gamma performs a non-linear adjustment, while offset just adds or subtracts luminance for all the pixels. It is beyond the scope of this manual to describe the concept of gamma. Google is your friend.
This function is unrelated to, and should not be confused with, DGDecode's bundled Avisynth filter called LumaYV12().
Cropping Filter | Table of Contents |
Use this option to crop your video.
Use the checkbox in the upper left corner to Enable or Disable this filter. Position the Left, Right, Top, and Bottom controls until desired results are achieved. DGIndex stores the cropping settings in the D2V file and DGDecode reads them and applies the same cropping to the served video, so that what you see in the DGIndex window is what you get in the served video.
Note that for backward compatibility, the cropping settings are referred to as "Clipping" in the D2V file.
Audio Menu | Table of Contents |
Output Method | Table of Contents |
Use this option to control audio processing.
DGIndex can demultiplex the following types of audio: LPCM, AC3, MPA, DTS, AAC.
Only AC3 tracks can be decoded to WAV. Use an external audio utility, such as BeSweet,
to decode other audio types.
Demuxed audio files will be named after the project name and additional parameters of the audio
format.
For example: "MyProject T01 3_2ch 448Kbps DELAY -248ms.ac3".
An important number is contained in the filename of the demultiplexed audio file: the delay correction for the audio relative to the video. In the example above, the audio delay correction is reported as -248 milliseconds. That means that the audio should be advanced by 248 milliseconds. The number -248 could thus be entered directly into VirtualDub's "Audio Skew Correction" edit box to achieve audio/video synchronization. Note that when AC3 tracks are decoded to WAV, their filenames do not contain a delay correction value because the correction is applied during decoding.
Track Number | Table of Contents |
Use this option to select the audio track(s) to be operated on by Demux Tracks and Decode AC3 Track to WAV.
If Demux Tracks is selected, one or more tracks can be selected. If Decode AC3 Track to WAV is selected, only one track should be selected. If Demux All Tracks is selected, this option is ignored.
Dolby Digital Decode | Table of Contents |
This submenu applies only when the audio output method is selected as Decode AC3 Track to WAV. It affects how the AC3 stream is converted to WAV format.
Dynamic Range Control (DRC) Tim Carroll writes as follows about DRC:
"Different listening environments present a wide variety of dynamic range requirements. Obviously a quiet movie does not fit well into a noisy environment, nor does a loud movie fit into a quiet environment. The classic solution has been to dramatically reduce the dynamic range of the audio prior to transmission, then the audio level can be set once by each viewer to suit his or her environment. The unfortunate side effect is that audio impact is lost. Explosions, dialogue, and background grasshoppers are all reproduced at the same loudness and the program can sound, well, flat -- to say the least.
Happily, there is another solution. Dolby Digital provides a Dynamic Range Control (DRC) system that is rather unique. Based on a pre-selected DRC profile, the Dolby Digital encoders calculate and send DRC metadata along with the original audio signal. The DRC metadata can then be applied to the signal by the decoder to reduce the signal's dynamic range. On many decoders, DRC can optionally be scaled back or even disabled so that the original dynamic range of the audio is delivered.
This unique consumer-side dynamic range processing allows the kitchen DTV set to have restricted dynamic range so that quiet audio can be heard above background noise, while simultaneously the large DTV set in the family room can have unrestricted dynamic range and can stomp on the background noise (and possibly the neighbors). DRC helps to provide the best possible presentation of program content in virtually any listening environment, regardless of the quality of the equipment, number of channels, or ambient noise level."
DGIndex provides four possible settings for DRC, as described below. Note that some AC3 encodings may not provide DRC metadata, and so the setting may appear to have no effect.
Dolby Surround Downmix AC3 supports up to 6 channels but when decoding to WAV only 2 channels (left and right stereo) can be output, so a process of downmixing is applied. This option selects which of two possible methods for downmixing is to be used. The first is used when this option is unchecked: a simple stereo downmix (called a left-only/right-only, or Lo/Ro, downmix) suitable for playback on a two-channel stereo system. The second is used when this option is checked: a surround-compatible downmix (left-total/right-total, or Lt/Rt, downmix) of the multichannel source program suitable for downstream Dolby Surround Pro Logic or other matrix decoding, usually by a Pro Logic home theater decoder.
Tim Carroll writes:
"The only difference between the downmix modes is how the surround channels are handled. The Lt/Rt downmix sums the surround channels, attenuates them 3 dB (i.e., multiply by 0.707) and adds them out-of-phase to the left channel and in-phase to the right channel. This allows a Pro Logic home theater decoder to produce L/C/R/S channels when connected to a stereo set-top box or DTV receiver. Conversely, the Lo/Ro downmix adds the right and left surround channels discretely to the left and right speaker channels. This preserves the stereo separation for stereo-only monitoring and allows for generation of a mono-compatible signal. What about the LFE channel? Well, it is simply discarded."
If you are wondering why the LFE channel is discarded, please refer to Appendix C.
So, check this option if you plan to play the decoded audio on a Pro Logic home theater decoder. Leave it unchecked if you plan to play the decoded audio on a standard left/right stereo component. Note that leaving this option unchecked does not mean that downmixing will not be performed. It just specifies the kind of downmixing that is done, as described above.
Pre-Scale Decision Pre-Scale Decision is a more refined method of normalization than the one originally implemented in DGIndex (see Normalization below). It is designed to reduce quantization errors of Dolby Digital decoding. To use it, load your input file(s) and select audio method Decode AC3 Track to WAV. Then set your normalization amount using the Normalization dialog slider (don't enable Normalization with its check box, just set the percentage with the slider). Finally, check the Pre-Scale Decision menu option. Immediately, a pass will be made over the input files and a gain factor (pre-scale ratio) will be determined and stored for later use. This gain factor is such that when the audio is amplified by this factor, the highest sound peak will be set to the percentage of the maximum possible audio level set by the normalization selected. So, if your normalization is set to 50%, the loudest sound will be set to 50% of maximum.
The calculated gain is shown in the Info box of the Information Window and is applied to later decoding (when Save Project is performed), as long as it is left checked. When the prescale decision is complete, the Normalization option is automatically disabled if it was enabled and should not be subsequently enabled, because the calculated pre-scale ratio will be used.
48 -> 44.1KHz | Table of Contents |
This submenu applies only when the audio output method is selected as Decode AC3 Track to WAV. It affects how the AC3 stream is converted to WAV format.
When this option is set to a value other than "Off", the audio will be downconverted from 48KHz to 44.1KHz. This conversion can take a lot of time. The quality settings allow you to trade off quality against conversion time. Use "Low" for lowest quality but fastest conversion. Use "UltraHigh" for best quality but slowest conversion. "Mid" and "High" provide intermediate tradeoffs.
Normalization | Table of Contents |
This submenu applies only when the audio output method is selected as Decode AC3 Track to WAV. It affects how the AC3 stream is converted to WAV format.
This option normalizes the audio but is not as refined as the Pre-Scale Decision method described above. To use it, set the desired normalization level and then check the check box in the corner of the dialog box. Nothing happens immediately. Subsequently, when a Save Project operation is performed, two passes will be made. The first creates the project in the normal way; the second opens the created audio file and normalizes it. Normalization means that the audio is scaled such that the loudest sound in the input files is adjusted to be the percentage of the maximum volume given by the Normalization slider value.
The Pre-Scale Decision method is preferred for two reasons: 1) quantization errors are reduced, and 2) after a first pass is made, all subsequent Save Project operations require only one pass, while with the Normalization method of this section two passes are always made every time Save Project is performed.
Options Menu | Table of Contents |
Process Priority | Table of Contents |
Specify what CPU usage priority Windows will assign to DGIndex.
Use this option if you are running multiple applications at once, and want to prioritize (or de-prioritize) DGIndex for CPU usage.
Playback Speed | Table of Contents |
Specify the playback speed for play and preview operations.
The single step mode is controlled by the right arrow button (>) on the timeline. Please be aware that due to orphaned B frames, the first few frames of a playback operation, including a single-stepping operation, may show artifacts. They will not show up in the frame-served video, so don't worry! To ameliorate this effect, start your single-stepping operation a little bit ahead of the frames you desire to view. Also note that during a single-stepping operation, you cannot navigate on the timeline. To single-step from a new location, first exit the play operation, then reposition on the timeline in the normal way, and restart the play operation. Finally, single-stepping does not give you per-frame granularity for cuts and timeline positioning; it just allows you to pace the playback so that individual frames can be examined.
AVS Template | Table of Contents |
DGIndex can automatically generate an Avisynth script for serving your project. It requires you to specify a template file, such as the following one:
loadplugin("...\DGDecode.dll")
loadplugin("...\Decomb.dll")
mpeg2source("__vid__",cpu=6)
fielddeinterlace()
This is any normal AVS script, except that the D2V file name is replaced with __vid__ (that's two underscores before "vid" and two after). When DGIndex creates the AVS script, it replaces __vid__ with the correct D2V file name.
To select and enable a template, use the Options/AVS Template pulldown menu item to set your template file as the active template file. After performing a Save Project operation, DGIndex uses this file as a template and inserts the right file name whenever it sees __vid__.
You may also use the __aud__ specifier to generate the audio file name. Note that if you are generating more than one audio file, this specifier will refer to the last audio file that is opened. Therefore, to be sure to get the desired audio file, process just one audio stream.
DGIndex creates the AVS script file only if it does not already exist. The script file is created in the same directory as the d2v file.
The AVS Template dialog box displays the current active template file. If no file is shown, then a template is not being used. The dialog box provides three possible actions:
Don't Use Template: Choose this action if you do not want DGIndex to automatically create AVS scripts.This option setting is stored in the INI file and so is retained across DGIndex invocations.
Correct Field Order | Table of Contents |
Sometimes streams are encountered that contain mixtures of TFF and BFF material. In MPEG2, these field order transitions are fixed at display time via the TFF/RFF flags. But we usually want to output a stream with one consistent field order, and some tools, such as Telecide and (Leak)KernelDeint, require a fixed field order. Indeed, AVI does not carry a field order property!
This option, when enabled, adjusts the TFF/RFF flags so that a stream with a single field order is output. This affects only streams containing field transitions, of course. When disabled, the field order transitions will be preserved in the served video.
This option should always be enabled, unless you have a good reason for serving video with field order transitions.
This option setting is stored in the INI file and so is retained across DGIndex invocations.
Use Full Paths | Table of Contents |
D2V files and AVS files created via an AVS template contain references to audio and video files. This option controls whether they should be stored as simple file names or full paths. Historically, DGIndex has always used full paths; this causes an inconvenience when moving project files, because the D2V and AVS files need to be edited to change the paths. Therefore, this option was added to allow relative references. When this option is disabled, the D2V file and generated AVS scripts will suppress the full path information and provide just the file names. This allows the project files to be moved without having to edit any of them.
The option to continue using full paths was retained to provide backward compatibility to third-party applications.
This option setting is stored in the INI file and so is retained across DGIndex invocations.
Force Open GOPs in D2V File | Table of Contents |
Rarely, a stream may be encoded incorrectly, such that the GOPs are marked as closed when they are really open. This can cause you to see blocking artifacts when doing random access in the frame-served video. To correct these cases, the Force Open GOPs in D2V File option is provided. When it is checked, GOPs are all marked as open in the D2V file, and the actual open/closed GOP indications in the stream are ignored. This cures the macroblocking but makes random access slower. Because the problem is so rare, and the cure reduces performance for normal streams, the cure is not applied automatically, but is presented as an option.
In practice, if you see blocking artifacts when doing random access while frame-serving, enable the Force Open GOPs in D2V File option and see if the blocking is fixed.
This option setting is stored in the INI file and so is retained across DGIndex invocations.
Log Quant Matrices | Table of Contents |
When MPEG2 files are created, configurable data structures called quantization matrices are used to control how the video is compressed. Often, different matrices work better for different kinds of video. Power users often like to know what matrices have been used to encode their streams. This option allows you to dump all the quantization matrices found in the stream.
To dump the matrices, enable this option and then perform a Save Project operation. A text file will be created that contains the quantization matrices. For example, if your d2v file is named "movie.d2v", the dump file will be named "movie.quants.txt".
Note that only stream events that change the active quant matrices are logged. So, for example, if you have the same matrices sent with each sequence header, only the first will be logged (because it changes the default matrices).
Also note that the frame numbering given in the dump file refers to the encoded frame numbers and not the display frame numbers. These two are different when pulldown is present. In that case, you can use a DGIndex project with "Ignore Pulldown Flags" to serve the video such that the display frame numbers correspond to the encoded frame numbering.
Note that this setting is not stored in the DGIndex INI file.
Log Timestamps | Table of Contents |
This option allows you to dump a trace of the audio and video PTS/DTS timestamps encountered when a Save Project operation is performed. The dump also includes traces for each decoded picture and GOP starts in order to expose the alignment of the timestamps with the pictures.
To dump the timestamps, enable this option and then perform a Save Project operation. A text file will be created that contains the timestamp trace. For example, if your d2v file is named "movie.d2v", the dump file will be named "movie.timestamps.txt".
The timestamps are divided by 90 in the dump, so the time unit is milliseconds.
Note that this setting is not stored in the DGIndex INI file.
Use DirectDraw Overlay | Table of Contents |
Enable this option if you want the DirectDraw overlay to be used for displaying frames in the DGIndex window. Disable it if you do not want the overlay to be used. Note that this setting is read and used when input files are opened. If you change it while a file is loaded, no change in overlay usage will occur for the currently loaded file.
This option setting is stored in the INI file and so is retained across DGIndex invocations.
Force Fusion-Style Audio | Table of Contents |
Program streams that include audio on private stream 1 usually follow the DVD convention of including an audio substream number and associated header information. This is only a convention, however, and is not required by MPEG syntax. Some streams do not follow this convention and, instead, they do not provide an audio substream number and associated header information. The most common case is seen in program streams (MPG files) created by the Dvico Fusion capture cards. Therefore, we can say that these streams carry "Fusion-style" audio. Such streams need to be parsed differently, and this is controlled by this option. Note that Fusion transport streams (TP files) are handled correctly and this option setting is ignored for such streams.
Ideally, Fusion-style audio should be detected automatically and this option should not be required. However, some technical problems stand in the way and so the initial support for these streams requires setting this option.
Enable this option if you want to force audio parsing in Fusion style. Disable it for conventional DVD-like parsing.
This option setting is stored in the INI file and so is retained across DGIndex invocations.
Tools Menu | Table of Contents |
Parse D2V | Table of Contents |
This tool is intended for power users. When selected, you are prompted to open a d2v file. After the d2v file is selected, a text file is created that contains an analysis of the contents of the d2v file, and the system's editor is opened on that text file. If your d2v file is named "movie.d2v", the text file will be named "movie.parse.txt". The contents of the text file will be readily understood by power users.
Help Menu | Table of Contents |
SIMD, DirectDraw Overlay, VFAPI Plug-In | Table of Contents |
These are read-only indicators displaying information about the status of DGIndex.
The DirectDraw Overlay indication is valid only after an input file is loaded.
The VFAPI Plug-In indication must be present; otherwise, VFAPI frame serving will not be operative.
Quick Start Guide, DGIndex User Manual, and DGDecode User Manual | Table of Contents |
These options open the respective documents in your browser. To work, the files "QuickStart.html", "DGIndexManual.html", "DGDecodeManual.html" that are included in the DGMPGDec package must be in the same directory as the "DGIndex.exe" file. Do not rename these files.
Display Window | Table of Contents |
Navigation | Table of Contents |
Preview the video file(s) and select the start/end points for the project/demuxing.
Use the navigation slider, and these two buttons for navigation:
< - Seek to previous I frame.Currently, the display window displays only I frames in navigation mode (because they are possible selection points for cutting the video), which usually appear about every 12 to 15 frames. This makes the video appear to jump when stepping, instead of moving smoothly. Of course, during play, preview, or frameserving, all frames are shown.
The video may in some cases appear stretched/squashed in the display window because DGIndex displays the video as is it stored in the MPEG stream, which may not be the same as the final display size. For an explanation, read Doom9's article on Aspect Ratios.
When a video is displayed that has a frame size that will not fit on a 1024x768 desktop, the video is reduced in size by a factor of two. Thus, high-definition (HD) videos can be previewed without requiring scrolling.
Selection | Table of Contents |
When doing Save Project, Save Project and Demux Video, or Preview, the operation will be applied only to the portion of the timeline between the selected start and end points.
By default, the entire timeline is automatically selected. Selection start/end point can be changed, but only one set of start/end point may be specified for a project (i.e.: multiple start/end points are not yet supported).
Splash Screen | Table of Contents |
When no file is loaded DGIndex can display a splash screen. To enable this feature, place an appropriately sized windows BMP file called "splash.bmp" in the same directory as DGIndex.exe.
Information Panel | Table of Contents |
The Information Panel displays important statistics about the loaded video and audio stream(s). Information displayed in this panel is often essential for correctly processing DGIndex projects, especially when frameserving into third-party applications. The Information Panel is displayed when a project is saved or when using the Play/Preview commands. Note that when doing a Play/Preview operation, the information will apply only to the section actually played or previewed.
Video Section | Table of Contents |
Audio Section | Table of Contents |
Status Section | Table of Contents |
APPENDIX A: D2V File Structure | Table of Contents |
This Appendix documents the syntax and semantics of the D2V file format. Normal users need not concern themselves with this information, as it is intended for developers and power users.
There are three sections to all D2V files: 1) the header section, 2) the settings section, and 3) the data section. These sections are described below.
D2V Format - Header Section | Table of Contents |
Following is a typical header section:
DGIndexProjectFile13
3
G:\RETURN_OF_THE_KING\VIDEO_TS\VTS_01_1.VOB
G:\RETURN_OF_THE_KING\VIDEO_TS\VTS_01_2.VOB
G:\RETURN_OF_THE_KING\VIDEO_TS\VTS_01_3.VOB
The first line always begins with the string "DGIndexProjectFile" immediately followed by a two-digit D2V version number. This number is checked by DGDecode and must match the version expected. This mechanism thus enforces the requirement that DGIndex and DGDecode must be used in matched pairs. If DGDecode rejects your D2V file as "obsolete", be sure that you are using the correct version of DGDecode. Sometimes one forgets that one has an older version in the Avisynth plugins folder, or one forgets to upgrade DGDecode when upgrading DGIndex.
The second line gives the number of video files included in the D2V project file. Each video file must be referenced on the subsequent line(s). The header section must then terminate with a blank line.
Each source file reference consists of either a filename, if the Use Full Paths option is disabled; or the full absolute path of the referenced file, if the Use Full Paths option is enabled. If the Use Full Paths option is enabled and the referenced files are moved after creation of the D2V file, you must either edit the paths to be correct, or you must regenerate your D2V file.
In the remainder of the D2V file, the files are referenced with a number corresponding to their place in this list. The list is zero-based, that is, the first file is numbered 0.
D2V Format - Settings Section | Table of Contents |
Following is a typical settings section:
Stream_Type=1
MPEG_Type=2
iDCT_Algorithm=5
YUVRGB_Scale=1
Luminance_Filter=0,0
Clipping=0,0,0,0
Aspect_Ratio=4:3
Picture_Size=720x480
Field_Operation=0
Frame_Rate=29970 (30000/1001)
Location=0,0,6,17CF3
Note that the Clipping setting is called "Cropping" in the DGIndex menus. It was left as "Clipping" in the D2V file to avoid having to increment the D2V file format version number and cause incompatibilities with existing third-party applications.
The second section of a D2V file defines values that are determined by, or within, DGIndex. Some are determined by DGIndex as it analyzes the MPEG stream, others reflect user-specified choices. All of these fields must be explicitly defined, even if the associated value is zero. The settings section also must terminate with a blank line.
If the stream type is set to 2 (transport stream) then an additional line is appended after the Stream_Type line:
MPEG2_Transport_PID=880,881
Settings determined automatically by DGIndex are: Stream_Type, MPEG_Type, Aspect_Ratio, Picture_Size, and Frame_Rate (although the user-defined Field_Operation does have an impact on the Frame_Rate value).
The remaining settings are user-defined within DGIndex: MPEG2_Transport_PID,iDCT_Algorithm, YUVRGB_Scale, Luminance_Filter, Clipping, Field_Operation and Location.
The following table describes each of these parameters and the range of values possible for each.
D2V Field | Possible Values | Definition/Comments |
---|---|---|
Stream_Type | (0) Elementary Stream (1) Program Stream (2) Transport Stream (3) PVA Stream | Defines the type of MPEG stream. Determined by DGIndex. All possible values listed. |
Transport PIDs | (Video PID, Audio PID) | Selects the video/audio PIDs to be decoded. User-specified. Appears only for Stream_Type 2. |
MPEG_Type | (1) MPEG-1 (2) MPEG-2 | Defines the type of MPEG stream. Determined by DGIndex. All possible values listed. |
iDCT_Algorithm | (1) 32-bit MMX (2) 32-bit SSEMMX (3) 32-bit SSE2MMX (4) 64-bit Floating Point (5) 64-bit IEEE-1180 Reference (6) 32-bit SSEMMX (Skal) (7) 32-bit Simple MMX (XviD) | Defines the iDCT DGDecode will use to decode this video. User-specified. All possible values listed. |
YUVRGB_Scale | (0) TV Scale (1) PC Scale | Defines the range DGDecode will use if RGB conversion is requested. User-specified. All possible values listed. |
Luminance_Filter | (Gamma, Offset) | Defines values for DGIndex's Luminance_Filter. User-specified. Both Gamma and Offset have a range of: +/- 256. This parameter is unrelated to DGDecode's LumaFilter. |
Clipping | (ClipLeft, ClipRight, ClipTop, ClipBottom) | Defines values for Clipping (aka: Cropping) lines of video. User-specified. Arbitrary values possible within the resolution of the video. |
Aspect_Ratio | MPEG2: (1:1) (4:3) (16:9) (2.21:1) MPEG1: (1:1) (0.6735) (16:9,625) (0.7615) (0.8055) (16:9,525) (0.8935) (4:3,625) (0.9815) (1.0255) (1.0695) (4:3,525) (1.575) (1.2015) | Defines the Aspect Ratio of the video specified in the MPEG stream. Determined by DGIndex. All possible values listed. |
Picture_Size | (widthxheight) | Defines the size of the video after clipping has been applied. Determined by DGIndex. Arbitrary values possible within the size of the loaded video. |
Field_Operation | (0) Honor Pulldown Flags (1) Force Film (2) Ignore Pulldown Flags | Defines values for Field Operation. User-specified. All possible values listed. |
Frame_Rate | (rate) (num/den) | 'rate' defines output framerate * 1000. 'num/den' defines output framerate as numerator/denominator. |
Location | (StartFile,StartOffset,EndFile,EndOffset) | Defines start and end points for the video selection range. User-specified. |
D2V Format - Data Section | Table of Contents |
Following is a typical data section (real ones will typically be much longer):
d00 6 0 0 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 384035 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 768034 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 1152609 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 1537064 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 1922483 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 2304616 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 2689746 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 3075088 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 3459597 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 3844802 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 4227419 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 4613561 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
d00 6 0 4996887 0 0 b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0 ff
FINISHED 0.00% FILM
The data section of a D2V file contains the indexing of the MPEG video stream. There is one line for each I picture in the MPEG stream. Each line describes that I picture as well as all the following pictures up to, but not including, the next I picture.
Each I picture line consists of seven fields that must be explicitly defined, even if the associated value is zero. The layout for each line is as follows:
info matrix file position vob cell flags ...
Therefore, the second line in the typical data section given above would break down as follows:
info | matrix | file | position | vob | cell | flags |
---|---|---|---|---|---|---|
d00
| 6
| 0
| 384035
| 0
| 0
| b0 b0 90 b0 b0 a0 b0 b0 a0 b0 b0 a0 b0 b0 a0
|
The following section describes each field of an I picture line and its range of possible values.
The info field is a 12-bit hex number bit-mapped as follows:
Bit Position | Definition/Comments |
---|---|
bit 11 | 1 (Always 1 to signal start of data line) |
bit 10 | 1 (This line's pictures are part of a closed GOP) 0 (Open GOP) |
bit 9 | 1 (This line's pictures are part of a progressive sequence) 0 (Otherwise) |
bit 8 | 1 (This I picture starts a new GOP) 0 (Otherwise) |
bits 7-0 | 0 (Reserved) |
The matrix field displays the currently applicable Matrix_Coefficient value (colorimetry).
The file field references the file (as defined in the beginning of the D2V file) containing this line's pictures.
The position field is a decimal number that points to the byte position in the source file at which decoding of the indexed I picture should begin. For non-packetized streams, if a sequence header is present it is indexed, otherwise the picture header is indexed. Packetized streams are treated the same way except that the packet header start code preceding the sequence header or picture header is indexed. We prefer to index sequence headers because they may carry new quant matrices, but they are not mandatory at each GOP, so we fall back to the picture header.
The vob and cell fields display the current position within the DVD navigation stream (private stream 2). The VOB and CELL numbers are taken from there. Not applicable for non-DVD sources.
The sequence of Flags fields contains per-picture data corresponding to the pictures in display
order, that is, the Flags fields are re-ordered into display order. End Of Stream is signaled with a Flags field
value of ff
. Each per-picture Flags field is an 8-bit hex number bit-mapped as follows:
Bit Position | Definition/Comments |
---|---|
bit 7 | 1 (Picture is decodable without the previous GOP) 0 (Otherwise) |
bit 6 | Progressive_Frame Flag (See notes below) 0 (Interlaced) 1 (Progressive) |
bits 5-4 | Picture_Coding_Type Flag 00 (Reserved) 01 (I-Frame) 10 (P-Frame) 11 (B-Frame) |
bits 3-2 | 00 (Reserved) 01 (Reserved) 10 (Reserved) 11 (Reserved) |
bit 1 | TFF Flag |
bit 0 | RFF Flag |
Notes on Progressive_Frame Flag: This specifies that the picture is part of a frame (either a frame picture making up the entire frame, or a field picture making up one of the fields of the frame) whose fields are sampled at one moment. A RFF flag may be present however, such that the displayed frame after pulldown is interlaced.
Command-Line Interface | Table of Contents |
Parameters | Table of Contents |
DGIndex can also be executed via a command-line interface. This feature is intended for use in automated scripts and batch files, and for use by third-party applications. Following is the syntax and semantics for the command line interface. Note that options not included are controlled by DGIndex defaults and the DGIndex INI file.
Parameter | Command-Line Flag | Definition/Comments |
---|---|---|
Set Delimiter | -SD=delimiter character | Set the delimiter character. For some applications, the [ and ] characters are used in filenames. In such cases, you can use the -SD option to set a different delimiter character. The -SD option must precede any other options that use a delimiter. |
Input Files | -IF=[file1,file2,file3,...] | Load specific files. If a specified file cannot be found, it is ignored. Brackets Required! |
Auto-Input Files | -AIF=[file1] | Autoload files incrementally. If a specified file cannot be found, it is ignored. Brackets Required! |
Batch Files | -BF=[filelist] | Load a batch of files. The filelist should be a plain text file listing one file per line with no extra white space. If a specified file cannot be found, it is ignored. Brackets Required! HINT: The following DOS command automatically generates a filelist: DIR *.VOB /B > FILELIST |
Audio PID | -AP=audioPID | Transport stream audio PID, hex notation. (e.g., -AP=14) |
Video PID | -VP=videoPID | Transport stream video PID, hex notation. (e.g., -AP=11) |
iDCT Algorithm | -IA=algorithm | 1=MMX, 2=SSEMMX, 3=SSE2MMX, 4=64-bit Floating Point, 5=IEEE-1180 Reference, 6=Skal MMX, 7=Simple MMX |
Field Operation | -FO=field operation | 0=Honor Pulldown Flags, 1=Force Film, 2=Ignore Pulldown Flags |
YUV->RGB | -YR=method | 1=PC Scale, 2=TV Scale |
Track Number | -TN=track(s) | track#,track#,track#,... Use a comma-separated list of tracks. If OM=3 (Decode), only one track must be listed. |
Output Method | -OM=method | 0=None, 1=Demux Tracks, 2=Demux All Tracks, 3=Decode AC3 to WAV |
Dynamic Range Control | -DRC=amount | 0=Off, 1=Light, 2=Normal, 3=Heavy |
Dolby Surround Downmix | -DSD=on/off | 0=Off, 1=On |
Downsample Audio (48->44.1 kHz downsample) | -DSA=method | 0=None, 1=Low, 2=Mid, 3=High, 4=Ultrahigh |
Output File | -OF=[project file] | Do Not Include Extension! Brackets Required! |
Output File and Demux | -OFD=[project file] | Same as -OF but also demux the video. Brackets Required! |
AVS Script Generation | -AT=[AVS template file] | Specifies a template file for AVS script generation. Use -AT=[] to disable AVS script generation. |
Exit | -EXIT | Exits DGIndex when project has been saved. |
Minimize | -MINIMIZE | Starts and runs DGIndex in the minimized state. |
Hide | -HIDE | Starts and runs DGIndex in the hidden state. |
Example | Table of Contents |
This example...
DGIndex -IA=2 -FO=2 -TN=2,5 -OM=1 -AIF=[d:\files\vts_02_1.vob] -OF=[d:\MyProject] -exit
will save a project file to "d:\MyProject.d2v", specifying:
Auto-Input Files = "[d:\files\vts_02_1.vob]"
Output File = "[d:\MyProject]"
iDCT = "SSEMMX"
Field Operation = "Ignore Pulldown Flags"
Output Method = "Demux"
Track Numbers = "2 and 5"
EXIT
Here is an example that uses the ! character:
DGIndex -FO=2 -TN=1 -OM=1 -SD=! -IF=!D:\vobfiles\vts_02_1.vob! -OF=!d:\MyProject! -exit
Note that if you process the CLI line with a DOS shell (e.g., in a batch file), then the specified delimiter character must not be a DOS special character. If you invoke DGIndex using CLI programmatically, then DOS special characters can be used, because the DOS shell does not get involved.
APPENDIX C: "AC3 5.1" versus "AC3 3/2" | Table of Contents |
DGIndex reports AC3 5.1 audio as "AC3 3/2" and users sometimes wonder why. The 1 in "5.1" refers to the Low Frequency Effects (LFE) channel. When 5.1 audio must be played on one or two speakers, the source channels must be "downmixed".
The AC3 specification says that downmixing of the LFE channel is optional. In practice, it is dangerous, because loudspeakers can be overdriven by the full scale low frequency content of the LFE channel (which is intended for a special speaker called a subwoofer). That's why downmixing of the LFE is almost never implemented. Encoding 5.1 audio such that it can be played properly on one or two speakers is an art that is seriously complicated by downmixing the LFE channel.
So "3/2" means 5.1 without the LFE (maybe 5.0 would be better terminology, but 3/2 is in common use). Since almost no application downmixes the LFE (including DGIndex), DGIndex labels the source as "3/2". The LFE is not downmixed because a) it is complex to implement (needs rolloff), b) it is dangerous to downmix it, and c) the LFE is often avoided anyway by content providers. There are more details in this article.
Credits | Table of Contents |
License | Table of Contents |