View Full Version : position of EnsureVBRMP3sync


AlanHK
29th December 2007, 06:24
Is there any difference in result beween these scripts?

AVISource("Q_1.avi").trim(0,91120).EnsureVBRMP3sync() ++\
AVISource("Q_2.avi").EnsureVBRMP3sync()
LanczosResize(720,576,2,0,700,384)

and

AVISource("Q_1.avi").trim (0,91120) ++\
AVISource("Q_2.avi")
LanczosResize(720,576,2,0,700,384)
EnsureVBRMP3sync()

I.E, does the ensureVBRMP3sync() have to be attached to every single file as it is named, or is is sufficient to apply it to the result?

IanB
29th December 2007, 06:55
In the 1st case seeking backwards in the 2nd file region only result in returning to the begining of the 2nd file and reading forwards from there.

In the 2nd case any seeking backwards results in returning to the begining of the 1st file and reading all the way up from there.

AlanHK
29th December 2007, 10:25
In the 1st case seeking backwards in the 2nd file region only result in returning to the begining of the 2nd file and reading forwards from there.

In the 2nd case any seeking backwards results in returning to the begining of the 1st file and reading all the way up from there.

I guess that means the first method would be more efficient.

But in both cases sync will always be preserved?

The critical application is to feed it to wavi and output a WAVE file.

I had been using the first method, but thought it would be tidier if I just had a single EnsureVBRMP3sync at the end. I could comment it out for when I was just dealing with video when adjusting trims etc, as it does very much slow down any seeking.

IanB
29th December 2007, 12:26
I guess that means the first method would be more efficient.Well it avoids having to fully read the 1st file in addition to part of the 2nd.
... as it does very much slow down any seeking.Well thats the price for accurately being able to seek a vbr stream.
I could comment it out for when I was just dealing with video when adjusting trims etc, You can always use script functions to increase the conveinience when working with scripts. Doing so costs nothing.Function VBRSync(Clip Klop) {
Klop
### EnsureVBRMP3Sync()
Return Last
}

AVISource("Q_1.avi").VBRSync().trim(0,91120) ++\
AVISource("Q_2.avi").VBRSync()
LanczosResize(720,576,2,0,700,384)Also put any EnsureVBRMP3Sync() statements before any trims. In your example you trim from 0 so there is no problem, if you trim else where you can cause an unprotected seek and mess up your AV sync.

AlanHK
29th December 2007, 13:53
So will the EnsureVBRMP3Sync() here be applied to every segment? I've assumed so, but I'm not so sure now.

AVISource("S-115.avi").ConverttoYUY2()
EnsureVBRMP3Sync()
AmplifydB(7.5)
logo=ImageSource("logo115.png").ConverttoYUY2()

Trim(631 +1,8612 ).NoLogoAuto(logo,1)++\
Trim(8612 +1,13397) ++\
Trim(13397+1,24207).NoLogoAuto(logo,1)++\
Trim(24207+1,24370) ++\
Trim(24370+1,35727).NoLogoAuto(logo,1)++\
Trim(35727+1,35953) ++\
Trim(35953+1,47187).NoLogoAuto(logo,1)++\
Trim(47187+1,47448) ++\
Trim(47448+1,0 ).NoLogoAuto(logo,1)

ConvertToYV12()

It would be nice if there was a single command one could put at the top of a file to sync all streams.

IanB
29th December 2007, 21:21
Yes that is the correct use of EnsureVBRMP3Sync(), i.e. straight after the source and before any seek causing trims()'s.