Avisynth Primer

     Avisynth is a scripting engine built to process video. You create a plain text file with the extension .avs, type in a series of instructions for said engine to complete, and open the script in an appropriate piece of software. Frames of video are generated by Avisynth and served to the calling application only when they're requested, saving disk space as compared to rendering a giant intermediate file.

     I'm going to try to get you up to speed quickly, so hang on, we're diving in headfirst. Get your test footage ready, ideally a short clip (twenty or thirty seconds is fine), and dump it into C:\UpscaleTutorial. Then open dvupscale.avs in Notepad, and we'll go through it line by line, ignoring the comments:

LoadCplugin("C:\Program Files (x86)\Avisynth\plugins\yadif.dll")


     This line is only necessary if you plan to use the "Ultra Fast" preset in QTGMC. Change the path between the quotes so it points to the proper location, assuming it doesn't already.
     In contrast to the other plugins we're using, Yadif was written using Avisynth's C API, and for technical reasons that are well beyond my level of understanding, that means it won't load automatically, even when placed in your plugins directory. "LoadCplugin" is necessary, or if you prefer, "Load_Stdcall_plugin".

AVISource("testclip.avi")
AssumeBFF()

ConvertToYV12(interlaced=true)
SimpleSlugUpscale()


     See? Simple. Avisynth can be intimidating at first, but most of it's fairly straightforward. AVISource is a source filter used for loading AVI files. Between the double quotes goes the path to your video. You'll need to change the name to match whatever you've named your clip, and if you want to bring in video that's not in the same directory as the .avs file you're currently viewing, you'll need to type the entire path as appropriate.

     AssumeBFF() sets the field order, or "parity", of our interlaced footage. Since the clip you're using is DV, it will be bottom field first in both NTSC and PAL formats. Explicitly declaring the field order is good practice, since many plugins will ask Avisynth for that information when processing clips, and the autodetection of same isn't foolproof.

     Then we have a colorspace conversion. A discussion of color space is beyond the scope of this tutorial, it will suffice to say that your video must be in the proper format for the deinterlacer in use. QTGMC supports both YUY2 and YV12; we'll be using the latter. Make sure to set interlaced to true, otherwise the conversion will be done incorrectly.

     Finally there's my script, SimpleSlugUpscale(). "Simple" because there are only a few options of vital importance, "Slug" because at its default deinterlacing settings it runs at a glacial pace. The extra time required comes with the reward of minimal deinterlacing flicker, and shallow diagonal lines smoother than I ever thought were possible from interlaced origins. As for "Upscale", well, I've long since updated the script to offer downscaling too, but I decided to keep the name for consistency's sake.

     The only thing you may want to do is pass a couple of arguments into SimpleSlugUpscale. The defaults will deinterlace the video very well and scale to 1280x720, but they run a bit slowly for just trying things out. I'd recommend changing that last line to

SimpleSlugUpscale(qual="Super Fast",size="480sq")


for starters. This will use one of QTGMC's lower quality presets, and will produce a 640x480 output frame size, but things will be more responsive. When we're ready to render the final product we can change things back.

     Almost done! A quick trip through VirtualDub and we'll have our finished product.