View Full Version : Audio sync on trimmed VBR-using clips
rKane
24th January 2003, 19:28
I'm currently trying to make a script to let me watch Memento in chronological order using a DivX of the original movie as its source. While I've got video working fine, the audio doesn't sync properly with the video sequences. I tried using EnsureVBRMP3Sync(), but that only seems to work for clips that start at frame 0; any clips trimmed on both ends don't seem to work.
Syncs:
src = AVISource("Memento.avi")
src.EnsureVBRMP3Sync()
return Trim(src,0,4260)
Doesn't sync:
src = AVISource("Memento.avi")
src.EnsureVBRMP3Sync()
return Trim(src,3683,4260)
I've tried adding .EnsureVBRMP3Sync() to the end of the trim, but that didn't help either.
Any help on fixing this would be greatly appreciated. Thanks
-rK
rKane
27th January 2003, 09:54
^hopeful bump^
Should I perhaps e-mail the avisynth programmers about this directly?
Richard Berg
27th January 2003, 10:18
Don't worry, we all read the forum. I just know nothing about audio sync :)
Wilbert
27th January 2003, 10:56
Your trim command works on the clip in the first line (not the second). Change your first script in:
AVISource("Memento.avi")
EnsureVBRMP3Sync()
Trim(0,4260)
and second one in:
AVISource("Memento.avi")
EnsureVBRMP3Sync()
Trim(3683,4260)
sh0dan
27th January 2003, 13:31
Have another look at Troubleshooting (http://www.avisynth.org/index.php?page=Troubleshooting)
and the syntax section in the documentation.
onesoul
27th January 2003, 19:27
@rKane
Would you be kind enough to share your script to watch memento in chronological manner? :)
Cheers
rKane
27th January 2003, 23:21
Arg! so dumb.
It's not the fact that I'm using non-implicit variables, it's the fact that I should've written "src = src.EnsureVBRMP3Sync()". I can't believe I didn't notice that.
onesoul: Once I've given it a successful test viewing I'll post it on this thread.
*makes changes*
I've watched part of the movie now, and it seems to put it together correctly, and audio syncs properly, but there are horrible delays every time it cuts to a new scene. Script format is like this:
src = AVISource("Memento.avi").EnsureVBRMP3Sync()
s1 = Trim(src,3683,4260)
s2 = Trim(src,9231,10099)
s3 = Trim(src,14685,15965)
s1 + s2 + s3
(BTW, I've tried both + and ++ operators, neither seemed much different in this case, so I just stuck with +).
Is this delay between scenes a necessary evil of using EnsureVBRMP3Sync()? Is there no way to eliminate the huge lag during normal playback?
Richard Berg
28th January 2003, 01:29
Are you loading the AVS file in your player or rendering it out? If the former, the delays are unavoidable while Avisource seeks to the next frame needed.
rKane
28th January 2003, 01:56
My original goal was to get an .avs that allowed me to use my Memento.avi for both the theatrical and the chronological version by just reconstructing the chronological from the encoded theatrical, thus giving me both versions at the space cost of one .avi.
Would it be any more realistic a goal if I had each segment in its own .avi file? Or should I just bite the bullet and encode a second copy?
onesoul
28th January 2003, 02:04
Originally posted by rKane
Would it be any more realistic a goal if I had each segment in its own .avi file? Or should I just bite the bullet and encode a second copy? This is a matter of taste and only you can decide. I would go for a second copy.
rKane
29th January 2003, 06:22
Going for the second copy does seem to be the best idea, but I'm not really sure what to do for the sound. While I can just edit the .avs that I hand off to GKnot, I'm not sure how (other than slow manual editing) I'd be able to turn the original .ac3/wav into one suitable for the chronological version. I tried loading a chronological .avs into nandub and using "Save .WAV", but that didn't appear to work.
Any suggestions? Does avisynth support any .wav editors i could save from?
Richard Berg
29th January 2003, 08:11
I tried loading a chronological .avs into nandub and using "Save .WAV", but that didn't appear to work.
Can you describe what happened? I'd recommend using VirtualDub[mod] instead, regardless.
Evil Andy
29th January 2003, 11:46
Not sure whether it'd affect anything but were you in Full Processing audio mode when trying to save out your WAV?
rKane
31st January 2003, 00:07
Apparently a bit of patience pays off, as the Save Wav projected time eventually stopped its exponential climb. The projected file size also confused me originally because I was used to Nandub's Save Wav, which just demuxed the MP3, while this was apparently moving sound back into a .wav file. So when my other movies finish encoding I'll try encoding memento-chronological another time.
sh0dan
31st January 2003, 00:12
VBR MP3's are slow to handle, because it cannot jump to a random location within the file. It ALWAYS has to decode all sound from the beginning, to ensure sync. That's the price of VBR mp3.
rKane
5th February 2003, 19:37
I finally got a chance to watch the final avi last night; here is the script I used; I've left off the source because I used it in two ways: once with my original AVI to produce the reordered mp3 audio, and once with GKnot/etc to encode the movie.
#Use for getting Audio:
#src = AVISource("Memento.avi").EnsureVBRMP3Sync()
#use for encoding from DVD rip (from DVD2AVI with Force Film on):
#LoadPlugin("C:\UTILIT~1\GORDIA~1\mpeg2dec.dll")
#src = mpeg2source("E:\Dev\DVD\Memento\memento2.d2v").crop(6,57,711,363).BicubicResize(640,268,0,0.5)
s1 = Trim(src,0,4260)
s2 = Trim(src,9231,10099)
s3 = Trim(src,14685,15965)
s4 = Trim(src,23319,24412)
s5 = Trim(src,32063,32984)
s6 = Trim(src,38479,40998)
s7 = Trim(src,45623,46870)
s8 = Trim(src,56735,57880)
s9 = Trim(src,64800,66271)
s10 = Trim(src,70399,71081)
s11 = Trim(src,74935,75259)
s12 = Trim(src,77082,77355)
s13 = Trim(src,81473,82717)
s14 = Trim(src,85610,86576)
s15 = Trim(src,90177,93434)
s16 = Trim(src,99794,100621)
s17 = Trim(src,105013,105619)
s18 = Trim(src,111189,112018)
s19 = Trim(src,117572,118693)
s20 = Trim(src,119813,120362)
s21 = Trim(src,124503,129693)
s22 = Trim(src,135187,158812)
s79 = Trim(src,129694,135186)
s80 = Trim(src,120363,124502)
s81 = Trim(src,118694,119813)
s82 = Trim(src,112019,117571)
s83 = Trim(src,105620,111188)
s84 = Trim(src,100622,105012)
s85 = Trim(src,93435,99793)
s86 = Trim(src,86577,90176)
s87 = Trim(src,82718,85609)
s88 = Trim(src,77356,81472)
s89 = Trim(src,75260,77071)
s90 = Trim(src,71082,74934)
s91 = Trim(src,66272,70398)
s92 = Trim(src,57881,64799)
s93 = Trim(src,46871,56734)
s94 = Trim(src,40999,45622)
s95 = Trim(src,32985,38478)
s96 = Trim(src,24413,32062)
s97 = Trim(src,15966,23318)
s98 = Trim(src,10100,14684)
s99 = Trim(src,4261,9230)
s101 = Trim(src,158813,163202)
s116 = s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10 + s11 + s12 + s13 + s14 + s15 + s16
s1786 = s17 + s18 + s19 + s20 + s21 + s22 + s79 + s80 + s81 + s82 + s83 + s84 + s85 + s86
s87101 = s87 + s88 + s89 + s90 + s91 + s92 + s93 + s94 + s95 + s96 + s97 + s98 + s99 + s101
return s116 + s1786 + s87101
Audio presented problems for me, especially trying to reencode the demuxed reordered soundtrack, so here's what I did:
-Open the above .avs in VirtualDubMod;
-"Save WAV", generating a 1100MB .wav file of reordered audio;
-Open the .wav in winamp, and use the Disk Writer output plugin to write the file out as a new .wav;
-use LAME to encode the winamp-generated .wav file into mp3
-mux that mp3 onto the video encode
I didn't edit out any duplicate scenes due to often slightly different audio, but I don't feel the movie really suffers that much for it. Enjoy the 'alternative' view ;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.