Don't know what the problem is, but... lots of one-letter variables are bad.
global FrameDiff = 0
global last_a = BlankClip(0)
global last_b = BlankClip(0)
a = Open( "jackicgunstar.avi", "Jackic" )
b = Open("arkiandruskigunstar.avi", "arkiandruski")
AddFrameDiff(a.Trim( 0, 787), b.Trim( 0, 985))
AddFrameDiff(a.Trim( 788, 1685), b.Trim( 986, 2036))
AddFrameDiff(a.Trim(1686, 2129), b.Trim(2037, 2299))
AddFrameDiff(a.Trim(2130, 3054), b.Trim(2300, 3354))
AddFrameDiff(a.Trim(3055, 4349), b.Trim(3355, 4555))
AddFrameDiff(a.Trim(4350, 7494), b.Trim(4556, 7536))
AddFrameDiff(a.Trim(7495, 8591), b.Trim(7537, 8509))
AddFrameDiff(a.Trim(8592, 9801), b.Trim(8510, 9719))
AudioDub(StackHorizontal(last_a, last_b), MixAudio(last_a, last_b, 1.0, 0.0))
Trim(0, 75009)
Subtitle("Frames gained: " + String(FrameDiff, "%05.0f"), align=2, size=15)
ConvertToYV24(matrix="PC.601", chromaresample="point" )
ConvertToYV12(matrix="PC.601", chromaresample="lanczos4")
function AddBlankClip(clip a, clip b) {
m = Max(a.FrameCount, b.FrameCount)
result1 = a + BlankClip(a, length=m - a.FrameCount).FreezeFrame(a.FrameCount, m - 1, a.FrameCount - 1)
result2 = a
return (a.FrameCount != m) ? result1 : result2
}
function AddFrameDiff(clip a, clip b) {
last_a = a
last_b = b
FrameDiff = FrameDiff + (a.FrameCount - b.FrameCount)
return FrameDiff
}
function FormatTime(int ms) {
s = ms / 1000
ms = ms % 1000
m = s / 60
s = s % 60
h = m / 60
m = m % 60
return String(m, "%02.0f") + ":" + String(s, "%02.0f") + "." + String(ms, "%03.0f")
}
function Open(string FileName, string Title) {
AVISource(FileName)
AddBorders(2, 20, 2, 20)
Subtitle(Title, align=2, text_color=$00FFFFFF)
ScriptClip("""Subtitle("Frame: " + String(current_frame) + "\nTime: " + FormatTime(Round(Float(current_frame * 1000) * Float(FrameRateDenominator) / Float(FrameRateNumerator))), text_color=$00FFFFFF, lsp=1, size=10.0)""")
}