I had to use this for the first time recently. It maintains audio sync with the video.
My situation was I had a divx avi in 3 parts, plus a deleted scene.
My aim was to include the deleted scene into the video and trim off some excess from the end and in between. So my avs script looked like this.
Code:
plugindir = "D:\Avisynth\"
LoadPlugin(plugindir + "mpeg2dec.dll")
LoadPlugin(plugindir + "GripFit_preview.dll")
LoadPlugin(plugindir + "blockbuster.dll")
LoadPlugin(plugindir + "legalclip.dll")
LoadPlugin(plugindir + "sampler.dll")
LoadPlugin(plugindir + "dustv5.dll")
LoadPlugin(plugindir + "temporalcleaner.dll")
disc1=AviSource("D:\DivX\LDisc1.avi")
disc2=AviSource("D:\DivX\LDisc2.avi")
disc3=AviSource("D:\DivX\LDisc3.avi")
delscenes=AviSource("D:\DivX\LDelscenes.avi")
part1=disc1.trim(0,147972)
part2=disc2.trim(1000,41460)
part3=delscenes.trim(0,26577)
part4=disc2.trim(41461,121691)
part5=disc3.trim(0,49103)
movie = fizconvert(part1+part2+part3+part4+part5).sampler(length=24)
return movie
function FizConvert(clip l)
{
return l.ConvertToYUY2().
\LegalClip().
\GripCrop(528, 576, overscan=2).
\GripSize().
\SpaceDust().
\TemporalCleaner().
\LegalClip()
}
The video was formed perfectly and I then loaded the AVS into vdub and did a save WAV. The problem I had was that whereever I had trimmed the video and the start frame was not 0, the audio had not trimmed at the right place. I was forever confused as to why some parts of the movie were completely out of sync.
I then used EnsureVBRMP3Sync in the line before each trim
e.g.
part2=disc2.EnsureVBRMP3Sync.trim(1000,41460)
and did an audio extract from vdub. Hey presto, it was perfectly in sync!
Hope this helps.