Introduction to AVISynth
If you've been around this site's guides or forums, or even some video
descriptions, you've probably heard of AVISynth, sometimes just abbreviated
as AVS. AVISynth is one of the most powerful tools for manipulating
digital video that you can find - even more powerful than VirtualDub
for manipulating footage (although AVISynth can't capture like VDub)
and its ability to edit together footage matches that of programs like
Windows Movie Maker. What's the downside? Well it's a little difficult
to use for some people.
Making AVISynth Files
When you've done that you then rename this blank file to blahblah.avs, then open it in notepad. I'll name mine "Believe.avs".
Now within this text file I'll put the following lines:
Then I can open the file in Windows Media Player, and presto! The video is now playing back in 320x240 resolution and everyone's back to normal. Neat, huh? So how did I do it?
Well, the first line is basically your "load this file" command. It's actually a filter that creates a stream of video or audio which can be played with but for all practical purposes it's a way of opening the file. This command is specifically made for opening things like MPEGs and other files that aren't AVI files or don't have their own special command.
To load an AVI you'd use AVISource.
After each command you have a pair of parentheses that contain instructions.
In this case, the instruction is the path to a file, which should always
be in quotes.
Then there are custom commands which are things like Version (which
creates a video clip displaying the version number), BlankClip (which
generates, you guessed it, a blank clip of a solid color with silent
audio), and MessageClip (which produces a clip that has a certain message
So now I've got this neat file which plays back Believe in its correct aspect ratio. What else can I do?
Well lets say that, hypothetically, I find that whole beginning part to be really boring. I want action and good editing, not lip-synching! Well, instead of seeking past it everytime I watch the video, I could trim it out! Let's say that the good part starts at frame 1000, or around 33 seconds into the video. I can add the following line to my script:
Trim takes the current stream and trims bits off the ends. It takes two arguments, a start frame, and an end frame. I told it to start at frame 1000 (in other words, trim out everything before that frame) and go until the end of the file - 0 is a special value for the Trim filter which means "the last frame of the clip."
Now when I playback the AVS file in Windows Media Player, the clip is 33 seconds shorter and I don't have to skip through the intro every time I want to watch it.
What if I wanted to open a project file I made with DVD2AVI? AVISynth can't open D2V files natively, so what can I do? Well, you use something called the MPEG2DEC.DLL plugin! MPEG2DEC is a plugin that allows AVISynth to read these files.
If you have installed the AMVapp or if you have Avisynth 2.06 or later installed, then by having the mpeg2dec.dll file in the default plugin directory it will load automatically whenever you use one of its commands. If you are making avisynth scripts the old way then you will have to load the plugin manually using (for example)
If you have the AMVapp installed, you should skip that and just use the command
MPEG2Source is not natively part of AVISynth, but with the plugin you can use it. Note that if you add a loadplugin line for a plugin that has been autoloaded, the script probably won't work ^^;;
The copy of mpeg2dec that is supplied with the AMVapp is probably a little bit different to the one you have used when following the old guides. The AMVapp version is actually mpeg2dec3.dll which includes some very excellent post-processing features.
The advantage of this is that you can use it to clean up your footage intellegently, straight from the source. If you've ever adjusted the quality settings on divx playback or used the post-processing in ffdshow then you will know that these can erally improve a picture quality during the decode.
I highly recommend using the post processing settings either during a render from Premiere using an avisynth source or when creating clips. The new options in the current release are:
So, to enable these options you would use a command like this:
I recommend seeing which cpu value looks best for you, sometimes 6 can smooth too much so I generally use 4. This is a great way to clean up a source with little detail removal.
Another bonus of this version of mpeg2dec is that it seemingly works with both old and new versions of DVD2AVI - which is good because newer versions of dvd2avi have improved support for newer processors such as the P4.