First script

From Avisynth wiki
Revision as of 15:54, 19 September 2015 by Reel.Deal (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

After downloading and installing AviSynth, let's run the most basic of AviSynth scripts:

Version()

Type the above in your text editor and save it as "version.avs".

You now have a script that can be opened by most AVI players in your machine: Windows Media Player 6.4 (or higher) will play it; so will Media Player Classic, VirtualDub, VirtualDubMod and many others (see this list of AviSynth compatible programs on Wikipedia). This is done through the magic of frameserving.

So far as these programs care, your text document is an AVI file.

You should see a small video message like this:

Avisynth Version() filter output, version 2.60


Is this what you see? If not, you may have an incompatible codec on your system; try a different player from the list above; if that fails, PANIC! Just kidding, don't panic; instead, drop a post in the Doom Nine Forums.


Now that we have our frameserver working, let's open an actual video file:

AviSource("c:\folder\myclip.avi")

Type the above in your text editor (replacing "c:\folder\myclip.avi" with the full path to an AVI file on your machine), and save it as "myclip.avs". Open it as before; you should see your AVI video playing - assuming the file uses a codec compatible with AviSource. If not, try another AVI, or proceed to the DirectShowSource example below.

There are several different source types, and each means something unique. For instance, you cannot open an MPEG file with AviSource because it's not an AVI file. For MPEG files you could use DirectShowSource, like this:

DirectShowSource("c:\folder\myclip.mpg", fps=25)

DirectShowSource has its own issues, as explained on its documentation page, but for this simple example, it should be very adequate. For more advanced scripts it would be better to use DGDecode for importing MPEG files.

See AviSource, DirectShowSource for more detailed information.

There are many more Source filters available: see Category:Source_filters


Once you get the hang of using a frameserver, it's time to do something more interesting than just spit out the same old video!

AviSource(<any AVI file>)
Subtitle("Hello World!", size=56, align=5)
DirectShowSource(<any video file>)
FlipVertical
DirectShowSource(<any video file>)
Tweak(sat=0)

More examples can be found here: Script examples.

For more, introduce yourself to Filters or return to New to AviSynth - start here.

Personal tools