Introduction
Notes:
•
This guide and the file downloads are for Windows 32bit and 64bit systems running later than Windows XP. Be
aware though that AVISynth functionality on 32bit is limited due to the lack of some filters/plugins and also reduced
available system memory.
•
Following this will guide install AVISynth+. All references in this guide to “AVISynth” mean “AVISynth+”. There are
other versions of AVISynth. It will also guide you to installing a collection of common AVISynth plugins/filters,
including all the files for QTGMC, the high-quality deinterlacer.
•
Due to the need to manually add files to some folders in the Program files (x86) folder and Windows folders, you
will need to be logged on to Windows as an Administrator.
•
Some of this process may require access to the full Windows right-click menu. There is a link at the bottom of the
modern RC menu that will take you to the old-style complete menu.
•
I take this opportunity to thank @Cholla from VideoHelp for their assistance in preparing this page.
Caution
This guide requires pasting four files into Windows system folders. Please exercise care to prevent deletions of
Windows files. You follow this procedure at your own risk.
Why this guide?
I’ve written this guide and created the downloads because I found that the majority of the difficulty in AVISynth and
QTGMC is actually setting it all up. Arcane resources, located in cryptic folders such as CLANG and MSVC, make life
a misery. But when it’s all set up, provided you’re happy with a bit of texting to make up your AVISynth (AVS) scripts, it
is reasonably straightforward to use and the results can be astounding. The trick comes in knowing what plugins/code
to use, but at least when it is set up, you can concentrate on the usage part instead of sweating, grumbling and
possibly losing interest over what is, where is and/or how to make, an AVSI or a DLL that is reported to be missing.
What is AVISynth?
AVISynth is a video processing environment which operates by using a script file system (.AVS files), also called a
“frame server” because it “serves” the video, after being processed, to the program that has opened the AVS file. At
this point, the video hasn’t been rendered or encoded. That will only occur when you do a Save action. The script files
are opened in third-party programs such as Virtual Dub which display the filtered video which can then be edited
further and/or exported in your desired format.
QTGMC is arguably the best deinterlacer around.
QTGMC is a taxing process on your computer; on slower machines it may take a long time to encode videos.
While this guide will get you going with the very basics of AVISynth and QTGMC, I would urge you to consult the
AVISynth and QTGMC wikis to broaden your knowledge of how they work, in particular the various settings for each
filter. While I use the basic QTGMC (preset=”fast”) filter here, QTGMC actually has many sub-settings which are put in
the brackets. For example, a QTGMC line could be:
QTGMC (preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2,
sharpness=0.1)
AVISynth Components
There are three components to AVISynth:
•
The program files themselves, which are installed into the Program Files (x86) folder on your system drive using
the installation file;
•
The various plugins/filter files, sometimes called dependencies, which go into the plugins folders in the AVISynth
parent folder in the Program Files (x86) folder;
•
AVISynth scripts, created by you, which are opened in various programs such as Virtual Dub, and which produce
the results of the filters you’ve added to the scripts.
The installation is very simple. The main hassle with AVISynth is getting all the plugins/dependencies set up. I have
made that easy by including all the common dependencies in a ZIP folder.
Bitness 32/64
One confusing aspect of using AVISynth is the plethora of 32 or 64 bit versions and plugins/filters. In a nutshell:
•
AVISynth+ will run in 32bit or 64bit environments; the same install file works with both.
•
A 32bit computer will not run 64bit programs meaning, for example, that VDub2 64bit will not run on a 32bit
computer. However, 32bit programs will run on a Win64bit computer.
•
In most cases, there are separate 32bit and 64bit versions of plugins, hence the 2 separate plugins folders.
•
The program that opens the AVS script determines what bitness is used. For example, if you open an AVS script in
Virtual Dub 2 32bit, AVISynth+ will access the 32bit plugins. If you open an AVS in VDub2 64bit, AVISynth+ will
access the 64bit plugins.
•
Which to use? Some plugins are 32bit only, and some are 64bit only. If there is a particular plugin you need to use,
you will have to open the file in the appropriate bitness (32bit or 64bit) program. That said, in my experience, every
script I have run has opened OK in 64bit. In other words, all the plugins I’ve needed have been available in 64bit.
Be aware though that there are plugins/filters that only exist in 32bit form.
•
A 64bit workflow will mean that much more memory is available. I have had occasions where, with 32bit VDub2, I
have had memory halts with QTGMC when combined with other plugins. On 64bit VDub2, I have had no such
issues.
Installation
Downloads
Download these files:
AVISynth Plus
https://github.com/AviSynth/AviSynthPlus/releases/download/v3.7.5/AviSynthPlus_3.7.5_20250420_vcredist.exe
QTGMC files and other Plugin/Filter files
This zip file (53MB) contains all the plugin/filter files you’ll need to set up and run QTGMC and various other common
filters. It is your responsibility to keep them updated or to add other plugins as required by your scripts.
AVISynth Plugins Package 20241105
Download this zip file to a suitable location; it doesn’t matter where, as long as you can find it later.
Files Set up
AVISynth Program File
Note: If you already have AVISynth+ installed, this installer will simply overwrite the current installation. All your plugins
folders will remain intact.
Run (DC) the AVISynth+ exe file to install AVISynth+.
You will get warnings from Windows about the apparent dodginess of the EXE file. Ignore. Click on More Info, then
Install and Install.
AVISynth installs on your system drive into the “Program Files(x86)” folder. The AVISynth+ main folder has the two “+”
plugins folders. “plugins+” and “plugins64+”. This is what a standard installation looks like on the system drive. There
may be “non plus” plugins folders as well, but we won’t be using those.
Plugins Folders
Locate the downloaded Plugins Package ZIP file, RC on it and choose Extract All… and click Extract…. A folder will
open, containing the various plugins folders.
Note: the plugins included here are only the common ones I have collected. There are hundreds of others that
are available, having all sorts of functions/effects. If a script tries to use (“call”) a plugin that isn’t installed, you’ll
get an error message describing what is missing, which should be enough to find details on it on the AVISynth
Wiki homepage on the web, or just do a search for “AVISynth Santiag”, for example.
Assuming Windows is installed on the C: drive:
32bit Windows
1. Copy the two files in folder 1 to your C:\Windows\System32 folder
2. Copy all the files in folder 4 to your C:\Program Files (x86)\AviSynth+\plugins+ folder.
64bit Windows
1. Copy the two files in folder 2 into your C:\Windows\System32 folder.
2. Copy the two files in folder 3 into your C:\Windows\SysWOW64 folder.
3. Copy all the files in folder 4 into your C:\Program Files (x86)\AviSynth+\plugins+ folder.
4. Copy all the files in folder 5 into your C:\Program Files (x86)\AviSynth+\plugins64+ folder.
FFTW Library files
If you’ve done the above correctly, skip this section.
Probably the most confusing aspect of setting up, especially for QTGMC, is the bitness of the FFTW3.DLL and
libfftw3f-3.dll files and where they reside.
The 32bit versions are 2336KB and must be in the C:\Windows\SysWOW64 folder.
The 64bit versions are 2708KB and must be in the C:\Windows\System32 folder.
Yes, those locations do seem the wrong way round but they are correct. If you’re so inclined, here’s the explanation.
Here are the FFTW files (they are also included the above package). Download and unpack the zip to get access.
Annoyingly, both versions have the same name, hence the reason I’ve given the file sizes so you can work out which
one is which.
Those of you with an attention to detail will observe that the two files appear to be exactly the same. That’s because
they are! By some twisted logic, libfftw3f-3 is simply a renamed fttw3.
Dependencies
As you have probably cottoned-on-to, some filters/plugins for AVISynth rely many other plugins which you may not
actually use in a script. QTGMC is a good example. While in the script we will only use “QTGMC”, there are many
other “hidden” plugins required to make it actually work. They are in folders “4” and “5” of my install process above.
So, if you are trying to use a filter and get error messages, go onto the AVISynth site and search for the filter
description. The documentarian will show the required dependencies, which you will probably have to download
separately and place into your plugins folder to make the filter work.
Virtual Dub Setup
Set up Virtual Dub, as per my instructions here. VDub is used to open, or display, the AVISynth AVS scripts that you
create. Other programs can also open AVS files, including advanced AVISynth programs such as AVSPMod and some
media players such as Media Player Classic.
VDub allows you to edit the AVS on the fly to adjust your AVISynth output. You can then perform further operations
such as editing/trimming, cropping, resizing, and export to MP4 all from VDub. Or you can Losslessly export the video
so that it can be edited further in a more fully-featured video editor.
Updating AVISynth
AVISynth is updated occasionally. To update your installation, the recommended procedure is to simply replace the
avisynth.DLL with the new version as opposed to reinstalling. This VH post refers.
Using AVISynth
You don’t actually open AVISynth as a program. What you do is create a script (an AVS file), and when you open that
script in VDub, the script will use the parts of the AVISynth installation and plugins it needs to process, as per the
filters you set up (such as QTGMC) and then display your filtered file in VDub. You can then do further editing or save
it into another format for further editing in an external editor, or for distribution in, for example, MP4.
For example, my typical workflow for a VHS capture is:
•
Capture with AmarecTV,
•
Create an AVISynth script with the captured AVI file (as I show below) to deinterlace with QTGMC,
•
Open that AVS file in VDub and apply other filters such as basic cropping, resizing, colour and level adjustments,
•
“Save As…” the video into AVI format,
•
Import that AVI into my video editor for titling, fades, further cropping and editing and exporting to my final format
such as MP4.
Typical AVISynth+ script to run QTGMC
A “script” is actually just a plain text document, written with Notepad, but saved with the AVS file extension instead of
TXT.
A typical AVISynth script which uses QTGMC to deinterlace an AVI video and double the framerate follows, with
explanatory comments following.
SetFilterMTMode ("QTGMC", 2)
AviSource("H:\racwa\aeroclub-int.avi")
ConvertToYV12(interlaced=true)
AssumeTFF()
QTGMC(preset="Fast", EdiThreads=8) # set EdiThreads to half the system cores you have
Prefetch(24) # set to the number of Logical Processors in your CPU
Explaining the various parts:
SetFilterMTMode ("QTGMC", 2)
Tells AVISynth what multi-threading mode to use.
AviSource("H:\racwa\aeroclub-int.avi")
Tells AVISynth what “source filter” to use to open the file, and it’s location. Always wrap the full name in quotes. If the
AVS file is saved in the same folder as the video file you’re processing, you don’t need the drive and parent folder in
the name.
Tip: use the Windows RC menu “Copy as Path” item to copy the complete file name, then paste it in.
There are other source filters for opening other types of files eg MPEGs, MOVs, MP4s. For example, you cannot use
“AVISource” to open an MP4. Other source filters are shown lower down this page.
ConvertToYV16(interlaced=true)
Converts file to the required colour space.
AssumeTFF()
Tells QTGMC what the interlace status of the file is. Almost all analogue captures are Top Field First; DV files from DV
camcorders are almost always Bottom Field First, so if you’re working on DV, use “BFF”. In any case, if you get it
wrong, you’ll notice forward-backward-forward movement when you step through the video frame by frame in VDub.
Simply change to the other option.
QTGMC(preset="Fast", EdiThreads=8)
Tells AVISynth to execute QTGMC using the “fast” preset and to use the extra threads in your CPU to speed up
processing. Set the EdiThreads to half the system cores you have (Task Manager>Performance has the number of
cores in your CPU). QTGMC defaults to double-framerate mode; it splits each field into a frame.
Prefetch(24)
Tells AVISynth to use the available cores in your CPU to speed up the process. Set it to the number of Logical
Processors in your CPU, available from Task Manager. If you have issues, reduce the number progressively.
You then save the script text, using a basic editor such as Notepad, as a text-format file with the AVS file extension.
All that is then necessary is to open the file in Virtual Dub and the result (meaning your original file, after processing by
the script) will be displayed.
Give it a go. Copy the text of the script, paste it into a TXT/Notepad document, change the name of the file to be
opened and save the file as an AVS file.
Here are some sample full-interlaced files for you to experiment with (not all files have full-interlacing; for example,
converting telecined movies to progressive video require different treatment. See my page on Deinterlacing for
details).
AVI
•
f18
•
aeroclub
MPEG 2
•
aircraft MPEG2 (requires a different source-opening filter)
Open your AVS file in VDub and, fingers crossed, you’ll shortly be looking at a crisp, smooth, deinterlaced AVI.
You can now continue editing it, perhaps trimming and deleting parts, and/or exporting it in whatever format you wish
to either continue editing elsewhere or save as an MP4 for distribution.
If you have problems, run the AVISynth Info tool, which will report any issues with your installation.
File-Opening / “Source” Filters
There are many different file types and AVISynth does not have a common source filter which will open them all. To
that end, here is a list of filters that will open most file types.
All of these sources work with 64bit; some don’t work with 32bit.
For files with no audio, the a = and AudioDub(v,a) lines can be commented-out or deleted.
Copy the source filter you need from this page and paste it into the top of your script.
Occasionally, a particular source filter doesn’t open the file properly. For example, the field order might randomly
swap. If you’re having problems with a file not opening as you would expect, try changing the source filter. An example
of this is in this post, and another in this post on VideoHelp..
AVI (32 and 64bit)
AviSource("H:\Video Tapes Albums\Video Album 2 Tape A3\Leroy.avi")
no need for a separate audio source filter.
MP4, AV1 (32 and 64bit)
v=LSMASHVideoSource("F:\Flying\F18\F18 Movie - Fish\Sting of the Hornet.mp4")
a=LSMASHAudioSource("F:\Flying\F18\F18 Movie - Fish\Sting of the Hornet.mp4")
AudioDub(v,a)
MPEG2
FFmpegSource2("F:\Family Videos\2004\birthday.mpg", atrack=-1)
This will extract the first audio track in the file. When saving the video in VDub, very fast encoding into AVI or H264.
MPEG 2 in MKV
aud=ffaudiosource("Filename.mkv",track=-1)
vid=ffvideosource("Filename.mkv", track=-1, seekmode=1,fpsnum=30000,fpsden=1001)
audiodub(vid,aud)
Note TDecimate did not work correctly with ffvideosource on an MKV(AVC)
MPEG 2, VOB (32 and 64bit)
Note: m2ts out of sync 64bit on some files
v=ffms2("boating.mpg")
a=LWLibavAudioSource("boating.mpg")
AudioDub(v,a)
MPEG2 (32 and 64bit) , MKV, MOV, MP4, FFV1 and others
v=LWLibavVideoSource("sample.VOB")
a=LWLibavAudioSource("sample.VOB")
AudioDub(v,a)
Magix NLE will not open the audio in AVIs created from MPEG 2s using this filter.
WMV
From here:
https://forum.videohelp.com/threads/419043-Avisynth-and-WMV-s-keeping-A-V-in-sync#post2782791
WMVs can have variable video and audio framerate causing sync issues. This source filter code mitigates this.
fn = "D:\filename" #without the extension
vfn = fn+".wmv"
afn = fn+".wmv"
a = FFAudioSource(afn).EnsureVBRMP3Sync()
FFVideoSource(vfn, fpsnum=30000, fpsden=1001)
Preroll(60)
AssumeFPS(30000, 1001)
AudioDub(a)
Other file types (this is the least preferable source filter because it may not be frame-accurate)
DirectShowSource("title00.mkv")
AVSIs
Most plugins are in the form of DLLs, but AVSIs are also plugins. They are basically autoload files, meaning they that
run as soon as AVISynth starts.
AVSIs are generally not downloadable as a file. They may be presented on their download page as the actual text
characters, so if you need to find or install an AVSI, copy all of the text given into a Notepad text file and save it, then
change the file extension to AVSI. Ensure you have Windows set to show file extensions.
An example of a “create your own AVSI” for the Chromashift plugin is here. When you click on the link to the AVSI at
top right, all you get is a bunch of text. Simply copy all of that text into a text file, then rename it with the “AVSI”
extension ie ChromaShiftSP.AVSI, and then you will have your AVSI to put in your Plugins folder.
As an alternative, you may find the already-constructed AVSI on Github, Doom9 or other websites. Some common
AVSIs are in the filter folders above.
AVISynth Tricks and Tips
•
On Windows, there should be a RC option for copying the file name “Copy as Path”: very handy when copying
your video’s filename into a script.
•
To quickly access and amend your script in VDub, after you have opened the AVS initially, go Tools>Script Editor.
The script editor box will open so you can edit your script. Then, to run the amended script, click anywhere in the
editor window then hit File>Save and refresh… You can set up keyboard shortcuts for these (I use F12 to open
the AVS, then F5 to run the amended script). This feature is great for quickly assessing adjustments to values.
•
Text case is not important although the convention is to use the case as shown in the AVISynth wiki.
•
To “comment-out” or disable a line of text in the script, place a # symbol at the start of the text you want to
comment-out. The # will also work on text part-way along a line. For example:
Prefetch(24) # use the number of logical processors from Task Manager
means that AVISynth will run “Prefetch(24)” but not run the text “use the number of…”. This is good for putting
comments after the actual code on a line. You’ll see I’ve done this in the sample script for the EdiThreads and
PreFetch.
•
To comment-out a number of lines, at the start of the line to be commented-out put in /*. At the end of the final line
to be commented-out, put */. For example:
/* this is a block comment; we can write a lot here and also comment out multiple lines of code
SubTitle("Hello, World!") - this code won’t be processed because it is in a block comment
*/
A simple way to remember which order the / and * are in is to look at the keys on the numeric keyboard: to start
the comment area, use /* (left to right), to close the comment area, reverse it to */.
•
If you want to wrap your code to the next line instead of having one massive long line of code, insert a space\. This
will allow you to wrap the rest of the code to the next line. I find this is helpful in situations such as subtitles for
Stack arrangements:
Scenarios
After going through all of that, you’ll want to start using AVISynth to actually achieve stuff. I’ve made up a collection of
scenarios which you might come across and where AVISynth excels here:
AVISynth Scenarios
Further Resources
The Videohelp forum has a number of very knowledgeable users of AVISynth. If you have any issues or questions on
the use of the various filters/plugins, I suggest you post a topic there to seek help.
If you have any issues with the setup described here, please send me an email at the address on the home page.
Introduction
Notes:
•
This guide and the file downloads are for
Windows 32bit and 64bit systems running later
than Windows XP. Be aware though that
AVISynth functionality on 32bit is limited due to
the lack of some filters/plugins and also reduced
available system memory.
•
Following this will guide install AVISynth+. All
references in this guide to “AVISynth” mean
“AVISynth+”. There are other versions of
AVISynth. It will also guide you to installing a
collection of common AVISynth plugins/filters,
including all the files for QTGMC, the high-quality
deinterlacer.
•
Due to the need to manually add files to some
folders in the Program files (x86) folder and
Windows folders, you will need to be logged on to
Windows as an Administrator.
•
Some of this process may require access to the
full Windows right-click menu. There is a link at
the bottom of the modern RC menu that will take
you to the old-style complete menu.
•
I take this opportunity to thank @Cholla from
VideoHelp for their assistance in preparing this
page.
Caution
This guide requires pasting four files into Windows
system folders. Please exercise care to prevent
deletions of Windows files. You follow this
procedure at your own risk.
Why this guide?
I’ve written this guide and created the downloads
because I found that the majority of the difficulty in
AVISynth and QTGMC is actually setting it all up.
Arcane resources, located in cryptic folders such as
CLANG and MSVC, make life a misery. But when
it’s all set up, provided you’re happy with a bit of
texting to make up your AVISynth (AVS) scripts, it is
reasonably straightforward to use and the results
can be astounding. The trick comes in knowing
what plugins/code to use, but at least when it is set
up, you can concentrate on the usage part instead
of sweating, grumbling and possibly losing interest
over what is, where is and/or how to make, an AVSI
or a DLL that is reported to be missing.
What is AVISynth?
AVISynth is a video processing environment which
operates by using a script file system (.AVS files),
also called a
“frame server” because it “serves” the video, after
being processed, to the program that has opened
the AVS file. At this point, the video hasn’t been
rendered or encoded. That will only occur when you
do a Save action. The script files are opened in
third-party programs such as Virtual Dub which
display the filtered video which can then be edited
further and/or exported in your desired format.
QTGMC is arguably the best deinterlacer around.
QTGMC is a taxing process on your computer; on
slower machines it may take a long time to encode
videos.
While this guide will get you going with the very
basics of AVISynth and QTGMC, I would urge you
to consult the AVISynth and QTGMC wikis to
broaden your knowledge of how they work, in
particular the various settings for each filter. While I
use the basic QTGMC (preset=”fast”) filter here,
QTGMC actually has many sub-settings which are
put in the brackets. For example, a QTGMC line
could be:
QTGMC (preset="slow", matchpreset="slow",
matchpreset2="slow", sourcematch=3, tr1=2, tr2=1,
NoiseTR=2, sharpness=0.1)
AVISynth Components
There are three components to AVISynth:
•
The program files themselves, which are
installed into the Program Files (x86) folder on
your system drive using the installation file;
•
The various plugins/filter files, sometimes called
dependencies, which go into the plugins folders
in the AVISynth parent folder in the Program
Files (x86) folder;
•
AVISynth scripts, created by you, which are
opened in various programs such as Virtual Dub,
and which produce the results of the filters
you’ve added to the scripts.
The installation is very simple. The main hassle with
AVISynth is getting all the plugins/dependencies set
up. I have made that easy by including all the
common dependencies in a ZIP folder.
Bitness 32/64
One confusing aspect of using AVISynth is the
plethora of 32 or 64 bit versions and plugins/filters.
In a nutshell:
•
AVISynth+ will run in 32bit or 64bit environments;
the same install file works with both.
•
A 32bit computer will not run 64bit programs
meaning, for example, that VDub2 64bit will not
run on a 32bit computer. However, 32bit
programs will run on a Win64bit computer.
•
In most cases, there are separate 32bit and 64bit
versions of plugins, hence the 2 separate plugins
folders.
•
The program that opens the AVS script
determines what bitness is used. For example, if
you open an AVS script in Virtual Dub 2 32bit,
AVISynth+ will access the 32bit plugins. If you
open an AVS in VDub2 64bit, AVISynth+ will
access the 64bit plugins.
•
Which to use? Some plugins are 32bit only, and
some are 64bit only. If there is a particular plugin
you need to use, you will have to open the file in
the appropriate bitness (32bit or 64bit) program.
That said, in my experience, every script I have
run has opened OK in 64bit. In other words, all
the plugins I’ve needed have been available in
64bit. Be aware though that there are
plugins/filters that only exist in 32bit form.
•
A 64bit workflow will mean that much more
memory is available. I have had occasions
where, with 32bit VDub2, I have had memory
halts with QTGMC when combined with other
plugins. On 64bit VDub2, I have had no such
issues.
Installation
Downloads
Download these files:
AVISynth Plus
https://github.com/AviSynth/AviSynthPlus/releases/
download/v3.7.5/AviSynthPlus_3.7.5_20250420_vc
redist.exe
QTGMC files and other Plugin/Filter files
This zip file (53MB) contains all the plugin/filter files
you’ll need to set up and run QTGMC and various
other common filters. It is your responsibility to keep
them updated or to add other plugins as required by
your scripts.
AVISynth Plugins Package 20241105
Download this zip file to a suitable location; it
doesn’t matter where, as long as you can find it
later.
Files Set up
AVISynth Program File
Note: If you already have AVISynth+ installed, this
installer will simply overwrite the current installation.
All your plugins folders will remain intact.
Run (DC) the AVISynth+ exe file to install
AVISynth+.
You will get warnings from Windows about the
apparent dodginess of the EXE file. Ignore. Click on
More Info, then Install and Install.
AVISynth installs on your system drive into the
“Program Files(x86)” folder. The AVISynth+ main
folder has the two “+” plugins folders. “plugins+” and
“plugins64+”. This is what a standard installation
looks like on the system drive. There may be “non
plus” plugins folders as well, but we won’t be using
those.
Plugins Folders
Locate the downloaded Plugins Package ZIP file,
RC on it and choose Extract All… and click
Extract…. A folder will open, containing the various
plugins folders.
Note: the plugins included here are only the
common ones I have collected. There are
hundreds of others that are available, having all
sorts of functions/effects. If a script tries to use
(“call”) a plugin that isn’t installed, you’ll get an
error message describing what is missing,
which should be enough to find details on it on
the AVISynth Wiki homepage on the web, or
just do a search for “AVISynth Santiag”, for
example.
Assuming Windows is installed on the C: drive:
32bit Windows
1. Copy the two files in folder 1 to your
C:\Windows\System32 folder
2. Copy all the files in folder 4 to your C:\Program
Files (x86)\AviSynth+\plugins+ folder.
64bit Windows
1. Copy the two files in folder 2 into your
C:\Windows\System32 folder.
2. Copy the two files in folder 3 into your
C:\Windows\SysWOW64 folder.
3. Copy all the files in folder 4 into your C:\Program
Files (x86)\AviSynth+\plugins+ folder.
4. Copy all the files in folder 5 into your C:\Program
Files (x86)\AviSynth+\plugins64+ folder.
FFTW Library files
If you’ve done the above correctly, skip this section.
Probably the most confusing aspect of setting up,
especially for QTGMC, is the bitness of the
FFTW3.DLL and libfftw3f-3.dll files and where they
reside.
The 32bit versions are 2336KB and must be in the
C:\Windows\SysWOW64 folder.
The 64bit versions are 2708KB and must be in the
C:\Windows\System32 folder.
Yes, those locations do seem the wrong way round
but they are correct. If you’re so inclined, here’s the
explanation.
Here are the FFTW files (they are also included the
above package). Download and unpack the zip to
get access. Annoyingly, both versions have the
same name, hence the reason I’ve given the file
sizes so you can work out which one is which.
Those of you with an attention to detail will observe
that the two files appear to be exactly the same.
That’s because they are! By some twisted logic,
libfftw3f-3 is simply a renamed fttw3.
Dependencies
As you have probably cottoned-on-to, some
filters/plugins for AVISynth rely many other plugins
which you may not actually use in a script. QTGMC
is a good example. While in the script we will only
use “QTGMC”, there are many other “hidden”
plugins required to make it actually work. They are
in folders “4” and “5” of my install process above.
So, if you are trying to use a filter and get error
messages, go onto the AVISynth site and search for
the filter description. The documentarian will show
the required dependencies, which you will probably
have to download separately and place into your
plugins folder to make the filter work.
Virtual Dub Setup
Set up Virtual Dub, as per my instructions here.
VDub is used to open, or display, the AVISynth AVS
scripts that you create. Other programs can also
open AVS files, including advanced AVISynth
programs such as AVSPMod and some media
players such as Media Player Classic.
VDub allows you to edit the AVS on the fly to adjust
your AVISynth output. You can then perform further
operations such as editing/trimming, cropping,
resizing, and export to MP4 all from VDub. Or you
can Losslessly export the video so that it can be
edited further in a more fully-featured video editor.
Updating AVISynth
AVISynth is updated occasionally. To update your
installation, the recommended procedure is to
simply replace the avisynth.DLL with the new
version as opposed to reinstalling. This VH post
refers.
Using AVISynth
You don’t actually open AVISynth as a program.
What you do is create a script (an AVS file), and
when you open that script in VDub, the script will
use the parts of the AVISynth installation and
plugins it needs to process, as per the filters you set
up (such as QTGMC) and then display your filtered
file in VDub. You can then do further editing or save
it into another format for further editing in an
external editor, or for distribution in, for example,
MP4.
For example, my typical workflow for a VHS capture
is:
•
Capture with AmarecTV,
•
Create an AVISynth script with the captured AVI
file (as I show below) to deinterlace with
QTGMC,
•
Open that AVS file in VDub and apply other
filters such as basic cropping, resizing, colour
and level adjustments,
•
“Save As…” the video into AVI format,
•
Import that AVI into my video editor for titling,
fades, further cropping and editing and exporting
to my final format such as MP4.
Typical AVISynth+ script to run QTGMC
A “script” is actually just a plain text document,
written with Notepad, but saved with the AVS file
extension instead of TXT.
A typical AVISynth script which uses QTGMC to
deinterlace an AVI video and double the framerate
follows, with explanatory comments following.
SetFilterMTMode ("QTGMC", 2)
AviSource("H:\racwa\aeroclub-int.avi")
ConvertToYV12(interlaced=true)
AssumeTFF()
QTGMC(preset="Fast", EdiThreads=8) # set
EdiThreads to half the system cores you have
Prefetch(24) # set to the number of Logical
Processors in your CPU
Explaining the various parts:
SetFilterMTMode ("QTGMC", 2)
Tells AVISynth what multi-threading mode to use.
AviSource("H:\racwa\aeroclub-int.avi")
Tells AVISynth what “source filter” to use to open
the file, and it’s location. Always wrap the full name
in quotes. If the AVS file is saved in the same folder
as the video file you’re processing, you don’t need
the drive and parent folder in the name.
Tip: use the Windows RC menu “Copy as Path”
item to copy the complete file name, then paste it in.
There are other source filters for opening other
types of files eg MPEGs, MOVs, MP4s. For
example, you cannot use “AVISource” to open an
MP4. Other source filters are shown lower down
this page.
ConvertToYV16(interlaced=true)
Converts file to the required colour space.
AssumeTFF()
Tells QTGMC what the interlace status of the file is.
Almost all analogue captures are Top Field First; DV
files from DV camcorders are almost always Bottom
Field First, so if you’re working on DV, use “BFF”. In
any case, if you get it wrong, you’ll notice forward-
backward-forward movement when you step
through the video frame by frame in VDub. Simply
change to the other option.
QTGMC(preset="Fast", EdiThreads=8)
Tells AVISynth to execute QTGMC using the “fast”
preset and to use the extra threads in your CPU to
speed up processing. Set the EdiThreads to half the
system cores you have (Task
Manager>Performance has the number of cores in
your CPU). QTGMC defaults to double-framerate
mode; it splits each field into a frame.
Prefetch(24)
Tells AVISynth to use the available cores in your
CPU to speed up the process. Set it to the number
of Logical Processors in your CPU, available from
Task Manager. If you have issues, reduce the
number progressively.
You then save the script text, using a basic editor
such as Notepad, as a text-format file with the AVS
file extension.
All that is then necessary is to open the file in
Virtual Dub and the result (meaning your original
file, after processing by the script) will be displayed.
Give it a go. Copy the text of the script, paste it into
a TXT/Notepad document, change the name of the
file to be opened and save the file as an AVS file.
Here are some sample full-interlaced files for you to
experiment with (not all files have full-interlacing; for
example, converting telecined movies to
progressive video require different treatment. See
my page on Deinterlacing for details).
AVI
•
f18
•
aeroclub
MPEG 2
•
aircraft MPEG2 (requires a different source-
opening filter)
Open your AVS file in VDub and, fingers crossed,
you’ll shortly be looking at a crisp, smooth,
deinterlaced AVI.
You can now continue editing it, perhaps trimming
and deleting parts, and/or exporting it in whatever
format you wish to either continue editing elsewhere
or save as an MP4 for distribution.
If you have problems, run the AVISynth Info tool,
which will report any issues with your installation.
File-Opening / “Source” Filters
There are many different file types and AVISynth
does not have a common source filter which will
open them all. To that end, here is a list of filters
that will open most file types.
All of these sources work with 64bit; some don’t
work with 32bit.
For files with no audio, the a = and AudioDub(v,a)
lines can be commented-out or deleted.
Copy the source filter you need from this page and
paste it into the top of your script.
Occasionally, a particular source filter doesn’t open
the file properly. For example, the field order might
randomly swap. If you’re having problems with a file
not opening as you would expect, try changing the
source filter. An example of this is in this post, and
another in this post on VideoHelp..
AVI (32 and 64bit)
AviSource("H:\Video Tapes Albums\Video Album 2
Tape A3\Leroy.avi")
no need for a separate audio source filter.
MP4, AV1 (32 and 64bit)
v=LSMASHVideoSource("F:\Flying\F18\F18 Movie -
Fish\Sting of the Hornet.mp4")
a=LSMASHAudioSource("F:\Flying\F18\F18 Movie -
Fish\Sting of the Hornet.mp4")
AudioDub(v,a)
MPEG2
FFmpegSource2("F:\Family
Videos\2004\birthday.mpg", atrack=-1)
This will extract the first audio track in the file. When
saving the video in VDub, very fast encoding into
AVI or H264.
MPEG 2 in MKV
aud=ffaudiosource("Filename.mkv",track=-1)
vid=ffvideosource("Filename.mkv", track=-1,
seekmode=1,fpsnum=30000,fpsden=1001)
audiodub(vid,aud)
Note TDecimate did not work correctly with
ffvideosource on an MKV(AVC)
MPEG 2, VOB (32 and 64bit)
Note: m2ts out of sync 64bit on some files
v=ffms2("boating.mpg")
a=LWLibavAudioSource("boating.mpg")
AudioDub(v,a)
MPEG2 (32 and 64bit) , MKV, MOV, MP4, FFV1 and
others
v=LWLibavVideoSource("sample.VOB")
a=LWLibavAudioSource("sample.VOB")
AudioDub(v,a)
Magix NLE will not open the audio in AVIs created
from MPEG 2s using this filter.
WMV
From here:
https://forum.videohelp.com/threads/419043-
Avisynth-and-WMV-s-keeping-A-V-in-
sync#post2782791
WMVs can have variable video and audio framerate
causing sync issues. This source filter code
mitigates this.
fn = "D:\filename" #without the extension
vfn = fn+".wmv"
afn = fn+".wmv"
a = FFAudioSource(afn).EnsureVBRMP3Sync()
FFVideoSource(vfn, fpsnum=30000, fpsden=1001)
Preroll(60)
AssumeFPS(30000, 1001)
AudioDub(a)
Other file types (this is the least preferable source
filter because it may not be frame-accurate)
DirectShowSource("title00.mkv")
AVSIs
Most plugins are in the form of DLLs, but AVSIs are
also plugins. They are basically autoload files,
meaning they that run as soon as AVISynth starts.
AVSIs are generally not downloadable as a file.
They may be presented on their download page as
the actual text characters, so if you need to find or
install an AVSI, copy all of the text given into a
Notepad text file and save it, then change the file
extension to AVSI. Ensure you have Windows set to
show file extensions.
An example of a “create your own AVSI” for the
Chromashift plugin is here. When you click on the
link to the AVSI at top right, all you get is a bunch of
text. Simply copy all of that text into a text file, then
rename it with the “AVSI” extension ie
ChromaShiftSP.AVSI, and then you will have your
AVSI to put in your Plugins folder.
As an alternative, you may find the already-
constructed AVSI on Github, Doom9 or other
websites. Some common AVSIs are in the filter
folders above.
AVISynth Tricks and Tips
•
On Windows, there should be a RC option for
copying the file name “Copy as Path”: very
handy when copying your video’s filename into a
script.
•
To quickly access and amend your script in
VDub, after you have opened the AVS initially,
go Tools>Script Editor. The script editor box will
open so you can edit your script. Then, to run
the amended script, click anywhere in the editor
window then hit File>Save and refresh… You
can set up keyboard shortcuts for these (I use
F12 to open the AVS, then F5 to run the
amended script). This feature is great for quickly
assessing adjustments to values.
•
Text case is not important although the
convention is to use the case as shown in the
AVISynth wiki.
•
To “comment-out” or disable a line of text in the
script, place a # symbol at the start of the text
you want to comment-out. The # will also work
on text part-way along a line. For example:
Prefetch(24) # use the number of logical
processors from Task Manager
means that AVISynth will run “Prefetch(24)” but
not run the text “use the number of…”. This is
good for putting comments after the actual code
on a line. You’ll see I’ve done this in the sample
script for the EdiThreads and PreFetch.
•
To comment-out a number of lines, at the start of
the line to be commented-out put in /*. At the
end of the final line to be commented-out, put */.
For example:
/* this is a block comment; we can write a lot
here and also comment out multiple lines of
code
SubTitle("Hello, World!") - this code won’t be
processed because it is in a block comment
*/
A simple way to remember which order the /
and * are in is to look at the keys on the
numeric keyboard: to start the comment area,
use /* (left to right), to close the comment area,
reverse it to */.
•
If you want to wrap your code to the next line
instead of having one massive long line of code,
insert a space\. This will allow you to wrap the
rest of the code to the next line. I find this is
helpful in situations such as subtitles for Stack
arrangements:
Scenarios
After going through all of that, you’ll want to start
using AVISynth to actually achieve stuff. I’ve made
up a collection of scenarios which you might come
across and where AVISynth excels here:
AVISynth Scenarios
Further Resources
The Videohelp forum has a number of very
knowledgeable users of AVISynth. If you have any
issues or questions on the use of the various
filters/plugins, I suggest you post a topic there to
seek help.
If you have any issues with the setup described
here, please send me an email at the address on
the home page.