What is DGAVCIndex? | Table of Contents |
DGAVCIndex, part of the DGAVCDec package, is primarily designed to create an index of an AVC (H.264) 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 DGAVCDecode to provide frame-accurate serving of the video via an Avisynth script. DGAVCIndex is currently limited to opening elementary (raw) and transport AVC streams (MP4 and MKV files are not yet supported).
You can get the latest binaries of DGAVCDec at http://neuron2.net/dgavcdec/dgavcdec.html.
This document is a reference manual for DGAVCIndex. Please refer to the accompanying documents for quick start information, frequently asked questions, and guidance on actual usage of DGAVCIndex in typical scenarios.
File Menu | Table of Contents |
Open | Table of Contents |
Use this option to open the source AVC file (elementary and transport streams only). Currently, although the GUI allows for selecting multiple files, only the first file is processed and the others are ignored.
Clicking on File\Open causes one of two things to happen:
If no files have yet been selected, the Open dialog will appear.
Click "Open" to proceed to the File List dialog.
If a file has already been selected, the File List dialog will open.
Files can also be loaded by dragging-and-dropping them onto the DGAVCIndex window. This causes the File List to be opened with the list containing the drag-and-dropped file.
Load Project | Table of Contents |
Use this option to open existing DGAVCIndex (dga) project files.
When a project file is loaded, DGAVCIndex opens the project's source file and restores the following settings from the project file:
Save Project | Table of Contents |
Use this option to generate a DGAVCIndex project file (dga file). The project file is used by DGAVCDecode to frame-serve the video via Avisynth.
DGAVCIndex builds a project file containing the path to the source file, the video settings, and AVC indexing information. For more information on the structure of dga files, refer to Appendix A.
Generation of the project file can take several minutes depending on the size of the project and the speed of your computer.
Save Project and Demux Video | Table of Contents |
Use this option to generate a DGAVCIndex project file (dga file) as described in the section "Save Project" above, and at the same time demultiplex the video to a separate AVC elementary stream file (avc file). Elementary stream files are sometimes needed for use with other applications. DGAVCIndex provides this functionality as a convenient tool for the sophisticated user; it is not required for frame serving via DGAVCDecode.
The elementary stream file will be generated in the same directory as the project (dga) file, and its name will be created by concatenating the base name of the project file with ".demuxed.avc". For example, if the project file is named "movie.dga", the elementary stream file will be named "movie.demuxed.avc".
Save BMP | Table of Contents |
Use this option to save the current frame on display in the DGAVCIndex 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.
The video playback speed is controlled by the playback speed control options available via the Options/Playback Speed menu.
Play and Preview automatically pop up the Information Panel.
Exit | Table of Contents |
Use this option to close the source file and terminate DGAVCIndex.
Stream Menu | Table of Contents |
Detect PIDs: PAT/PMT | Table of Contents |
DGAVCIndex 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 PID for the desired video stream, you thereby select the desired program to decode. Note that only the video and PCR PIDs can be set in this menu. Use the "Audio/Audio Demux" option to set audio PIDs.
Use the "Detect PIDs: PAT/PMT" option to list the programs and their associated streams, and to select the desired video stream to be decoded. DGAVCIndex will parse the 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 PCR stream, highlight it by selecting it with a mouse click. Then click on the "Set PCR" 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 DGAVCIndex window.
Note that unless you use the Log Timestamps function, the PCR PID is not used and can be ignored.The PIDs are stored in the DGAVCIndex.ini file and so will be retained across DGAVCIndex sessions.
Note that selecting an audio stream as video will produce undefined operation and may crash DGAVCIndex. For that reason, the video PID comes up by default as 0x02, which is a reserved value. However, because the DGAVCIndex.ini file retains PIDs from a previous session, you may run into this. If you get strange behavior or crashing, then manually set the video PID to 0x02 using the "Set PIDs" option before loading your input file, and then detect and set your video PID normally.
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 the video and PCR PIDs using hexadecimal notation, or to query the selected PIDs. If you use this dialog to specify your PIDs, DGAVCIndex will not detect PIDs and will simply use the specified PIDs to select the video and PCR streams. Note that only the video and PCR PIDs can be set in this menu. Use the "Audio/Audio Demux" option to set audio PIDs.
Note that selecting an audio stream as video will produce undefined operation and may crash DGAVCIndex. For that reason, the video PID comes up by default as 0x02, which is a reserved value. However, because the DGAVCIndex.ini file retains PIDs from a previous session, you may run into this. If you get strange behavior or crashing, then manually set the video PID to 0x02 using the "Set PIDs" option before loading your input file, and then detect and set your video PID normally.
Video Menu | Table of Contents |
Field Operation | Table of Contents |
AVC video provides a syntax element (picture timing SEIs) 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 AVC 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 flags are to be handled. Note that this setting affects only the video served via DGAVCDecode. In DGAVCIndex, the video is always shown in the Ignore Pulldown Flags mode.
The Field Operation is perhaps the most important option to understand when using DGAVCIndex. Most users should first preview the project and inspect the Information Panel. If the clip is 29.976fps, and the Field Repeats box in the Information Panel indicates field repeats consistent with 3:2 pulldown, then 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 DGA file.
Otherwise, then you should leave this option set to Honor Pulldown Flags for generation of the DGA 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.
Almost invariably, if you know the source is not all 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 AVC stream. Currently this is just Force Film but without the frame rate modification. In a future version, Force Film will operate on hybrid material and will decimate frames as required in video sections to maintain the film rate. At that time the distinction between Force Film and Ignore Pulldown Flags will be more meaningful.
YUV->RGB | Table of Contents |
For display in the DGAVCIndex window, the video is always converted to RGB. This option specifies how the colorspace conversion to RGB is to be performed.
This option affects only conversion to RGB for display in DGAVCIndex. It does not affect the the video sent to DGAVCDecode. For the served video, you can convert to RGB in your Avisynth script if needed.
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. DGAVCIndex stores the luminance adjustment settings in the DGA file and DGAVCDecode reads them and applies the same luminance adjustment to the served video, so that what you see in the DGAVCIndex 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.
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. DGAVCIndex stores the cropping settings in the DGA file and DGAVCDecode reads them and applies the same cropping to the served video, so that what you see in the DGAVCIndex window is what you get in the served video.
Copy Frame to Clipboard | Table of Contents |
Use this option to copy the frame on display to the clipboard. It may then be pasted into suitable graphics applications.
Audio Menu | Table of Contents |
Audio Demux | Table of Contents |
DGAVCIndex can open transport streams. Transport streams can contain multiple programs, each of which contains audio and video streams. The Audio Demux menu allows the user to select audio streams to be demultiplexed when a Save Project operation is performed. The following audio types are currently supported: MPEG audio, AAC ADTS audio, AAC LATM/LOAS, AC3 audio, DTS audio, and LPCM audio. Additional formats will be added as test streams are received.
The "Available audio streams" listbox lists the audio streams that were detected. To select an audio stream for demultiplexing, highlight it by selecting it with a mouse click. Then click on the "Set" button. The stream's PID will be added to the list in the "Audio streams to demux" listbox. To remove a stream from the list, highlight it and then click on the "Clear" button. Use the "Set All" and "Clear All" buttons to add or remove all the available audio streams, respectively. When you have selected your audio PIDs, click on the "Done" button to close the menu. Now subsequently, when you perform a Save Project operation, the selected audio streams will be demultiplexed. Also, if you do a Preview or Play operation, the detected audio streams will be listed on the Info dialog.
Demuxed audio files will be named after the project name and additional parameters of the audio format. For example: "bbc.hd PID 90f 2_0ch 384Kbps.ac3".
When LPCM is demuxed from a transport stream, usually an M2TS (Blu-Ray) stream, the raw PCM is stored in the output file. You can convert this to a standard wave file using the popular SOX audio processor tool, which you can get here:
http://sourceforge.net/projects/sox/A typical command line would be as follows (although you need to check your audio parameters in the Info dialog to choose the correct SOX options):
sox -B -r48000 -t .raw -c 6 -2 -s "Blu-ray PCM PID 1101 DELAY 0ms.pcm" "out.wav"A future version of DGAVCIndex may integrate WAV packaging functionality to eliminate the need for SOX.
It is possible that audio streams are declared in the PAT/PMT tables but are not actually present in the source file, in which case demultiplexing them will fail to produce demultiplexed files. You can test for the actual presence of declared streams by doing a Preview operation. If the streams are actually present they will be listed on the Info dialog.
The audio demultiplexing settings are not stored in the DGAVCIndex.ini file.
Options Menu | Table of Contents |
Loop Playback | Table of Contents |
When this option is selected and playback during a Preview or Play operation reaches the end of the timeline, playback will automatically start again at the beginning of the timeline.
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. 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.
Process Priority | Table of Contents |
Specify what CPU usage priority Windows will assign to DGAVCIndex.
Use this option if you are running multiple applications at once, and want to prioritize (or de-prioritize) DGAVCIndex for CPU usage.
AVS Template | Table of Contents |
DGAVCIndex can automatically generate an Avisynth script for serving your project. It requires you to specify a template file, such as the following one:
loadplugin("...\DGAVCDecode.dll")
loadplugin("...\Decomb.dll")
avcsource("__vid__")
fielddeinterlace()
This is any normal AVS script, except that the DGA file name is replaced with __vid__ (that's two underscores before "vid" and two after). When DGAVCIndex creates the AVS script, it replaces __vid__ with the correct DGA 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, DGAVCIndex 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 first audio file that is opened. Therefore, to be sure to get the desired audio file, process just one audio stream.
You may also use the __del__ specifier to generate the delay value for use in DelayAudio(__del__).
DGAVCIndex creates the AVS script file only if it does not already exist. The script file is created in the same directory as the DGA 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 DGAVCIndex to automatically create AVS scripts.This option setting is stored in the INI file and so is retained across DGAVCIndex invocations. When an INI file is not present, the AVS Template path defaults to a file named "template.avs" and located in the same directory as that of the executed DGAVCIndex.exe.
Use Full Paths | Table of Contents |
DGA files and AVS files created via an AVS template contain references to files. This option controls whether they should be stored as relative paths or full paths. When this option is disabled, the DGA file and generated AVS scripts will suppress the full path information and provide just the relative paths; everything is relative to the location of the DGA file.
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 DGAVCIndex invocations.
Enable Info Log | Table of Contents |
When the Enable Info Log option is checked and the Information Panel is closed, either manually or automatically by DGAVCIndex, a log file is created that contains the information displayed in the Information Panel at the time of closure. The file name used is that of the input file with the extension changed to "log". The log file is created in the same directory as the input file. If this directory is not writable, then the log file is not created.
This option setting is stored in the INI file and so is retained across DGAVCIndex invocations.
Treat I as IDR | Table of Contents |
Some streams (such as those generated by Hauppage's HD PVR with default configuration) do not contain IDR frames, but instead contain seekable I frames. Normally, seekable I frames are signalled by recovery point SEI messages, but this is not required by the AVC standard. For streams with no IDRs but having seekable I frames not signalled by SEIs, you can enable the Treat I as IDR option to allow the streams to be properly handled by DGAVCDec.
This option should not be enabled unless you know that the stream requires it for proper handling. It is known to be required currently for the Hauppage streams (unless a Graphedit hack is done to enable IDR generation).
This option setting is stored in the INI file and so is retained across DGAVCIndex invocations.
Help Menu | Table of Contents |
SIMD | Table of Contents |
This is a read-only indicator displaying information about which SIMD optimizations were detected as available for this CPU.
DGAVCDec Quick Start Guide, DGAVCIndex User Manual, and DGAVCDecode User Manual | Table of Contents |
These options open the respective documents in your browser. To work, the files "AVCQuickStart.html", "DGAVCIndexManual.html", "DGAVCDecodeManual.html" that are included in the DGAVCDec package must be in the same directory as the "DGAVCIndex.exe" file. Do not rename these files.
Display Window | Table of Contents |
Navigation | Table of Contents |
Preview the video file and select the start/end points for the project.
Use the navigation slider, and these two buttons for navigation:
< - Seek to previous GOP (IDR frame or recovery point frame).Currently, the display window displays only the first frame of a GOP in navigation mode (because they are possible selection points for cutting the video). 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 mouse scrollwheel is supported. When you are not in play/preview mode, the scrollwheel will act as do the right and left arrow keys (< and >), i.e., it will effect GOP stepping. When you are in play/preview mode with single stepping enabled, the scrollwheel will act as does the right arrow key (>), i.e., it will effect frame stepping.
The video may in some cases appear stretched/squashed in the display window because DGAVCIndex displays the video as is it stored in the AVC 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 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 input file is loaded DGAVCIndex can display a splash screen. To enable this feature, place an appropriately sized windows BMP file called "dgavcindex.bmp" in the same directory as DGAVCIndex.exe. Several sample BMPs are available from the DGAVCDec home page.
Information Panel | Table of Contents |
The Information Panel displays important statistics about the loaded video stream. Information displayed in this panel is often essential for correctly processing DGAVCIndex 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.
When the Enable Info Log option is checked and the Information Panel is closed, either manually or automatically by DGAVCIndex, a log file is created that contains the information displayed in the Information Panel at the time of closure. The file name used is that of the input file with the extension changed to "log". The log file is created in the same directory as the input file. If this directory is not writable, then the log file is not created.
Video Section | Table of Contents |
Audio Section | Table of Contents |
Status Section | Table of Contents |
APPENDIX A: DGA File Structure | Table of Contents |
This Appendix documents the syntax and semantics of the DGA 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 DGA files: 1) the header section, 2) the settings section, and 3) the data section. These sections are described below.
DGA Format - Header Section | Table of Contents |
Following is a typical header section:
DGAVCIndexFile7
Y:\don.264
Y:\DGAVCDec\DGAVCIndex\Release\
The first line always begins with the string "DGAVCIndexFile" immediately followed by a DGA version number. This number is checked by DGAVCDecode and must match the version expected. This mechanism thus enforces the requirement that DGAVCIndex and DGAVCDecode must be used in matched pairs. If DGAVCDecode rejects your DGA file as "obsolete", be sure that you are using the correct version of DGAVCDecode. Sometimes one forgets that one has an older version in the Avisynth plugins folder, or one forgets to upgrade DGAVCDecode when upgrading DGAVCIndex.
The second line is blank and the third line specifies the input video file. The fourth line specifies the path to the libavcodec.dll that DGAVCDecode will use to decode the AVC video. The header section must then terminate with a blank line.
The source file reference consists of either a relative path and 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 file is moved after creation of the DGA file, you must either edit the path to be correct, or you must regenerate your DGA file.
DGA Format - Settings Section | Table of Contents |
The settings section consists of one-line specifiers. The following specifiers are defined:
STREAM 1
The number on this line is interpreted as follows: 0 = elementary stream, 1 = transport stream.
PKTSIZ 188
This specifier appears only if the input file is a transport stream. The number on this line specifies the transport packet size in bytes.
VPID 68
This specifier appears only if the input file is a transport stream. The number on this line specifies the video PID that was selected in DGAVCIndex.
FO 2
The number on this line is interpreted as follows: 0 = Honor Pulldown Flags, 1 = Force Film, and 2 = Ignore Pulldown Flags.
YUVRGB 1
The number on this line is interpreted as follows: 0 = TV scale, 1 = PC scale.
LUMFILT 0 0
The first number on this line is the luminance filter gamma. The second number is the luminance filter offset.
CLIP 0 0 0 0
The first number on this line is the cropping left value. The second number is the cropping right value. The third number is the cropping top value. The fourth number is the cropping bottom value.
RANGE 0 0
The first number on this line is the offset in the source file corresponding to the left selection range value. The second number is the offset in the source file corresponding to the right selection range value.
AUDIO 80,c0
The string on this line is the comma-separated list of audio id's to demux.
DGA Format - Data Section | Table of Contents |
The data section consists of one-line specifiers identified with an upper-case keyword. For example:
LPOC 0
SPS 6
PPS 65 0
IDR 104
FRM 7 0
PIC 3
FRM 5 -2
PIC 5
FRM 5 -1
PIC 5
FRM 5 3
PIC 6
FRM 6 1
PIC 3
FRM 6 2
PIC 3
FRM 5 6
PIC 4
FRM 6 4
PIC 6
FRM 6 5
PIC 6
FRM 5 9
PIC 5
FRM 6 7
PIC 4
FRM 6 8
SIZ 1920 x 1080
FPS 60000 / 2002
The data section of a DGA file contains the indexing of the AVC video stream. The syntax for each keyword line is as follows:
Command-Line Interface | Table of Contents |
Parameters | Table of Contents |
DGAVCIndex 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 DGAVCIndex defaults and the DGAVCIndex INI file.
Parameter | Command-Line Flag | Definition/Comments |
---|---|---|
Input File | -i filename | Specify input file. If the specified file cannot be found, it is ignored. The filename should be double quoted if it contains spaces. |
Video PID | -v videoPID | Transport stream video PID, hex notation. (e.g., -v 11) |
PCR PID | -p pcrPID | Transport stream PCR PID, hex notation. (e.g., -p 11) |
Field Operation | -f operation | 0=Honor Pulldown Flags, 1=Force Film, 2=Ignore Pulldown Flags |
YUV->RGB | -y method | 1=PC Scale, 2=TV Scale |
Output File | -o filename | Name of output index file, including the .dga extension. The filename should be double quoted if it contains spaces. |
Output File with Video Demux | -od filename | Name of output index file, including the .dga extension. The filename should be double quoted if it contains spaces. Same as -o but the video elementary stream is demuxed. |
Demux Audio | -a | Demux all detected audio streams. |
Exit | -e | Exits DGAVCIndex when project has been saved. |
Hide | -h | Starts and runs DGAVCIndex in the hidden state and exits when the project has been saved (forces -e option). |
Example | Table of Contents |
This example:
DGAVCIndex -i d:\files\movie.avc -o d:\MyProject.dga -f 2 -e
will save a project file, specifying:
Input File = d:\files\movie.avc
Output File = d:\MyProject.dga
Field Operation = Ignore Pulldown Flags
Exit on end
This example does the same but uses a file name with embedded spaces:
DGAVCIndex -i "d:\files\my wedding day.avc" -o "d:\my wedding day.dga" -f 2 -e
Note that quoting is supported only for the -i and -o options.
APPENDIX C: Auxiliary INI File Options | Table of Contents |
Some aspects of DGAVCIndex's behavior can be modified via the INI file but not through the GUI, as described below. DGAVCIndex creates defaults for these settings, but you can modify these lines in the INI file as you wish.
AVC_Extension=string: The extension used on demultiplexed AVC video files will be string. For example: AVC_Extension=264 will create a file such as "myfile.264".
Credits | Table of Contents |