This is the page where a script called "thing.avs" exists on my computer.
It's similar to how the EncodingPackage was set up back in the day but they're both different to one another and the goal was for quick standard HD encoding.
It reads a subfolder called "programs" for a custom functions page that pulls yadifmod2 for deinterlacing (we use this and not QTGMC cause this was made for quick temp encodes).
The script actually never has an option to prevent the 480i/576i check mainly cause it was half abandoned in adding stuff to it.
This doesn't support for avoiding de-interlacing with N64 footage, make your own script.
This doesn't compensate for VBjin as that's not written in.
This also doesn't do stuff for quick PSXjin Encoding.
This doesn't support 3DS, at least not yet.
This contains early support for WonderSwan rotation.
#	If this is a PlayStation game featuring the bios set the AVISource to <filename>_3.avi and enable multisegment.
#	The file expected is <filename>_3.avi if it is not that on your dump, select whatever features the bios in the avi.

AVISource("filename.avi")

hd       = true		#	Encoded in 1080p or 480p
handheld = false	#	Set if your game is on a handheld system, else leave false.

CHECKRENAME = false		# enable multisegment import (letterbox), for use with WonderSwan ONLY.
ms = false           	# enable multisegment import
ms_base = "filename_"	# common string for all segment names
ms_start = 0        	# number of the first segment
ms_end = 10         	# number of the last segment

ds       = false	#	If you've created your TAS on DS.
mainscrn = false	#	Asking to have a single screen larger than the other.
maintop  = false	#	Applies to the previous. If true then the top screen is the main, if false the bottom is.
sideside = false	#	The screens displayed next to each other.
turn	 = false	#	Rotating/Turning the DS Screen for game such as Brain Age.
# If multiple modes are set to "true", the order in which takes precedence is as follows: large main screen > side to side > rotated > normal

virtboy	 = false	#	If you've created a VirtualBoy TAS on BizHawk. Please dump with the SideBySide setting.

ms_format = "%1.0f" # string format: http://avisynth.nl/index.php/Internal_functions#String

#########################################################################
#	Catered towards for the DeSmuME emulator.							#
#	If you want more advanced DS for changing screens.					#
#	This is not the script for you. This is for the basic of basics.	#
#########################################################################

#	Checking for human error.
ds = (Last.Width == 256) && (Last.Height == 384) ? true : false

ds ? Eval("""
	handheld = true
	
	top = last.crop(0, 0, -0, 192)
	bot = last.crop(0, 192, -0, -0)

	mainscrn ? \
		maintop ? \
			StackHorizontal(top.PointResize(512,384), bot.AddBorders(0, 192, 0, 0)) : \
			StackHorizontal(bot.PointResize(512,384), top.AddBorders(0, 0, 0, 192)) \
	: sideside ? \
		StackHorizontal(top, bot) : \
		turn ? \
			StackVertical(top.AddBorders(0, 0, 0, 78), bot).TurnLeft : \
			StackVertical(top.AddBorders(0, 0, 0, 48), bot)
""") : 0

#########################################################################
#	BizHawk's VirtualBoy Emulator										#
#	Have Hawk set to "SideBySide" under "ThreeDeeMode" before dumping.	#
#########################################################################

#	Checking for human error.
virtboy = (Last.Width == 768) && (Last.Height == 224) ? true : false

virtboy ? Eval("""
	handheld = true
	Crop(0, 0, 384, 224).Levels(0, 1, 255, 0, 157)
""") : 0

#########################################################################
#	Literally everything else.											#
#########################################################################

#    Checking for WonderSwan
WSRENAME = Eval("""
	target_width = 224
	target_height = 224""") 

CHECKRENAME ? Eval("""
    ms = false
    ((Last.width == 224) && (Last.height == 144)) || \
    ((Last.width == 144) && (Last.height == 224)) ? \
    WSRENAME : false
    """) : false

#	If ms enabled, we use parameters of "last" to apply to all segments
Import("programs\functions.avsi")
LoadPlugin("programs\yadifmod2.dll")

resizer = hd ? "Point" : "Lanczos"
CHECKRENAME ? AppendSegmentLetterbox(ms_base, target_width, target_height, ms_start, ms_end, ms_format, pixelType).ConvertToRGB32() : \
ms ? AppendSegment(ms_base, ms_start, ms_end, ms_format, resizer).ConvertToRGB32() : last

handheld ? true : Eval("""
	handheld = ((Last.Width == 240) && (Last.Height == 160)) || \
	((Last.Width == 224) && (Last.Height == 224)) || \
	((Last.Width == 224) && (Last.Height == 144)) || \
	((Last.Width == 144) && (Last.Height == 224)) || \
	((Last.Width == 160) && ((Last.Height == 152) || \
	(Last.Height == 144) || \
	(Last.Height == 102))) \
	? true : false
""")

mainscrn ? Eval("""sideside = false""") : 0
sideside ? Eval("""
	width = hd	? 1920 : 854
	height	= width * last.height / last.width""")\
: Eval("""
	height = hd	? 1080 : 480
	width	= handheld \
			? height * last.width / last.height \
			: height * 4 / 3
	width	= width  % 4 == 1 ? width  + 3 : \
			width  % 4 == 2 ? width  + 2 : \
			width  % 4 == 3 ? width  + 1 : width
""")

#########################################################################
#	Checking the framerate and height and cutting						#
#	the framerate in half for necessary YouTube reasons.				#
#########################################################################

hd ? Eval("""
	last.FrameRate > 65.0 ? ChangeFPS(last.FrameRate/2) : 0
	last.FrameRate > 60 ? ChangeFPS(60) : 0
""") : ChangeFPS(last.FrameRate/2)

hd ? \
PointResize(width, height) \
: LanczosResize(width, height, taps=2)

CM_Colors = hd ? "709" : "601"
ConvertToYV24(ChromaResample="Point", Matrix="Rec"+CM_Colors)
ConvertToYV12(ChromaResample="Lanczos", Matrix="Rec"+CM_Colors)

#	Script Created by:
# 	feos, Spikestuff, TheCoreyBurton, Aktan & Zinfidel
#	(Mostly Spikestuff so blame them on any of the issues.)
# Multisegment AVI import
function AppendSegment(
\   clip sample,
\ string base,
\    int first_val,
\    int last_val,
\ string format,
\ string resizer
\){
    filename = base + string(first_val, format) + ".avi"
    result = AviSource(filename)
    result.height == 480 ? eval("""
        result = result.ConvertToYV24().yadifmod2(order=1, field=-1, mode=1, opt=2).SelectEvery(4, 0, 3).ConvertToRGB32()
        """) : \
    result.height == 576 ? eval("""
        result = result.ConvertToYV24().yadifmod2(order=1, field=-1, mode=1, opt=2).SelectEvery(4, 1, 2).ConvertToRGB32()
        """) : 0    
    result = result.Eval(resizer + """Resize(sample.width, sample.height)""")
    return (first_val < last_val) \
        ? result + sample.AppendSegment(base, first_val+1, last_val, format, resizer) \
        : result
}

# Multisegment AVI import (Letterbox)
function AppendSegmentLetterbox(
\   clip sample,
\ string base,
\    int target_width,
\    int target_height,
\    int first_val,
\    int last_val,
\ string format,
\ string pix_type
\){
    filename = base + string(first_val, format) + ".avi"
    result = AviSource(filename, pixel_type=pix_type)
    xside = int(target_width - result.width) / 2
    yside = int(target_height - result.height) / 2
    result = result.AddBorders(xside,yside,xside,yside)
    return (first_val < last_val) \
        ? result + sample.AppendSegmentLetterbox(base, target_width, target_height, first_val+1, last_val, format, pix_type) \
        : result
}

HomePages/Spikestuff/Scripts last edited by Spikestuff on 9/8/2022 4:17 AM
Page History Latest diff List referrers View Source