Log in

View Full Version : How "Intereave Audio such as VirtualDubMod" in AviSynth


VoidShell
26th July 2007, 15:05
Hi, everyone.
This is a my first question in doom9.

Normally I am used to writting AVS Script and encoding with VirtualDubMod.

But I have a working that flv encoding with On2 Flix Pro.

As you know, On2 Flix Pro has not funtion that add audio file. So I can't add a AC3 audio file which has a delay to use On2 Flix Pro.

I try to dub AC3 audio file on video(d2v) in AVS Script.
I suffer to sync problem that come to IVTC and delayed AC3 audio file. Finally I successed perfect sync dubbing. (I confirm this sync at Vegas.)

Here is my AVS Script.

D2VPath="F:\Encoding\Source\VTS_02_2.d2v"
Video=MPEG2Source(D2VPath).ColorMatrix(mode="Rec.709->Rec.601", d2v=D2VPath, interlaced=true).TFM(d2v=D2VPath, order=-1, mode=1).TDecimate(mode=0, cycle=5)

AC3Path="F:\Encoding\Source\VTS_02_2 T01 2_0ch 448Kbps DELAY -168ms.ac3"
Audio=NicAC3Source(AC3Path)
Interleave(Audio)
DelayAudio(Audio, -0.168)
AudioDub(Video, Audio)


But there is a not soved problem yet. In VirtualDubMod Interleaving, there is a function "Audio block placement".

http://img411.imageshack.us/img411/8317/interleaveoptionsdb8.jpg

I search for this in AVS Script funtion or plugin, but I can't find it. Tell me about this solution please.

In additional, What effect "Interleave(clip 1,clip 2)" in AVS Script? I try writting "Interleave(Video, Audio)" but it show error message in AvsP.
So I try writting "Interleave(Audio)", and it is succeed. but I don't know diffrent that write this and nothing. What is its effect?

Thanks to read my question.

PS: I'm not living in english country. Sorry :)

mgh
26th July 2007, 15:48
Replace your last four lines with
Audio=NicAC3Source(AC3Path)
AudioDub(Video, Audio).DelayAudio(-0.168)
do not worry about the other virtualdub settings-those are for encoding to avi not for flv.

VoidShell
26th July 2007, 15:56
Thanks for replay.
I hope to know why replace that line :)

mgh
27th July 2007, 17:16
Interleave in virtualdub and interleave in avisynth are not the same. Look up the corefilters.html in avisynth documentation. Interleave in avisynth is not meant for audio.
Your script has the lines
Video=MPEG2Source(D2VPath).ColorMatrix(mode="Rec.709->Rec.601", d2v=D2VPath, interlaced=true).TFM(d2v=D2VPath, order=-1, mode=1).TDecimate(mode=0, cycle=5)
Audio=NicAC3Source(AC3Path)
The = sets value for the variables Video and Audio which are not changed by another '=' statement. So the Audiodub line acts on VIdeo and Audio as defined. Therefore, your lines

Interleave(Audio)
DelayAudio(Audio, -0.168)
have no effect on the avisynth output:)

BTW, you seem to have discovered an undocumented "feature" of Avisynth.
See
http://forum.doom9.org/showthread.php?t=128334
:D

Ebobtron
27th July 2007, 18:45
@ mgh

If sh0dan or IanB do not know about it then maybe you could call it undocumented.

My not knowing about stuff is implied.
:)

mgh
27th July 2007, 19:16
I would rather call something known only to sh0dan or IanB, as undocumented:)

IanB
28th July 2007, 04:59
Undocumented??? :confused:

Interleave (http://avisynth.org/mediawiki/Interleave)

.... clip. The audio is taken from the first clip.

At no point did you try to use the absent video, so why would you expect it to barf. The audio if you had tried to use would have been passed thru correctly.

foxyshadis
28th July 2007, 07:18
It's just one of those cases where avisynth is a lot smarter than people give it credit for. We're used to working with all kinds of dumb software, or at least myopically straightforward stuff that complains whenever you walk outside its box. It's quite a surprise when something is clever enough to do what you want even when you aren't sure what to ask. =p