III – Basic AVISynth Script Anatomy

Once AVISynth and its plugins are installed, it is called by creating an .avs script. Its a simple text file. You put it in the same directory as the video you’d like to filter, and you open the .avs file in Virtualdub as if it were a video file. Assuming all is working correctly, Virtualdub will not know the difference!

Included is a sample script, sample.avs. Its all set up to filter my favorite japanimation that I just totally made up, I Heart Explosions! Ryu Fuzaki is on a mission to save the President from ninjas – is he a bad enough dude? Let’s go through the .avs script below and find out.

We are assuming that IHeartExplosions.avi is a YV12 Lagarith file per the previous section.

PLEASE NOTE: Most lines are commented out by default – you’ll want to remove the “#” sign before actual usage!

AVISource("IheartExplosions.avi")

#AnimeIVTC(mode=4, omode=1, killcomb=1)
#SharpAAMCmod(aatype="EEDI2")
#autocrop()
#crop(8,2,-8,-0)
#Spline64Resize(640,480)
#FFT3DFilter(sigma=1.0, plane=4, bw=48, bh=48, bt=5, ow=22, oh=22, sharpen=0, interlaced=false)

  • AVISource (“[your filename here]”)
  • This will USUALLY work with most codecs. If you are dealing with raw DV, you might need to replace this line with DirectShowSource(“[your filename here]”). If you performed the Lagarith conversion from the previous section this will not be an issue.

    This line will never be commented out, as it is the line that actually loads the video file.

  • AnimeIVTC
  • This is an IVTC (Inverse Telecine) filter, made with anime in mind, but it works quite well on live-action footage as well. It is usually the first operation you will want to perform on the captured laserdisc footage, but there are some operations that need to be performed before this (derainbowing and dotcrawl removal, refer to Appendix II for more detail).

    IVTC converts 29.97fps interlaced footage to progressive 24fps footage. In order to accomplish this, it blends a few frames together. These blended frames are mostly only noticeable during panning, as the panning is no longer as smooth as it once was, but the other alternative is to discard frames entirely, which has the same effect.

    Here is an example of a fairly clean frame (mouseover to see the filtering result):

    Here is an example that’s a bit more derpy – the scene is panning to the left (mouseover to see the filtering result).

    I use (and have supplied) a modded version of AnimeIVTC that makes use of a few more modernized plugins. Also, I’ve replaced RemoveGrain and Repair with RgTools. Old documentation is in the Plugins directory (AnimeIVTC.html), but it only covers the old non-modified version. Feel free to experiment, but these are the settings I have had the most consistent best results with.

  • SharpAAMCmod
  • This is actually a function of AnimeIVTC, but I prefer to invoke it separately. In fact, I highly recommend running this particular line all by itself. Why? Because its insanely slow, that’s why! Per AnimeIVTC.html, this filter performs “Line darkening, warp sharpening, edge targeted aa, limited sharpening and temporal stabilizing.” That’s quite a potent combo! I have encountered cases where warpsharpening is a bad idea, but for the majority of laserdisc footage I have ever worked with its been a good thing.

    Here’s what it looks like (mouseover to see the filtering result):

  • autocrop and crop
  • You may have noticed the black bars on the sides of your raw capture, and possibly at the top and bottom. Additionally, IVTC can leave weird moving “sawtooth” artifacts at the very edge of the picture. This is how we get rid of all of that. Don’t use them both at the same time though! Autocrop can give you a rough idea of what crop settings to use, but it isn’t perfect.

    I recommend setting the crop numbers to something low (4, 0, -4, -0) and seeing how it looks. If I still see black bars, I increase the numbers on the affected sides (see next bubble) until I don’t see bars anymore. The numbers have to be multiples of two, or the filter will yell at you.

    The parameter orders are: Left, Top, Right, Bottom. So, in the sample script, I am cropping 8 pixels from the left, 2 from top, and 8 from the right. Please note the right and bottom are NEGATIVE numbers, because it wasn’t a confusing enough syntax already, amirite?

    ALWAYS adjust these numbers! No two disks will use the same numbers!

  • Spline64Resize
  • Now that the black bars are gone, this will correct our aspect ratio.

  • FFT3DFilter
  • Our second slowest plugin. This is a spatio-temporal denoiser. The sigma variable is the filter strength. The default is 2.0, but I like to just use 1.0 unless I am dealing with a particularly noisy source. Have a look at http://www.aquilinestudios.org/avsfilters/spatiotemp.html for a nice demonstration.

    We are mostly using it here to improve compressability – just because you can’t see noise doesn’t mean your computer can’t!

    The bt=5 parameter dictates the rigor of the temporal aspect of the filter. At this, the maximum bt setting, the filter compares the current frame to the two frames before it and the two frames after it. You could turn this number down for speed, but your results won’t be as good (so don’t).

    There are other filters we can introduce. However, adding random or unnecessary filters is not a good practice. If you discover other problems somewhere during the filtering process, you may want to refer to Appendix II to see what you can do about them. Some of these problems include:

  • Jittery footage
  • “Rainbowing”
  • Overly-dark footage / crushed black
  • Video dropouts and static
  • Return to index

    Comments (0)

    › No comments yet.