View Full Version : Batch use of DGIndex/DGMPGDec?
SenorKaffee
15th January 2008, 22:49
I just captured 349 M2T-files from several HDV tapes and want to convert them to an intermediary AVI (with an intraframe codec).
For a single M2T file I normally write a project file with DGIndex, load it in an AVISynth and convert it with VirtualDub. Well - is there a way to avoid doing that 349 times?
Can I somehow make DGIndex write D2V files for every file in a directory tree? Looks like there a batch tools that can help me for with the creation of all those AVS files, but without the project files as sources this wonīt work. *scratches head*
Any ideas?
mitsubishi
15th January 2008, 23:26
There are many ways to do this, probably the easiest would be just to bring up a command line at the folder containing the file and enter:
for %f in (*.m2t) do start "DGINDEX" /wait "C:\Program Files\AviSynth 2.5\plugins\DGIndex.exe" -IF=[%f] -OF=[%~nf] -EXIT
For a look at the other ways and options, see the manual: http://neuron2.net/dgmpgdec/DGIndexManual.html#AppendixB
SenorKaffee
15th January 2008, 23:56
Thank you, thatīs a good start. I hope finding a good batch AVS writer will be as easy. ^^
mitsubishi
16th January 2008, 00:00
BTW add a /R to the for statement to make it go into sub-directories (for /R %f) (oops, and of course change [%~nf] to [%~pf%~nf] )
Thank you, thatīs a good start. I hope finding a good batch AVS writer will be as easy. ^^
Did you look at the DGindex docs? You can pass an avs template to it.
pc_speak
16th January 2008, 03:25
I have used this for a number of MPG files but it should be easy to adapt
as you are already familiar with AVISynth and DGIndex.
/F "delims==" in the batch file below allows for spaces in the filenames.
Generic MPG_TEMPLATE.AVS
LoadPlugin("C:\VidAud\DGIndex\DGDecode.dll")
LoadPlugin("C:\VidAud\DGIndex\AC3source.dll")
MPEG2source("..\__vid__")
AC3source("..\__aud__")
#TFM()
#tdecimate()
#DelayAudio
Generic CONVERT.CMD
FOR /F "delims==" %%W in ('dir *.mpg /b') do "c:\vidaud\dgindex\dgindex.exe" -IF=[%%~nW.mpg] -AT=[MPG_TEMPLATE.AVS] -OM=2 -IA=3 -OF[%%~nW] -EXIT
md AVS
move *.avs AVS
del avs\mpg_template.avs
You end up with all the AVS scripts in their own folder.
Run VirtualDubMOD and process the first AVS script. Filters, compression etc.
When you are ready:
Save as... (tick 'Don't run this job now ...') - Save
Open up Job Control (F4)
Got to 'Edit/Process directory' and locate the AVS folder.
Select a Target directory, usually the same AVS folder.
A job will be created for ALL AVS scripts. (including the first 1 again. Delete it)
Press Start. Sit back. Relax. :D
SenorKaffee
16th January 2008, 07:27
@pc_speak
Thank you! I have to use MPASource instead of AC3Source, my HV20 uses MPEG audio.
So I figure my AVS template would look like this:
LoadPlugin("D:\Programme\AviSynth 2.5\plugins\mpasource.dll")
LoadPlugin("D:\Programme\DGDecode\DGDecode.dll")
video = MPEG2Source("..\__vid__")
audio = MPASource("..\__aud__")
AudioDub(video,audio)
Spline36Resize(1920,1080)
Iīll try that after I come back from the office. If that worksīs itīs a huge timesaver - Iīd send you all a box of chocolates, but I can never fit it in a PM attachment. ^^
pc_speak
16th January 2008, 08:40
If it works first go, and I will most surprised, send a digital photo of the chocolates. I'm on a diet. :D
SenorKaffee
16th January 2008, 21:54
First part seems to work very well.
FOR /F "delims==" %%W in ('dir *.m2t /b') do "D:\Programme\DGDecode\dgindex.exe" -IF=[%%~nW.m2t] -AT=[MPG_TEMPLATE.AVS] -OM=2 -IA=5 -OF[%%~nW] -HIDE -EXIT
LoadPlugin("D:\Programme\AviSynth 2.5\plugins\mpasource.dll")
LoadPlugin("D:\Programme\DGDecode\DGDecode.dll")
video = MPEG2Source("__vid__")
audio = MPASource("__aud__")
AudioDub(video,audio)
Spline36Resize(1920,1080)
Now wait a little if the VirtualDub part works out, too. :D
pc_speak
17th January 2008, 03:49
This may be of interest. It's from Neuron2's DGDecodeManual.html. The last sentence.
Which iDCT you should use depends primarily on what CPU you have and to a lesser degree, on how accurate an iDCT you desire. Most people will not be able to tell the difference in quality between these algorithms but they can be easily observed by combining the AviSynth filters Subtract() and Levels(). All of the available options are IEEE-1180 compliant, except for SSE/MMX (Skal).
Qualitywise: IEEE-1180 Reference > 64-bit Floating Point > Simple MMX (XviD) > Remaining iDCTs.
Speedwise: SSE2/MMX and SSE/MMX (Skal) are usually the fastest. The IEEE-1180 Reference is easily the slowest.
Of course if you already knew that then I'll steal away, quietly, into the dark.
SenorKaffee
17th January 2008, 08:49
I read something about the iDCT in the VirtualDub documentary, but I already thought that the IEEE-1180 reference is the slowest. I use it nonetheless, all other options are so slow (especially Spline36Resize) that it wonīt matter so much ;)
Maybe Iīll switch to 3 in the next batch and use another Resize method.
Because of the strange behaviour of Morgan MJPEG2000 in 4:2:0 I had to add FlipVertical. To preserve the "super-whites" the cam records (http://hv20.com/showthread.php?t=2251) I wanted to add ConvertToRGB(video, matrix="PC.709") (would have used 4:4:4 then), but it didnīt work out. I tried different variantions to the script, either the output was still YUY2, the audio was lost, or the image was not resized. Some of the command always cancelled each other out. o_O
SenorKaffee
3rd March 2009, 23:05
Old thread is old...
Somehow the very same batch files don't seem to work anymore.
I still use more or less the same batch file.
MD AVS
FOR /F "delims==" %%W in ('dir *.m2t /b') do "C:\Program Files (x86)\dgindex\DGIndex.exe" -IF=[%%~nW.m2t] -AT=[TEMPLATE.AVS] -OM=2 -IA=5 -OF[%%~nW] -HIDE -EXIT
COPY *.AVS AVS
DEL *.AVS
If I start this file, I get the error message "No output file in HIDE mode! Exiting." This doesn't really make sense. The -OF statement is there and also filled.
Here is one line from the output of the batch file.
C:\Program File
s (x86)\dgindex\DGIndex.exe" -IF=[02-2008_04_11-09_35_59.m2t] -AT=[TEMPLATE.AVS]
-OM=2 -IA=5 -OF[02-2008_04_11-09_35_59] -HIDE -EXIT
The -OF statement is there. What does DGINDEX want from me? Any idea?
SenorKaffee
3rd March 2009, 23:25
This command line still works, strange.
for %f in (*.m2t) do start "DGINDEX" /wait "C:\Program Files (x86)\dgindex\DGIndex.exe" -IF=[%f] -OF=[%~pf%~nf] -AT=[TEMPLATE.AVS] -OM=2 -IA=5 -EXIT
RunningSkittle
4th March 2009, 00:44
so it works without the -hide ?
The first command has bad notation too, why are you trying to use delims and dir?
The second command shouldnt need 'start' or '/wait' either.
squid_80
4th March 2009, 20:28
The non-working command lines you posted are missing the = directly after -OF.
SenorKaffee
6th April 2009, 20:38
Thanks for correcting the syntax. :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.