View Full Version : An idea for handling audio in DGIndex, DGAVCIndex, etc.
vampiredom
17th July 2009, 21:59
I have what's hopefully a novel and simple request for modifying neuron2's excellent indexing tools:
I have read some mutterings about the possibility of including audio in future releases. Here's my idea that could make it very easy:
First, you could add something like this to the .d2v and .dga files when they are created, to include the demuxed track names and properties:
ATrack1_file=myvideo PID 814 L2 2ch 48 384 DELAY 17ms.mp2
ATrack1_delay=.0017
Then, there could be a function to grab this info within AviSynth, like…
myProject = "foo.d2v"
MPEG2Source(myProject)
file = MPEG2SourceAudioInfo(myProject, track=1, "file")
delay = MPEG2SourceAudioInfo(myProject, track=1, "delay")
AudioDub(BassAudioSource(file))
DelayAudio(delay)
Any ideas, folks? (especially neuron2). Thanks!
neuron2
17th July 2009, 22:11
Have you read the audio section in the QuickStart Guide?
vampiredom
17th July 2009, 22:23
Have you read the audio section in the QuickStart Guide?
Yes, certainly I have. However, this allows only 2 possibilities:
1.) You must either know the name of the resulting audio file(s) ahead of time, or
2.) use the templating in DGIndex / DGAVCIndex
I have been using call_25.dll to automatically index MPEG2 files when the index does not exist. It seems to works extremely well, and obviates the need to open DGIndex and fiddle with menus, etc.
If I could access the names of the files that DGIndex produces post-facto, I can have it done all automatically in a single pass… just by opening the .avs script in VirtualDub or whatever.
neuron2
17th July 2009, 22:31
What is call_25.dll?
vampiredom
17th July 2009, 22:34
Call_25.dll is oldie … it allows an external program (such as DGIndex.exe) to be called from AviSynth.
This is a snippet of (something like) the code that I use (Note that it needs SetMTMode=1 to run correctly in MT, so there is MT "protection" in the script)
filebase = "iframe_test"
ext = ".m2v"
DGIndexPath = "c:/DGIndex/DGIndex.exe"
# check for MT
LastMTMode = -1
Try {
LastMTMode = GetMTMode()
} Catch(err_msg) {
LastMTMode = -1
}
filename = filebase + ext
IndexFile = GetWorkingDir() + filebase + ".d2v"
doIndex = (!Exist(IndexFile)) ? true : false
delim = (Findstr(filebase, """"""") == 0) ? """""""
\ : (Findstr(filebase, "'") == 0) ? "'"
\ : (Findstr(filebase, "!") == 0) ? "!"
\ : (Findstr(filebase, "#") == 0) ? "#"
\ : (Findstr(filebase, "@") == 0) ? "@"
\ : ";"
cmd = " -FO=0 -IA=3 -OM=0 -YR=1 -SD=" + delim + " -IF=" + delim + (GetWorkingDir() + filename) + delim + " -AT=" + (delim + delim) + " -OF=" + (delim + filebase + delim) + " -exit"
cmd = DGIndexPath + cmd
d2vFile = filebase + ".d2v"
# SetMTMode(1) is required for CALL_25.dll when running AviSynth MT
Try { status = (LastMTMode > 0) ? SetMTMode(1) : NOP() } Catch(err) { last }
status = (doIndex) ? Eval(""" Call(BlankClip, cmd, "-2") """) : NOP()
MPEG2Source(d2vFile)
# reset SetMTMode to whatever it was before
Try { status = (LastMTMode > 0) ? SetMTMode(LastMTMode) : NOP() } Catch(err) { last }
vampiredom
18th July 2009, 21:22
I guess you're not really seeing the usefulness of my suggestion.
The problem with using the template option in DGIndex is that the script must be created at the same time as the file is indexed (neither before nor afterward). I think it would be really cool to be able to index on-the-fly (ala FFMpegSource) but with the stability of MPEG2Source. Actually, I can already do this (using a script like the one I posted above) … it's just that I can't get the audio in this manner.
Anyway, thanks for considering this and keep up the great work!
neuron2
20th July 2009, 04:12
Can't your program just look for audio files that contain the desired project name in the filename?
vampiredom
20th July 2009, 05:16
Funny you should say that :)
A while back, I made a command-line app that did that… I works pretty well, actually: parsing the filenames as possible to extract kHz, delay, # channels, etc. The problem was that the app was designed to do a bunch of other things and could not simply be plugged-in using that Call() command.
So, I just wrote another little one that generates a "companion" AviSynth script that loads the audio. This is autoloaded using Import() … Good deal. I need to test out a bit (and find a way of testing DG - NV compatibility without a CUDA card %@&#!) and I'll post a link to it here for more folks to try out, too.
But I was thinking that perhaps it would be cool to provide a way of doing this as part of the DG-/DGAVC/NV packages themselves. A more "solid" approach, I guess.
neuron2
20th July 2009, 05:30
it would be cool My time is so limited these days that you really need to justify your requests much more strongly if you want me to implement them.
vampiredom
20th July 2009, 06:55
Sorry for being too informal and perhaps not stating my case better. I suppose I could have used "would be advantageous" or "would provide added value" or something, but I figured it seemed a "logical" way to add better audio functionality to these apps; and it would seem to require a lot less of your time than, say, fully-integrated audio sourcing.
So, in short, my "discovery" of the Call() plugin is what prompted me to make my request. It makes auto-indexing extremely convenient. However, I felt that other users would also benefit by being able to store and extract audio information from the project file itself.
Thanks again for your time.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.