Log in

View Full Version : Audio Editing


Cunhambebe
5th September 2006, 23:49
I've got a question concerning audio editing - I couldn't find an answer searching around here, neither at AviSynth's homepage.
This is my script for an MPEG2 source (please note that the audio is not multiplexed with it):

LoadPlugin("C:\unzipped\dgmpgdec148\DGDecode.dll")
LoadPlugin("C:\avs_filters\ColorMatrix\Release\colormatrix.dll")
LoadPlugin("c:\avs_filters\TomsMoComp\TomsMoComp_Avisynth\Debug\TomsMoComp.dll")
MPEG2Source("c:\clip.d2v", info=3)
ColorMatrix(hints=true)
Trim(0,403)+Trim(2395,15174)+Trim(16857,17305)
TomsMoComp(0,5,1)
Crop(6,0,-6,0)
Lanczos4Resize(640,480)
FadeOut(30)

As you can see, I'm editing the video, using Trim. I know that if it were an AVI source, even an MPEG2 multiplexed with the audio file, the audio would also be trimmed so it would stay synchronized.
The question is:
How can I edit the audio? Maybe if I adding WavSource("C:\....") to the script? I've already tried this but it didn't work. I thought I could load the script in VDMod and while compressing the video as Xvid, I would add the audio, interleaving it on the second pass.. Another way would be to load the audio file in any audio editor, editing the same sections. Does any of you know the correct way to achieve what I want? Thanks in advance.

foxyshadis
6th September 2006, 03:09
Mpeg2Source(...).AudioDub(WavSource(...))

This will pass the audio through the trims and remain 100% in sync. The basic sync and delay should be taken care of beforehand, otherwise you have to trim/pad the audio separately, which is "fun".

Cunhambebe
6th September 2006, 03:25
First of all, thanks so much for taking your time to respond :)
Thanks for the script.
...otherwise you have to trim/pad the audio separately, which is "fun".
-I suppose I can do that with any audio application such as audacity :D , resamplig the file - right??
Just one question: I assume I have to interleave the audio on the second pass in VDMod as I have stated above. Is there any other way to do this? I mean, I was thinking about frameserving the audio first in VDMod, saving as .wav and then muxing the file with the video (of course converting the audio to mp3). What about this?
Thanks in advance.

foxyshadis
6th September 2006, 04:48
You can load the script, save the wav, encode it, and mux it back in after (either on the second pass or after encoding). You can also encode it directly from vdub with ye olde ACM libraries (lame comes to mind), but you're much better off encoding audio outside vdub.

Cunhambebe
6th September 2006, 13:24
Thank you very much. AviSynth is really great. I didn't know what I was missing :)
Cheers,
Mark