global f = 5
global total = 0
global subsize = 10*f*2
global subalign = 8
global boxh = subsize
global boxw = subsize*6
global format_str = "%4.0f"
global old = AVISource("old2.avi").trim(0, 30854).ResampleAudio(44100) \
+ AVISource("old1.avi").trim(30922,-0).ResampleAudio(44100)
global new = AVISource("new.avi","new_1.avi").ResampleAudio(44100) \
.DuplicateFrame(0)
global old = old.PointResize(old.width*f*2, old.height*f*2).Subtitle("old", align=8, size=subsize)
global new = new.PointResize(new.width*f, new.height*f).Subtitle("new", align=8, size=subsize)
##################
# actual usage #
##################
insert(30842, 12)
insert(32498, -68)
insert(33739, -14)
insert(34404, 305)
insert(35294, 26)
insert(36089, 10)
insert(36669, 20)
insert(38200, 12)
insert(39051, 43)
insert(39918, -2)
insert(40765, -1)
insert(41627, -75)
##################
StackHorizontal(old, new)
KillAudio
audio = MonoToStereo(GetChannel(old, 1), GetChannel(new, 1))
AudioDub(audio, last)
Trim(0, 328220)
function insert(int start, int length) {
global total = total + length
if (length > 0) {
c = new
length_temp = length
} else {
c = old
length_temp = -length
}
global suby = c.height - subsize
subx = c.width/2
BlankClip(c, length_temp)
ScriptClip("""Subtitle(string(current_frame+1), \
align=subalign, y=suby, size=subsize, font="Consolas", text_color=color_lime)""")
c.Trim(0, start-1) ++ last ++ c.Trim(start, -0) \
.Overlay(BlankClip(width=boxw, height=boxh, color=color_black), \
x=subx-boxw/2, y=suby) \
.Subtitle("last: "+string(length_temp, format_str), \
y=suby, align=subalign, size=subsize, font="Consolas", text_color=color_lime)
if (length > 0) {
global new = last
} else {
global old = last
}
global new = new.Trim(0, start+length) ++ new.Trim(start+length+1, -0) \
.Overlay(BlankClip(width=boxw, height=boxh, color=color_black), \
x=subx-boxw/2, y=suby-subsize) \
.Subtitle("total: "+string(total, format_str), \
y=suby-subsize, align=subalign, size=subsize, font="Consolas")
}