View Page Source

Revision (current)
Last Updated by Spikestuff 16 days ago
Back to Page

This page is mainly made for code snippets and should not be taken for actually working with an actual script, if you want something like that-- well this is where the homebrew happened.
[http://i.imgur.com/Il8jonr.png|right]

%%TAB_START
%%TAB Minimize Tab
%%TAB Virtual Boy
[Forum/Posts/514641|Additional information can be found here].

BizHawk 2.9 and Newer
%%SRC_EMBED avs
vid = AVISource("6909S.avi")
cw = vid.Width / 2

L = vid.Crop(0, 0, 380, 224).PointResize(cw*2,vid.Height * 2).Levels(0, 1, 255, 0, 167)
R = vid.Crop(384, 0, 384, 224).PointResize(cw*2,vid.Height * 2).Levels(0, 1, 255, 0, 167)

StackHorizontal(L,R).LanczosResize(768,448, taps=2).AudioDub(L)
%%END_EMBED

Unless feos has a different part on how to handle it compared to when this was first made, you need this final line after merging the file.

%%SRC_EMBED sh
"./programs/ffmpeg" -i encode.mkv -c copy -metadata:s:v:0 stereo_mode=1 "virtualboy.mkv"
%%END_EMBED

----

BizHawk 2.8 and Older
%%SRC_EMBED avs
vid = AVISource("6909S.avi")
cw = vid.Width / 2

L = vid.Crop(0, 0, 380, 224).PointResize(cw*2,vid.Height * 2).Levels(0, 1, 255, 0, 157)
R = vid.Crop(384, 0, 384, 224).PointResize(cw*2,vid.Height * 2).Levels(0, 1, 255, 0, 157)

StackHorizontal(L,R).LanczosResize(768,448, taps=2).AudioDub(L)
%%END_EMBED

Unless feos has a different part on how to handle it compared to when this was first made, you need this final line after merging the file.

%%SRC_EMBED sh
"./programs/ffmpeg" -i encode.mkv -c copy -metadata:s:v:0 stereo_mode=1 "virtualboy.mkv"
%%END_EMBED

----

__Don't forget to Greyscale first using Avisynth!__%%%
If Pink; Tweak(cont=1.5) |alternately| Levels(0, 1, 171, 0, 255)%%%
If Red; Tweak(cont=2.08) |alternately| Levels(0, 1, 124, 0, 255).Levels(0, 1, 254, 0, 255)%%%
If Blue; Tweak(cont=5.4) |alternately| Levels(0, 1, 47, 0, 255)

__And if you're starting from Greyscale (Bleach) thanks to VBjin.__%%%
If Bleach; Tweak(cont=0.615) |alternately| Levels(0, 1, 255, 0, 157)

__Cropping it's a thing to save lives.__%%%

[user:feos] has this part defaulted to BizHawk Virtual Boy as VBjin is obsolete... there is a fix now provided by feos (bit below), this is here for reference now.

VBjin%%%
L  = sauce.Crop(0, 0, 384, 224)%%%
R = sauce.Crop(400, 0, 384, 224)

BizHawk%%%
L  = sauce.Crop(0, 0, 384, 224)%%%
R = sauce.Crop(384, 0, 384, 224)


[user:feos|Actual feos]: [https://files.tasvideos.org/2095/archives/old_vb.7z|Here's all I can provide atm.] The change in VB methods changed the scripts so heavily that there's no sane way to have both options.

%%TAB DS would like a word.

Proper DS%%%
Revision 2:

All values can be multiplied by 10 to reach the 8k resolution without issue.%%%
Those marked with the Hash symbol are created for the 8K in mind, since they don't scale up as cleanly.

%%SRC_EMBED avs
#FinalRes = 7680x4160
vid = AVISource("source.avi")
cr = vid.Height / 2

#Gameplay
bot = a.Crop(0, cr, -0, -0)
top = a.Crop(0, 0, -0, -cr).AddBorders(0, 0, 0, 192)
a = StackHorizontal(bot.PointResize(512,384), top).AddBorders(0, 16, 0, 16)

#Gameplay (top)
top = a.Crop(0, 0, -0, -cr)
bot = a.Crop(0, cr, -0, -0).AddBorders(0, 192, 0, 0)
a = StackHorizontal(top.PointResize(512,384), bot).AddBorders(0, 16, 0, 16)

#Single (Top)
a = a.Crop(0, 0, -0, -cr).PointResize(512,384).AddBorders(128, 16, 128, 16)

#Single (Bot)
a = a.Crop(0, cr, -0, -0).PointResize(512,384).AddBorders(128, 16, 128, 16)

#TopAndBot (NoGap)
a = a.AddBorders(256, 16, 256, 16)

#TopAndBot
top = a.Crop(0, 0, -0, -cr).AddBorders(0, 0, 0, 32)
bot = a.Crop(0, cr, -0, -0)
a = StackVertical(top,bot).AddBorders(256, 0, 256, 0)

#SideBySide
top = a.Crop(0, 0, -0, -cr)
bot = a.Crop(0, cr, -0, -0)
a = StackHorizontal(top, bot).LanczosResize(768,288).AddBorders(0, 64, 0, 64)
#StackHorizontal(top, bot).PointResize(8192,3072).LanczosResize(7680,2880,taps=2).AddBorders(0, 640, 0, 640)

#Gameplay (TASinfo)
bot = a.Crop(0, cr, -0, -0)
top = a.Crop(0, 0, -0, -cr).AddBorders(0, 0, 0, 192)
a = StackHorizontal(bot.PointResize(512,384).TextSubMod("Subs.ass"), top).AddBorders(0, 16, 0, 16)
#StackHorizontal(bot.PointResize(5120,3840).TextSubMod("Subs.ass"), top.PointResize(2560,3840)).AddBorders(0, 160, 0, 160)
%%END_EMBED

%%TAB 3DS more like...
heaven.

%%SRC_EMBED avs
vid = AVISource("source.avi").Amplify(0.70)

#If you're using Citra add this:
.DelayAudio(3.7*4481136.0/268111856)

cw = vid.Width / 10
ch = vid.Height / 2

#Gameplay (Top)
top = vid.crop(0, 0, -0, -ch)
bot = vid.crop(cw, ch, -cw, -0).AddBorders(0, ch, 0, 0)
StackHorizontal(top.PointResize(top.width*2,top.height*2), bot)

#If you're not following the native res of 400x480 use this instead:
StackHorizontal(top, bot.LanczosResize(bot.width/2,bot.height/2))

#Gameplay (Bottom. Yes these games exists)
top = vid.crop(0, 0, -0, -ch).AddBorders(0, 0, 0, ch)
bot = vid.crop(cw, ch, -cw, -0)
StackHorizontal(bot.PointResize(bot.width*2,bot.height*2), top)

#If you're not following the native res of 400x480 use this instead:
StackHorizontal(bot, top.LanczosResize(top.width/2,top.height/2))

#Stacked
vid.AddBorders(360, 0, 360, 0)

#Single (Top)
vid.crop(0, 0, -0, -ch).PointResize(800,480).AddBorders(160, 0, 160, 0)

#Single (Bottom. There are cases where this is needed, be shocked.)
vid.crop(0, ch, -0, -0).PointResize(800,480).AddBorders(160, 0, 160, 0)

#Add this for before your rescaling:
last.AddBorders(0,5,0,5)
%%END_EMBED

%%TAB PlayStation 2 (PCSX2)
__NTSC/PAL60 PlayStation 2__%%%
TODO (for NTSC): Unique resolutions in NFS:Carbon to reverify & verify Beyond Good & Evil.
%%SRC_EMBED avs
# This section will work with goodizers as long as you scale appropriately.
# Calculation from a 256 x 224 or 512 x 224/448 or 640 x 224/448 image
cw = last.Width / 8
ch = last.Height / 14

# Calculation from a 640 x 224 image (GUNCON)
cw = last.Width / 8
ch = last.Height / 112 * 127

# Calculation from a 512 x 486 image
# Titles actually require the crop from the bottom to be correct to console.
cw = last.Width / 8
ch = last.Height / 243
vid.crop(0,0,0,-ch*4)

# Calculation from a 512 x 446 image
cw = last.Width / 8
ch = last.Height / 223 * 17

# Calculation from a 576 x 960 image (1080i)
cw = last.Width / 9
ch = last.Height / 8

# They share the same "addborders" script
vid.AddBorders(cw/2, ch/2, cw/2, ch/2)

# Calculation from a 640/512 x 416 image
cw = last.Width / 8
ch = last.Height / 13

vid.AddBorders(cw/2, ch, cw/2, ch)

# Calculation from a 638 x 480 image
cw = last.Width / 319 * 20
ch = last.Height / 160
last.crop(0,0,0,-ch)

last.AddBorders(cw + cw/cw, 0, cw, ch)

# EXTRA
# Calculation from a 640 x 224 image (GUNCON) NO BORDERS
cw = last.Width / 320 * 284
LanczosResize(cw,last.height)
%%END_EMBED

Automated:
%%SRC_EMBED avs
# This section is expecting natively dumped resolutions.
guncon = false

cw = last.Width == 638 ? last.Width / 319 * 20 : \
last.Width == 576 ? last.Width / 9 : \
last.Width / 8

ch = last.Height == 960 ? last.Height / 8 : \
last.Height == 486 ? last.Height / 243 : \
last.Height == 480 ? last.Height / 160 : \
last.Height == 446 ? last.Height / 223 * 17 : \
last.Height == 416 ? last.Height / 13 : \
guncon && last.Height == 224 ? last.Height / 112 * 127 : \
last.Height / 14

last.Height == 486 ? last.crop(0,0,0,-ch*4) : \
last.Height == 480 ? last.crop(0,0,0,-ch) : 0

# The numbers are reflected from the previous line.
# 480 (477) might need width scrutiny on the previous line.
last.Height == 477 ? last.AddBorders(cw + cw/cw, 0, cw, ch) : \
last.Height == 416 ? last.AddBorders(cw/2, ch, cw/2, ch) : \
last.AddBorders(cw/2, ch/2, cw/2, ch/2)

PointResize(last.width*10,last.height*10)
LanczosResize(2880,2160)
%%END_EMBED

----

__PAL PlayStation 2__
%%SRC_EMBED avs
# This section will work with goodizers as long as you scale appropriately.
# Calculation from a 640 x 512/256 or 512 x 512 image
cw = last.Width / 8
ch = last.Height / 8

# Calculation from a 640 x 256 image (GUNCON)
cw = last.Width / 8
ch = last.Height / 128 * 159

# Calculation from a 512 x 508 image
cw = last.Width / 8
ch = last.Height / 254 * 34

# Calculation from a 512 x 576 image
# Titles actually require the crop from the bottom to be correct to console.
cw = last.Width / 8
ch = last.Height / 288 * 5
vid.crop(0,0,0,-ch)

# Calculation from a 640 x 414 image
cw = last.Width / 8
ch = last.Height / 69 * 27

# They share the same "addborders" script
AddBorders(cw/2, ch/2, cw/2, ch/2)

# Calculation from a 640 x 448 image
cw = last.Width / 8
ch = last.Height / 7

AddBorders(cw/2, ch, cw/2, ch)

# Calculation from a 638 x 510 image
cw = last.Width / 319 * 20
ch = last.Height / 255 * 16

last.AddBorders(cw + cw/cw, ch, cw, ch)

# EXTRA
# Calculation from a 640 x 256 image (GUNCON) NO BORDERS
cw = last.Width / 320 * 284
LanczosResize(cw,last.height)
%%END_EMBED

Automated:
%%SRC_EMBED avs
# This section is expecting natively dumped resolutions.
guncon = false

cw = last.Width / 8

ch = last.Height == 576 ? last.Height / 288 * 5 : \
last.Height == 508 ? last.Height / 254 * 34 : \
last.Height == 448 ? last.Height / 7 : \
last.Height == 414 ? last.Height / 69 * 27 : \
guncon && last.Height == 256 ? last.Height / 128 * 159 : \
last.Height / 8

last.Height == 576 ? last.crop(0,0,0,-ch) : 0

last.Height == 448 ? last.AddBorders(cw/2, ch, cw/2, ch) : \
last.AddBorders(cw/2, ch/2, cw/2, ch/2)

PointResize(last.width*10,last.height*10)
LanczosResize(2880,2160)
%%END_EMBED

%%TAB Nintendo Wii (Dolphin)
This only exists to point out that I have figured it out.
%%SRC_EMBED avs
# Calculation from a 640x524 (Ratio: 777:524)
cw = last.Width / 160 * 9
last.AddBorders(cw, 0, cw, 0)

# Calculation from a 776x444
cw = last.Width / 194 * 21 / 2
ch = last.Height / 222 * 13 / 2
mfw = last.Width / 776

last.AddBorders(cw+mfw, ch, cw, ch)

# Calculation from a 820x448
cw = last.Width / 82 * 3 / 2
ch = last.Height / 224 * 13 / 2
mfw = last.Width / 820

last.AddBorders(cw-mfw, ch, cw, ch)

# Calculation from a 848x480
cw = last.Width / 424 * 7 / 2
chc = last.Height / 80
crop(0,chc,0,0)

AddBorders(cw, 0, cw, 0)

# Calculation from a 852x480
cw = last.Width / 213
mfw = last.Width / 426

# Calculation from a 832x480
cw = last.Width / 416 * 7
mfw = last.Width / 832
chc = last.Height / 80
crop(0,chc,0,0)

# Calculation from a 812x480
last.Width / 203 * 6
mfw = last.Width / 812

last.AddBorders(cw+mfw, 0, cw, 0)

# Calculation from a 852x448
cw = last.Width / 426 * 5
ch = last.Height / 56 * 3 / 2
mfh = last.Height / 448

last.AddBorders(cw, ch, cw, ch+mfh)

# Calculation from a 832x456
cw = last.Width / 416 * 7
ch = last.Height / 57
# ch = last.Height / 228 * 4
# (keeping this here temporarily for a different math operation if it can be used in the future).
mfw = last.Width / 832
mfh = last.Width / 456

last.AddBorders(cw+mfw, ch, cw, ch+mfh)
%%END_EMBED

%%TAB N64 but--
--you're pedantic for a "true" 30fps on a 30fps title.

Using [Forum/Topics/18914|FixFPS]%%%
(Ignore adding Logo/Subtitles steps for now if you're following this, stuff's not down 100%)

%%SRC_EMBED avs
LoadPlugin("ExactDedup.dll")
LoadPlugin("FixFPS.dll")
AVISource("N64Vid.avi")

ExactDedup(firstpass=true, dupinfo="EDD.txt", times="EDD-times.txt")
%%END_EMBED

Do your first benchmark here.

%%SRC_EMBED avs
LoadPlugin("ExactDedup.dll")
LoadPlugin("FixFPS.dll")
AVISource("N64Vid.avi")

ExactDedup(firstpass=false, dupinfo="EDD.txt")
FixFPS("EDD-times.txt", <half the total framecount minus 1>, 2, 1)
#Insert your logo and subtitle information here.
ExactDedup(firstpass=true, dupinfo="EDD2nd.txt", times="EDD2nd-times.txt")
%%END_EMBED

Do your second benchmark here.

%%SRC_EMBED avs
LoadPlugin("ExactDedup.dll")
LoadPlugin("FixFPS.dll")
AVISource("N64Vid.avi")

ExactDedup(firstpass=false, dupinfo="EDD.txt")
FixFPS("EDD-times.txt", <half the total framecount minus 1>, 2, 1)
#Insert your logo and subtitle information here.
ExactDedup(firstpass=false, dupinfo="EDD2nd.txt") #Disable this line when previewing.
#Insert your colourspace here.
%%END_EMBED

In your x264 script insert this line before "output": {{--tcfile-in EDD2nd-times.txt}}

%%TAB FFMPEG junk
__DS 3 Screen Layout__
%%SRC_EMBED bat
:: Top Priority:
-filter_complex "[0:v]crop=iw:ih/2:0:0,scale=iw*2:ih*2:sws_flags=neighbor[left]; [left][0:v]hstack"

:: Bottom Priority:
-filter_complex "[0:v]crop=iw:ih/2:0:oh,scale=iw*2:ih*2:sws_flags=neighbor[left]; [left][0:v]hstack"
%%END_EMBED

__DS 2 Screen + Priority__
%%SRC_EMBED bat
:: Top Priority:
-filter_complex "[0:v]crop=iw:ih/2:0:0,scale=iw*2:ih*2:sws_flags=neighbor[left]; [0:v]crop=iw:ih/2:0:oh,pad=0:ih*2:0:ih[right]; [left][right]hstack"

:: Bottom Priority:
-filter_complex "[0:v]crop=iw:ih/2:0:oh,scale=iw*2:ih*2:sws_flags=neighbor[left]; [0:v]crop=iw:ih/2:0:0,pad=0:ih*2:0:0[right]; [left][right]hstack"
%%END_EMBED

__DS Scaling Extras (Cause YouTube is shit)__
%%SRC_EMBED bat
:: 1080p
,scale=iw*4:ih*4:sws_flags=neighbor,scale=1920:-1:flags=lanczos

:: 720p
,scale=iw*2:ih*2:sws_flags=neighbor,scale=1280:-1:flags=lanczos
%%END_EMBED

__3DS Top Screen Priority__
%%SRC_EMBED bat
:: Native Resolution:
-filter_complex "[0:v]crop=iw:ih/2:0:0,scale=iw*2:ih*2:sws_flags=neighbor[left]; [0:v]crop=((iw/5)*4):ih/2:iw/10:ih/2,pad=iw:ih*2:0:ih[right]; [left][right]hstack,pad=iw:ih+ih/48:iw/2:ih/2"

:: Non-Native Resolution:
-filter_complex "[0:v]crop=iw:ih/2:0:0[left]; [0:v]crop=((iw/5)*4):ih/2:iw/10:ih/2,pad=iw:ih*2:0:ih,scale=iw/2:ih/2:sws_flags=lanczos[right]; [left][right]hstack,pad=iw:ih+ih/48:iw/2:ih/2"
%%END_EMBED

__3DS Bottom Screen Priority__
%%SRC_EMBED bat
:: Native Resolution:
-filter_complex "[0:v]crop=((iw/5)*4):ih/2:iw/10:ih/2,scale=iw*2:ih*2:sws_flags=neighbor[left]; [0:v]crop=iw:ih/2:0:0,pad=iw:ih*2:0:0[right]; [left][right]hstack,pad=iw:ih+ih/48:iw/2:ih/2"

:: Non-Native Resolution:
-filter_complex "[0:v]crop=((iw/5)*4):ih/2:iw/10:ih/2[left]; [0:v]crop=iw:ih/2:0:0,scale=iw/2:ih/2:sws_flags=lanczos[right]; [left][right]hstack,pad=iw:ih+ih/48:iw/2:ih/2"
%%END_EMBED

__3DS Scaling Extras (Cause YouTube is shit)__
%%SRC_EMBED bat
:: Native
:: 1080p
,scale=iw*2:ih*2:sws_flags=neighbor,scale=1920:-1:flags=lanczos

:: 720p
,scale=iw*2:ih*2:sws_flags=neighbor,scale=1280:-1:flags=lanczos

:: Non-Native
:: 4K
,scale=3840:-1:flags=lanczos

:: 1080p
,scale=1920:-1:flags=lanczos

:: 720p
,scale=1280:-1:flags=lanczos
%%END_EMBED

%%TAB_END