Post subject: Virtual Boy AVISynth Script
Joined: 3/14/2005
Posts: 43
I figured I should make a direct topic on the subject instead of posting it as responses to VB videos. For the past two weeks I've been working on AVISynth scripts that would alternate/interpolate between the left/right eye views in order to simulate depth. Version 1 of the script accomplished this. Sample clip (taken from Adelikat's v2 Wario Land any%, Level 1) http://www.mediafire.com/?anv2mjmzdox And the script (for encoding purposes. the on the fly decoding version can be found here. http://tasvideos.org/forum/viewtopic.php?t=9429&postdays=0&postorder=asc&start=69). Make sure only RGB32 input is checked for the script below. source=ffdshow_source() x=float(10) #number of frames before view switch ScriptClip(""" s=current_frame a=float(Floor(s/x)) b=float(a/2) sp= (b==int(b)) ? Greyscale(ShowRed(source)) : Greyscale(ShowBlue(source)) return(FlipVertical(sp)) """) The problem, as some people mentioned, was that it was too jittery to look at for too long of a time. Also, the depth perception wasn't really pronounced unless the scenery was stationary..and in a TAS, that doesn't happen too often. So, I started work on v2 of the script. Using MVTools I figured out how to interpolate the frames in between the left/right views to give it a panning quality. I think its a substantial improvement over the first script, but I'll let you be the judge of it. http://www.mediafire.com/?omztmoi2mdo Also, script. (again, RGB32 checked only. Its the best way to preserve the quality of the video) source=ffdshow_source() red=ConvertToYUY2(ShowRed(source)) blue=ConvertToYUY2(ShowBlue(source)) x=float(10) #number of frames before direction change ScriptClip(""" ss=current_frame s=float(current_frame) dv=s/x a=float(Floor(dv)) c=100*(dv-a) d=100-c b=float(a/2) t= (b==int(b)) ? float(c): float(d) source= (dv==a) ? source: red.Trim(ss,-1) ++ blue.Trim(ss,-1) forward = (dv==a) ? 0 : source.MVAnalyse(blksize=16, overlap=14, isb = false, chroma=false, pel=1, search=0, searchparam=6) source = (dv==a) ? source : ConvertToRGB32(FlipVertical(red.MVFlow(forward, time=t))) source = (dv==a && b==int(b)) ? Greyscale(ShowBlue(source)) : source source = (dv==a && b!=int(b)) ? Greyscale(ShowRed(source)) : source return(source) """) Its recommended to increase the resolution to 2X before any processing, so the panning filter has more horizontal pixels to work with for the motion. I do have a 1X version of the video (resized from 2X to help preserve sweeping motion), but the depth perception is less pronounced...I might as well upload that too for comparison's sake. http://www.mediafire.com/?di1mm2wdy4g Another downside is because of the ScriptClip function in AVISynth. You'll run out of memory after 300 frames or so, so its best to split the video into segments and encode each separately, then append them back together (as long as the frame count segments are evenly dividable by x*2 value in the script, to prevent any weird effects appending back together). Its a lot of work doing that, and I'm currently trying to figure out what needs to be changed in the script so that's no longer an issue. Any AVISynth experts that could look over the script and tell what needs to improved would be greatly appreciated! Anyway, questions. Do you think videos with v2 of the script would be publishable worthy for VB runs? Also, how do you feel about the perception of depth from the videos watched? And, AVISynth users, any suggestions on optimizing the scripts, namely the ScriptClip function? (I only need ScriptClip for passing the current frame to a variable, so if there's a way around that you'd be a huge help!)
sgrunt
He/Him
Emulator Coder, Former player
Joined: 10/28/2007
Posts: 1360
Location: The dark horror in the back of your mind
Moved to the Encoders' Corner.