User File #637878850671998689

Upload All User Files

#637878850671998689 - comparison script

comparison.avs
106 downloads
Uploaded 5/11/2022 4:57 PM by feos (see all 191)
global f = 1
global total = 0
global subsize = 10*f
global subalign = 8
global boxh = subsize
global boxw = subsize*6
global format_str = "%4.0f"

global old = AVISource("old.avi").ResampleAudio(44100)
global new = AVISource("new.avi").ResampleAudio(44100)
global old = old.PointResize(old.width*f, old.height*f).Subtitle(    "feos", align=8, size=subsize)
global new = new.PointResize(new.width*f, new.height*f).Subtitle("DreamYao", align=8, size=subsize)

##################
#  actual usage  #
##################
insert( 2705,  6)
insert( 4093,  3)
insert( 5168, 12)
insert( 7784,  9)
insert( 8008, -1)
insert( 9225, 59)
insert(11771, 56)
insert(14054,113)
insert(15372, 14)
insert(15897, 11)
insert(17748,  2)
insert(20293, 10)
insert(21061,  6)
insert(24002, 97)
insert(24524,  5)
insert(28675, 45)
insert(30425, 67)
insert(30957, -3)
insert(36329,101)
insert(36617,  4)
insert(37410, 12)
insert(39489,165)
insert(40660, 16)
insert(41882,  7)
insert(44006,  9)
insert(45416,  2)
##################

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")
}