PDA

View Full Version : Trimming results in audio lag


stattik
21st July 2008, 23:48
The first section syncs fine.
The rest of the sections range from laggy to perfect sync. The result of the below script is synced during three sections with audio lag in the rest.

Here is my script.

#SourceVideo
LoadPlugin("DGDecode.dll")
video=MPEG2Source("D:\show.d2v")

#Decimate
Loadplugin("IVTC.dll")
video=ChangeFPS(video,30000,1001).TDecimate()

#Resize
video=Spline36Resize(video,608,336).Sharpen(0.2)

#AudioSource
LoadPlugin("BassAudio.dll")
audio=bassaudioSource("D:\audio PID 034 3_2ch 384Kbps DELAY -290ms.AC3 ")
audio=ResampleAudio(audio,48000)

#DownMixToStereo
Import("DownMix2Stereo.avs")
audio=DownMix2Stereo(audio)

#Delay
audio=DelayAudio(audio,-0.290 )

#Tempo
video=AssumeFPS(video,24000,1001)

#Normalize
audio=Normalize(audio,1)

#AudioDub
audio=ConvertAudioTo16bit(audio)
AudioDub(video,audio)

#Trimming
Trim(0,7968)++Trim(13046,22020)++Trim(26377,37463)++Trim(41918,52493)++Trim(57945,65797)++Trim(70545,81442)++Trim(83064,0)

I get the same results from both 1080i and 720p recordings.
I've tried using "+" as well as "++" and the lag is the same.
If I run the script without trimming, the entire show is in sync.

Any help would be greatly appreciated.

IanB
22nd July 2008, 05:35
bassaudioSource() is not position sample exact when seeking.

Try adding EnsureVBRMP3Sync() to the start of your audio path.

Or you can pre-process the audio in 1 continuous operation to a format that can be accessed in a sample exact manner i.e. a wave file. Then source and audiodub that.

stattik
22nd July 2008, 15:36
That did the trick. Thanks Ian. That was a big help.