Avisynth Virtual File System

     All right, here's where things get a bit sticky. If the tutorial up to now has worked out for you, and you're tired of installing software, I don't blame you for stopping right here. Installation of this next setup is a little more complicated, and if it's not something you need you might as well not bother. It's worth a peek, though, so stick around if you can.

     There's an excellent explanation in the manual, but to summarize, the Avisynth Virtual File System turns an Avisynth script into a fake AVI file that almost any application can access. Avisynth, under normal circumstances, is triggered by software that both uses the Video for Windows media architecture and loads files through the standard Windows file handling interface. Open a .avs file with one of these programs and it won't know the difference between the script and an AVI; Avisynth works silently in the background, serving frames as they're needed.

     Many useful programs don't operate this way, however. They use the DirectShow or QuickTime frameworks, or they use their own file handlers. Sometimes both. How do you get scripts into them without first spending the time and wasting the storage space to render gigantic intermediate files? Turns out there are several answers to that question, but the solution I've found most reliable is the AVFS.

     To get it installed you'll need both the Pismo File Mount Audit Package (first thing on the page, click "Download Windows Install package") and AVFS itself. The File Mount Audit Package is straightforward, just run the installer and follow the prompts. AVFS is more work. Extract avfs.dll to any directory you want, but like the manual I'm going to suggest C:\WINDOWS as your destination.

     Open a command prompt (Start->Run, type in cmd and hit OK) and type

pfm register C:\WINDOWS\avfs.dll

swapping out C:\WINDOWS for whichever directory you placed avfs.dll in. Should you ever want to uninstall this stuff, first remove AVFS through the command prompt using

pfm unregister C:\WINDOWS\avfs.dll

and then delete avfs.dll. PFMAP is a simple matter of Add/Remove Programs, just like any other software.

     With installation complete, you'll find two new options added to your context menu in Explorer. Right click a file and you'll see "Quick Mount" and "Mount". The Pismo File Mount system is useful for a variety of things, but in relation to Avisynth, these two options will turn .avs files into directories containing virtual AVI files.

     Try it out on our script. Inside C:\UpscaleTutorial, right click dvupscale.avs and choose Quick Mount (Mount has extra options that we don't need right now). After a moment the script will be replaced by a folder, and with a double click you'll find yourself inside, face to face with an artificial representation of our script's output. The file size reported will be astronomical, but not to worry! The file doesn't actually exist, and while applications can see and work with the file as if it's there, it consumes no disk space.

     Despite all that, not everything can access the file; Quicktime Player, for example, pops up a message about missing the codec necessary to decode the clip. This has to do with color spaces. In this context Quicktime Player, like much other software, only accepts RGB input. Our script is putting out YUV (specifically, the YV12 pixel format), which means we need to convert from one to the other as the last step in our script. Thanks to the way PFM and AVFS work together, you don't even need to unmount the script first. Alongside the virtual AVI file you should find a copy of the script that vanished when you chose Quick Mount from that menu. Open it in Notepad, just like we usually do, and tack on the line

ConvertToRGB24()

as a new line at the very bottom. This is an expensive operation, and will slow things down noticeably, so please only force the conversion if you find that your software of choice won't load the fake AVI without it. Even if you have to convert colorspace, though, the slower render may be worth the disk space savings. That's for you to judge.

     Once you've added that line, save the script, and after a moment or two the virtual AVI will be updated to reflect the changes. Specifically, the reported filesize will shoot even further through the roof, as it will appear to Windows that an uncompressed RGB file now resides there. More than likely you'll need to reopen the AVI in your application, but that's not too difficult; sometimes, if you're lucky, you'll be working with a program that shows your changes without any intervention on your part, but don't get your hopes up, it's rare.

     When you're all done using the virtual AVI file, you can simply right click the dvupscale.avs directory icon and choose Unmount from the menu. Avisynth will be unloaded from memory, the directory and all files inside will cease to exist, and your script will reappear where it was before. Note that the script will contain any changes you made while it was mounted, in this case the addition of the ConvertToRGB line. If you no longer need it, you can delete the entire line, or simply place a single # at the beginning to comment it out, at which point it will be ignored by Avisynth.

     That about does it! We've covered everything I can think to cover; you've got your video going into the script, passing through the deinterlacer, getting cropped and resized, and with this last bit you've got it in whatever application you like to use for video work. The only thing left is a note or two on problem solving.