First script

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (compatible programs - updated)
(expanded tutorial; add image + examples)
Line 1: Line 1:
First [[Main_Page#Official_builds|download]] and install AviSynth . Let's start with the most basic of AviSynth scripts:
+
After [[Main_Page#Official_builds|downloading]] and installing AviSynth, let's run the most basic of AviSynth scripts:
  
  AviSource("c:\folder\myclip.avi")
+
  Version()
  
Open up any text editor, type the above on the first line (using any AVI file on your machine as "myclip.avi"), and save it as "myclip''.avs''". You now have a script that can be opened by most AVI players in your machine: [[wikipedia:Windows_Media_Player|Windows Media Player]] 6.4 (or higher) will play the script; so will [[wikipedia:Media_Player_Classic|Media Player Classic]], [[VirtualDub]], [[VirtualDubMod]] and [[wikipedia:AviSynth#AviSynth_compatible_programs|many others]]. ''So far as they care, your text document ''is'' an AVI file.''
+
Type the above in your text editor and save it as "version'''.avs'''".  
  
An even simpler script would be
+
You now have a ''script'' that can be opened by most AVI players in your machine: [[wikipedia:Windows_Media_Player|Windows Media Player]] 6.4 (or higher) will play it; so will [[wikipedia:Media_Player_Classic|Media Player Classic]], [[VirtualDub]], [[VirtualDubMod]] and many others (see this [[wikipedia:AviSynth#AviSynth_compatible_programs|list of AviSynth compatible programs]] on Wikipedia). This is done through the magic of  [[frameserver|frameserving]].
  
Version()
+
:''So far as these programs care, your text document ''is'' an AVI file.''
  
Which just displays the current version of avisynth.
+
You should see a small video message like this:
  
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]], so you would write:
+
:[[File:Avisyn-version-260.png|Avisynth Version() filter output, version 2.60]]
  
DirectShowSource("c:\folder\myclip.mpg", fps=25)
 
  
But it would be better to use [[DGDecode]] for importing MPEG files.
+
Is this what you see? If not, you may have an [[wikipedia:DirectShow#Codec_hell|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 [http://forum.doom9.org/forumdisplay.php?s=&forumid=33 Doom Nine Forums].
  
This process is explained in greater detail in these pages: [[AviSource|AVISource]], [[DirectShowSource]], [[AviSource|AviFileSource]], [[AviSource|OpenDmlSource]]
 
  
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! To begin, [[Filter introduction|introduce yourself to filters]] or head straight to the [[Internal filters|AviSynth manual]] itself.
+
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 <tt>"c:\folder\myclip.avi"</tt> 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 [[DirectShowSource|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]].
 
More examples can be found here: [[Script examples]].
 +
 +
For more, [[Filter introduction|introduce yourself to filters]] or head straight to the [[Internal filters|AviSynth manual]].
  
 
[[Category:AviSynth_Usage]]
 
[[Category:AviSynth_Usage]]

Revision as of 16:00, 20 September 2014

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 head straight to the AviSynth manual.

Personal tools