The faq is divided in to five sections:
S1: About AviSynth
S2: AviSynth and frameserving
S3: Filters and colorspaces
S4: Importing filters from VirtualDub
S5: Plugins
Q1: What is AviSynth ?
Q2: Who is developing AviSynth ?
Q3: Where can I download the latest versions of AviSynth
?
Q4: What are the main bugs in these versions ?
Q5: Where can I find documentation about AviSynth
?
Q6: How do I install/uninstall AviSynth ?
Q7: How do I make an AVS-file ?
Q8: Where do I save my AVS-file ?
Q9: How do I know which version number of AviSynth
I have ?
Q10: Does AviSynth have a GUI (graphical user interface)
?
S2: AviSynth and frameserving:
Q11: What is frameserving and what is it good for
?
Q12: How do I use AviSynth as a frameserver ?
Q13: How do I frameserve my AVS-file to encoder/application
X ?
Q14: Problems when Encoder X reads AVS-files ?
Q15: When frameserving I got the following message:
"Script error, there is no function named "xxx (some filter)"" ?
Q16: When frameserving from Premiere in Virtualdub
or TMPGEnc I got the following message: "IPCSource: wrong server version?"
?
Q17: When frameserving I got the following message:
"Script error, there is no function named "IPCSource"" ?
Q18: I'm using AviSynth to frameserve in Premiere.
When loading the AVS script in AVI2SVCD, the GO button remains grey and
I have this error message in the log: Unknow Avi Header. (IPCS)
Q19: I get an unrecognized exception error trying
to load an avs file with VirtualDub, using dvd2avi v1.77.3 ?
Q20: How do I load my clip into AviSynth (video)
?
Q21: How do I load my clip into AviSynth (audio)
?
Q22: Can I import an audio file other than a WAV-file?
Q23: How do I join video and audio ?
Q24: I loaded a DivX/MPEG file, but the audio seems
lost?
Q25: What are the most important internal filters
of AviSynth ?
Q26: What is RGB/YUV-colorspace ?
Q27: In which colorspaces do AviSynth and the internal
filters work ?
Q28: Where can I download external filters which
work in YUV/RGB-space ?
Q29: How do I convert between the colorspaces ?
Q30: What/when do I care when filter X works in RGB-
or YUV-space ?
Q31: I tried to use the Dissolve filter, but it doesn't
seem to work ?
Q32: Is there a fade in/out filter ?
S4: Importing filters from VirtualDub:
Q33: Where can I download the latest version of scripts
which import filters from VirtualDub ?
Q34: Which filters are imported ?
Q35: Do these scripts work in RGB-space or in YUV-space
?
Q36: How do I make such a script ?
Q37: Which plugins are available and where do I get
them ?
Q38: How do I load a plugin in to AviSynth ?
Q39: What is mpeg2dec.dll and where can I find the
newest version ?
Q40: How do I use the "SpatialSoftenMMX" plugin ?
Q41: When i try to use SpatialSoftenMMX, it crashes
in VirtualDub ?
Q42: How do I use and where can I get the "Subtitler"
and "BMP Loader" plugins ?
Q43: Where can I find the Flask/Xmpeg/DVDx and Premiere
plugins ?
Q44: Are the Flask and Premiere plugins different
?
A: AviSynth (AVI SYNTHesizer) is a frameserver. An excellent discription is given on Lukes homepage http://www.lukesvideo.com/avisynth.html.
AviSynth is a very useful utility created by Ben Rudiak-Gould. It provides many options for joining and filtering videos. What makes AviSynth unique is the fact that it is not a stand-alone program that produces output files. Instead, AviSynth acts as the "middle man" between your videos and video applications.
Basically, AviSynth works like this: First, you create a simple text document with special commands, called a script. These commands make references to one or more videos and the filters you wish to run on them. Then, you run a video application, such as VirtualDub, and open the script file. This is when AviSynth takes action. It opens the videos you referenced in the script, runs the specified filters, and feeds the output to video application. The application, however, is not aware that AviSynth is working in the background. Instead, the application thinks that it is directly opening a filtered AVI file that resides on your hard drive.
There are five main reasons why you would want to use AviSynth:
Q2: Who is developing AviSynth ?
A: AviSynth (up to v1.0b) is developed by Ben Rudiak-Gould, see http://math.berkeley.edu/~benrg/avisynth.html. Ben stopped developing and Edwin van Eggelen continued, see http://www.videotools.net/uk/download.php. His latest release is version v1.0b6 which can be found on Edwins homepage given above.
Some versions appeared on the AviSynth forum, for example v1.0b7a by Divine and v1.0b7d by Dividee.
In the beginning of July 2002 there was a second revision of the sourceforge
project. (In the first
sourceforge project didn't happen much.) The most recent version
is v2.0.6, but
more recent weekly builds can be found here.
For
documentation have a look at Q5.
Q3: Where can I download the latest versions of AviSynth ?
A: See Q2. It is also contained in the DVD2SVCD package
and on the download page of Doom (these might be not be the newest versions
of AviSynth).
Q4: What are the main bugs in these versions ?
A: The latest versions:
v1.0b5: Dissolve doesn't work, BicubicResize doesn't work properly.
v1.0b6: ?
v1.0b7a/v1.0b7d: Dissolve doesn't work.
v2.01: ?
v2.02: Layer and MergeChroma don't work.
v2.05: Loop doesn't work when loading a clip without sound.
other bugs can be found in the documentation on the project page, see
Q5.
Q5: Where can I find documentation about AviSynth ?
A: Documentation about the filters of AviSynth can be found on this
site http://www.avisynth.org/, and
also on the filters page. For a tutorial on
avisynth scripting, have a look at this site.
(Some additional info can be found here.)
You
should read these documents before posting to the forum (but it's OK
to post if you have trouble understanding them).
Q6: How do I install/uninstall AviSynth ?
A: In v2.05 or older versions: move avisynth.dll to your system/system32 directory and run install.reg. For autoplugin loading see Q38. Rebooting is not necessary. Make sure you have no other versions of AviSynth floating around on your harddisc, because there is a change that one of those versions will be registered. Remove them if necessary. For uninstalling AviSynth, run uninstall.reg and remove avisynth.dll from your system/system32 directory.
Starting from v2.06 AviSynth comes with an auto installer. Also in
this case make sure you have no other versions of AviSynth floating around
on your harddisc, because there is a change that one of those versions
will be registered. Remove them if necessary. For uninstalling AviSynth
go to "program", "AviSynth 2" and select "Uninstall AviSynth".
Q7: How do I make an AVS-file ?
A: See Q9 (thus using the text editor you prefer).
Q8: Where do I save my AVS-file ?
A: Anywhere on your harddrive.
Q9: How do I know which version number of AviSynth I have ?
A: Open a text-editor, for example notepad. At the following line
and save the file with the extension "avs". Save for example as version.avs
(make sure that the extension is "avs" and not "txt"). Open the file in
an application which can read AVI-files, for example WMP 6.4. The version
number will be displayed.
Q10: Does AviSynth have a GUI (graphical user interface) ?
A: Two nice tools are available:
The first tool (a modification of VirtualDub with OGM and AC3/MP3/MPEG2
support) VirtualDubMod:
It is merged from VirtualDubAVS (Belgabor), VirtualDubMpg2 (Pulco-Citron)
and VirtualDubOGM (Suiryc) (based on VirtualDub v1.4.11). Regarding to
AviSynth the following utilities are added:
S2: AviSynth and frameserving:
Q11: What is frameserving and what is it good for ?
A: An excellent discription is found on Lukes homepage http://www.lukesvideo.com/frameserving.html.
Frameserving is a process by which you directly transfer video data from one program on your computer to another. No intermediate or temporary files are created. The program that opens the source file(s) and outputs the video data is called the frameserver. The program that receives the data could be any type of video application.
There are two main reasons that you would want to frameserve a video:
Furthermore, because the video application is being fed the source
video one frame at a time, it doesn't know anything about the file size
of the source video. Therefore, if your application has 2 GB or 4 GB limit
on input file size, it won't have any effect on your frameserved video.
You could feed 100 GB of video via a frameserver to an application limited
to 2 GB and it wouldn't cause a problem.
Q12: How do I use AviSynth as a frameserver ?
A: Write a script using a text editor. Load your clip (see Q20)
in AviSynth, do the necessary filtering and load the AVS-file in encoder/application
X (must be an encoder or application which can read AVI-files, see Q13
and Q14).
Q13: How do I frameserve my AVS-file to encoder/application X ?
A:
A:
Use CCE SP v2.50 and WMP6.4 (under "Program Files" and "Windows Media Player" you will find a file called "mplayer2.exe", this is WMP6.4). In case that you want to use Windows Media Encoder you can use the AVI Wrapper instead which can be downloaded from http://www.videotools.net/uk/download.php.
If you still want to use CCE SP v2.62 you can try the following:
Frameserve to CCE SP v2.62 with VFAPI. Create an AVS script and then
make a fake AVI with VFAPI (VFAPI v1.04 accepts AVS-files and can be downloaded
from Dooms site).
If you have such problems have a look at the thread (and the suggested solutions) colorspace conversion errors.
A: You probably installed/registered a version of AviSynth which doesn't
contain the filter. Make sure that there are no other versions floating
around on your hard disc (there's a possibility that a version will be
registered while it is not in your system directory). Check that
the right version is registered, see also Q6.
Q16: When frameserving from Premiere in Virtualdub or TMPGEnc I got the following message: "IPCSource: wrong server version?" ?
A: You probably used an AviSynth version which is not compatible with
the plugin. See also Q43.
Q17: When frameserving I got the following message: "Script error, there is no function named "IPCSource"" ?
A: You probably used AviSynth v1.0b6. In this version the IPCSource
is removed and put into a different dll (in avisynthEx.dll). Get
this plugin or use another version of AviSynth.
Q18: I'm using AviSynth to frameserve in Premiere. When loading the AVS script in AVI2SVCD, the GO button remains grey and I have this error message in the log: Unknow Avi Header. (IPCS)
A: No frame serving AVI-files will work with DVD2SVCD, except in and
later versions of DVD2SVCD 1.0.9b2 where you can use Edwins Link2
program (that is an AVIWRAPPER).
Q19: I get an unrecognized exception error trying to load an avs file with VirtualDub, using dvd2avi v1.77.3 ?
A: .d2v created with dvd2avi v1.77.3 is NOT compatible with mpeg2dec.dll!
Use v 1.76 instead. If you still want to use v1.77.3 have a look
at this thread.
Q20: How do I load my clip into AviSynth (video) ?
A: Make a script containing the lines (replace the filename and the
path of the filename):
or download the MPEGdecoder
(by Nic) and make the following script (no audio support yet):
LoadPlugin("d:\MPEGdecoder.dll")
mpeg2source("d:\filename.m2p")
If you still want to import a tpr-file into an AVS-file, there are two possibilities:
first one: The TMPGEnc plugin is contained in the VFAPI Plugin zip file
(ends with -vfp.zip) which can be download from Dooms site. (This method
doesn't always work, some encoders like CCE SP can't read them.)
LoadVFAPIplugin("d:\TMPGenc.vfp","TMPGsource")
TMPGsource("d:\filename.tpr")
FlipVertical
second one: Import the tpr-file in VFAPI, create a fake avi and then
load it into AviSynth (note that VFAPI works in RGB-space). See also http://forum.doom9.org/showthread.php?s=&threadid=10007.
A: Make an AVS-file containing the line (change the filename and path):
WavSource("d:\filename.wav")
Q22: Can I import an audio file other than a WAV-file?
A: No (not yet), but ... Only uncompressed audio files (that is uncompressed WAV-files) can be loaded in all versions up to v2.03. Starting from v2.04 compressed WAV-files can be loaded (currently only MP3-files with a WAV-container). Starting from v2.05 you can extract audio from a AVI-file in this way:
WavSource("d:\filename.avi")
Q23: How do I join video and audio ?
A: Make an avs-file containing the lines (change the filenames and paths):
video = AviSource("d:\filename1.avi")
audio = WavSource("d:\filename2.wav")
AudioDub(video, audio)
Q24: I loaded a DivX/MPEG file, but the audio seems lost?
A: You probably used v2.03 or older. A DivX/MPEG file doesn't
contain uncompressed audio. If you want to load a clip with audio
you have to convert the audio to uncompressed WAV (for example in VirtualDub/Nandub),
or in case you want to load an AVI with MP3 you can use v2.04 or more recent
versions instead.
Q25: What are the most important internal filters of AviSynth ?
A: The internal filters are explained in the documentation, see also
Q5.
Q26: What is RGB/YUV-colorspace ?
A: A nice explanation is given in YUV
Formats and RGB Formats
and another explanation can be found here MSDN
YUV Formats.
Q27: In which colorspaces do AviSynth and the internal filters work ?
A: AviSynth works in RGB and in YUV colorspace, also most of the internal filters work in both spaces. However the following internal filters work only in YUV space:
As of Avisynth v2, the SpatialSoften,
TemporalSoften,
Tweak,
PeculiarBlend,
FixLuminance,
FixBrokenChromaUpsampling,
MergeChroma
and MergeLuma filters work only with YUY2
input and Mask and ResetMask
only with RGB32 input. You can use the ConvertToYUY2
filter if your input is not in YUY2 format (see also Q29).
Q28: Where can I download external filters which work in YUV/RGB-space ?
A: Most of the plugins that you can download work in YUV-space. See also Q38 for importing scripts. A selection:
Deinterlacing & Pulldown Removal:
Misc Plugins:
A: Converting to YUY2:
and for converting to RGB:
Note that converting between colorspaces isn't completely lossless,
and doing several conversions back and forth may degrade your signal. The
first conversion back and forth does not hurt your source, but if you use
three or more, it may. Starting with version v2.03, there is a ConvertBackToYUY2
which offers better symmetry if your RGB source was previously converted
from YUY2.
Q30: What/when do I care when filter X works in RGB- or YUV-space ?
A: The main reason why you should care is the improvement in speed you can obtain by not unnecessarily changing between colorspaces. If your source is YUV (when encoding DVD's for example, or captures from digital sources) try to use only filters/plugins which work in YUV-space. On the other hand if your source is in RGB (for example from analog captures) try to use only filters/plugins which work in RGB-space.
Speed is also quite different between the different colorspaces, because each colorspace takes up different amounts of memory. The slowest colorspace is usually RGB24, because every pixel has an odd alignment in memory, avoid using this mode. The fastest mode is usually YUY2, because data only takes up half as much space as RGB32. So if you have to process your video a lot, try using ConvertToYUY2 before you do your filtering. Note that ConvertToRGB converts to RGB32 if the source is YUY2 - use ConvertToRGB32 to force a RGB24 to RGB32 conversion.
You should also consider your destination colorspace. If you plan
on converting to DivX/Xvid/Huffyuv in VirtualDub without applying filters
in VirtualDub, "Fast Recompress" will deliver the YUY-data directly to
the codec, saving you another colorspace conversion. On the other
hand, if you plan using TMPGEnc or VirtualDub in "Full Processing" mode,
you may consider delivering the source as RGB.
Q31: I tried to use the Dissolve filter, but it doesn't seem to work ?
A: The Dissolve filter doesn't work
in v1.0b5. Upgrade to v1.0b6 or v2, see also Q2
and Q3.
Q32: Is there a fade in/out filter ?
A: There is only a fade out filter called "FadeOut"/"FadeOut2". Starting from v2.07 there are also FadeIn filters: FadeIn/FadeIn2. If you are using an older version, there are two ways to make a FadeIn filter:
The first way (using the Dissolve filter, the Blackness filter and the FadeOut2 filter) is described on the FadeOut page. The second way (using the FadeOut2 filter and the Reverse filter):
Reverse(FadeOut2(Reverse(clip),
n))
S4: Importing filters from VirtualDub:
Q33: Where can I download the latest version of scripts which import filters from VirtualDub ?
A: The AviSynth scripts are on the ShareFunctions page, or you can download
a package called vdub_filtersv15.zip from http://forum.doom9.org/showthread.php?s=&threadid=23804
or http://shelob.mordor.net/dgraft/hosted.html.
Q34: Which filters are imported ?
A: Most filters. Read the corresponding documentation.
Q35: Do these scripts work in RGB-space or in YUV-space ?
A: Only in RGB-space.
Q36: How do I make such a script ?
A: Example script (this VirtualDub filter can be downloaded from Donalds homepage):
Smart Bob by Donald Graft:
function VD_SmartBob(clip clip, bool "show_motion", int
"threshold", bool "motion_map_denoising")
LoadVirtualdubPlugin("d:\bob.vdf", "_VD_SmartBob", 1)
return clip.SeparateFields._VD_SmartBob(clip.GetParity?1:0,
\ default(show_motion, false)?1:0, default(threshold,
10),
\ default(motion_map_denoising, true)?1:0)
}
The VirtualDub plugin is imported with the command "LoadVirtualdubPlugin". The first argument gives the path of the plugin, the second argument the name for the plugin that will be used in the script and the third argument is called the preroll.
The preroll should be set to at least the number of frames the filter needs to pre-process to fill its buffers and/or updates its internal variables. This last argument is used in some filters like: SmartBob, SmartDeinterlace, TemporalCleaner and others. The reason is that due to filtering architecture of Virtual Dub the future frames can't be accessed by a filter. Dividee reports: "In the "Add filter" dialog of VirtualDub, some filters have a "Lag:" value in their description. I think this is the value that must be used as preroll. Unfortunately, this indication is not always present. In those cases you have to guess." Of course you can always ask the creator of the filter.
The first step is to find out the sequence of the arguments in the last line where the clip is returned. Configure the script in VirtualDub and select "Save processing Settings" in the File Menu or press Ctrl+S. Open the created .vcf file with a text editor and you should see lines like this:
VirtualDub.video.filters.Add("smart bob (1.1 beta 2)");
VirtualDub.video.filters.instance[0].Config(1, 0, 10, 1);
The order of the arguments is the one that has to be used in AviSynth. To find the role of the arguments, play with them in VirtualDub and examine the resulting lines.
The second step is to test the filter and to compare it with the VirtualDub filter itself. For the programming itself you can learn a lot by looking at the script which are already contained in vdub_filters.avs.
Example script which uses the function VD_SmartBob:
Import("d:\vdub_filters.avs")
AviSource("d:\filename.avi")
ConvertToRGB32 # only
when necessary (but doesn't hurt)
VD_SmartBob(1, 0, 10, 1)
ConvertBackToYUY2 # only when
necessary
Q37: Which plugins are available and where do I get them ?
A: See Q28.
Q38: How do I load a plugin in to AviSynth ?
A: Use "LoadPlugin". An example script:
LoadPlugin("d:\mpeg2dec.dll")
mpeg2source("d:\filename.d2v")
ResampleAudio(44100)
# Add ResampleAudio if you use CCE 2.50 and you experience CCE SP crashes.
Starting from v2.05 you can use its auto-plugin loading future. Open notepad and type the following:
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Avisynth]
"PluginDir"="c:\\program files\\avisynth\\plugins"
Change the path above if necessary and make sure you created the plugin-dir
as well. Save it as install_autoplugin.reg, and merge it to your
registry file by right-clicking on it in your explorer. Finally move
all your plugins/script-functions into the plugin directory. Those
plugins should override the internal filters. Starting from v2.06
AviSynth comes with an installer, so there's no need to mess around with
registry files.
Q39: What are mpeg2dec.dll/mpeg2dec2.dll/mpeg2dec3.dll and where can I find those plugins ?
A: mpeg2dec.dll/mpeg2dec2.dll/mpeg2dec3.dll are plugins (if you experiences crashes try the second which is more robust) which enable AviSynth to import MPEG2 files. Mpeg2source returns the frames in YUV format.
mpeg2dec.dll is available (including some filters) at Dividees homepage, mpeg2dec2.dll is available at trbarry homepage and Marc FD's plugin mpeg2dec3.dll is available at http://forum.doom9.org/showthread.php?s=&threadid=34253&pagenumber=2.
The main difference is that mpeg2dec2.dll is more rubust than mpeg2dec.dll,
and mpeg2dec3.dll (which is based on Dividees mpeg2dec.dll) contains Nics
post processing (like deblocking and deringing).
Q40: How do I use the SpatialSoftenMMX plugin ?
A: The plugin can be downloaded from Dividees
homepage, see read the news on 18/08. For an explanation of this
plugin, look here.
Q41: When i try to use SpatialSoftenMMX, it crashes in VirtualDub ?
A: You probably used this filter before resizing. Apperently SpatialSoftenMMX
doesn't like resolutions that cannot be divided by 8 or 16. So if
you use it after resizing it works, of course.
Q42: How do I use and where can I get the "Subtitler" and "BMP Loader" plugins ?
A: These dll files are created by DVD2SVCD and only DVD2SVCD is using
them. But you can also use them in AviSynth, look here.
Q43: Where can I find the Flask/Xmpeg/DVDx and Premiere plugins ?
A: You can find them on Edwins homepage, download the package "Premiere Video Server Plugin v0.93+client dll". This package contains the Flask and Premiere plugins. In the readme.txt file of the package you will see how to use the Flask plugin in XMPEG and DVDx.
See http://nickyguides.digital-digest.com/frameserve-flask.htm or http://www.vcdhelp.com/premiereavisynth.htm how to use AviSynth as frameserver between Flask/Premiere and TMPGEnc, CCE SP, VirtualDub, WMP6.4. This guide explains the frameserving using "Avisynth 1.0beta31 + plugin 0.28beta 37". This can also be done, but if you want to use a new version of AviSynth I suggest to use the "Video Server Plugin" instead.
For frameserving avisynth to other programs such as Premiere, Ulead
etc, see Q13
Q44: Are the Flask and Premiere plugins different ?
A: Yes, Flask does not support random access while adobe Premiere does.