AviSynth
Encyclopedia
AviSynth is a frameserver
Frameserver
A frameserver is a computer program that streams video to another program, called a frameclient, using a process known as frameserving. The video is sent directly to the frameclient, frame by frame...

 program for Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 developed by Ben Rudiak-Gould, Edwin van Eggelen, Klaus Post, Richard Berg, Ian Brabham and others. It is free software
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...

 under GNU GPL license.

Scripting video editor

AviSynth acts as a non-linear video editor (without a GUI
Graphical user interface
In computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...

) controlled entirely by scripting. It stands as an intermediary between a digital video
Digital video
Digital video is a type of digital recording system that works by using a digital rather than an analog video signal.The terms camera, video camera, and camcorder are used interchangeably in this article.- History :...

 source, like an AVI
Audio Video Interleave
Audio Video Interleave , known by its acronym AVI, is a multimedia container format introduced by Microsoft in November 1992 as part of its Video for Windows technology. AVI files can contain both audio and video data in a file container that allows synchronous audio-with-video playback...

 or MPEG file, and a VFW
Video for Windows
Video for Windows was a multimedia framework developed by Microsoft that allowed Microsoft Windows to play digital video.-Overview:...

 receiving program, which is typically a media player, video editing software
Video editing software
Video editing software, is application software which handles the post-production video editing of digital video sequences on a computer non-linear editing systems...

, or an encoder
Encoder
An encoder is a device, circuit, transducer, software program, algorithm or person that converts information from one format or code to another, for the purposes of standardization, speed, secrecy, security, or saving space by shrinking size.-Media:...

.

AviSynth communicates with any program that supports AVI
Audio Video Interleave
Audio Video Interleave , known by its acronym AVI, is a multimedia container format introduced by Microsoft in November 1992 as part of its Video for Windows technology. AVI files can contain both audio and video data in a file container that allows synchronous audio-with-video playback...

s through the Video for Windows
Video for Windows
Video for Windows was a multimedia framework developed by Microsoft that allowed Microsoft Windows to play digital video.-Overview:...

 system by acting as a "fake" AVI file. It can apply a large variety of editing and processing functions (called filters) to a video stream before passing along the results as if it were a legitimate file being read. Filter capabilities include trimming, cropping, deinterlacing
Deinterlacing
Deinterlacing is the process of converting interlaced video, such as common analog television signals or 1080i format HDTV signals, into a non-interlaced form....

, inverse telecine
Telecine
Telecine is transferring motion picture film into video and is performed in a color suite. The term is also used to refer to the equipment used in the post-production process....

, loading and splicing still image
Image
An image is an artifact, for example a two-dimensional picture, that has a similar appearance to some subject—usually a physical object or a person.-Characteristics:...

s, doing color corrections, denoising, and many other things.

Technically, it acts as a codec
Codec
A codec is a device or computer program capable of encoding or decoding a digital data stream or signal. The word codec is a portmanteau of "compressor-decompressor" or, more commonly, "coder-decoder"...

 for AviSynth scripts, which are text files written in the AviSynth scripting language. The scripting language can be extended through the use of plugins. A plugin list is maintained at AviSynth Filter Collection.

AviSynth filters work in several color space
Color space
A color model is an abstract mathematical model describing the way colors can be represented as tuples of numbers, typically as three or four values or color components...

s including RGB, YUY2
YUV
YUV is a color space typically used as part of a color image pipeline. It encodes a color image or video taking human perception into account, allowing reduced bandwidth for chrominance components, thereby typically enabling transmission errors or compression artifacts to be more efficiently...

 and YV12
YUV
YUV is a color space typically used as part of a color image pipeline. It encodes a color image or video taking human perception into account, allowing reduced bandwidth for chrominance components, thereby typically enabling transmission errors or compression artifacts to be more efficiently...

 (Also YV16, YV24, YV411 and Y8 in Avisynth 2.6). This is necessary to allow all kinds of video input and output. Certain functions only work on specific color spaces, requiring conversion beforehand.

For example, say the script "myAvi.avs" (just a plain text-file saved with the extension "avs") contains the following:

AviSource("myAvi.avi")
Crop(0, 0, 320, 240)
Blur(0.1)

This script file can be opened in most media players (such as Windows Media Player
Windows Media Player
Windows Media Player is a media player and media library application developed by Microsoft that is used for playing audio, video and viewing images on personal computers running the Microsoft Windows operating system, as well as on Pocket PC and Windows Mobile-based devices...

). The program will play the video file "myAvi.avi" trimmed down to its top-left 320 pixels by 240 pixels and blurred by a small amount. Operations occur in sequential order, so the Cropping occurs first, then the Blurring.

AviSynth scripting language

The scripting language is a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

, containing many features familiar to programmers, including variables
Variable (programming)
In computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...

, distinct datatypes, conditionals, and complex expressions
Expression (programming)
An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces another value...

.

The language deals primarily with videos, as a primitive data type. A typical script loads a video as input, applies processing to it, and then "returns" that video in the same way functions return values. The returned video is the output of the script, which is seen as the video by the program running the script.

The language also has several other more standard data types, including int, float, bool and string. These can be used to perform calculations, decisions, and write text such as subtitles to the video.

The processing work is largely done by functions or filters. The programmer can pass arguments to one of many built-in functions, and a value may be returned. Also, many functions take a video stream as an argument, and make changes to this stream.

Programmers may be unaware that they are constantly passing video streams into functions, since convention suggests that the video is not explicitly passed. If no video is passed into a function, it simply takes the last video used.

Additional functions/filters are available through plugins. The use of plugins is encouraged to extend the capabilities of AviSynth. (See AviSynth Filter Collection link for a list of plugins).

"Hello World"

This example is a "Hello World" program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

 - it simply creates a video containing the words "Hello, world!".
BlankClip
Subtitle("Hello, world!")
The BlankClip function creates a new video, which then has a subtitle displayed on top of it. The parentheses at the end of the word are optional, since no arguments are being passed, but are given in this case to indicate it is a function and not a variable.

The Subtitle function draws the words "Hello, world!" on top of the previously-created blank video.

Although the BlankClip and Subtitle functions both accept many more arguments (for example, controlling the size and length of the video, and the positioning, font, and color of the subtitle), this example leaves them out, so the functions use built-in defaults.

If the above text is entered into a .avs file, it can be opened in Windows Media Player
Windows Media Player
Windows Media Player is a media player and media library application developed by Microsoft that is used for playing audio, video and viewing images on personal computers running the Microsoft Windows operating system, as well as on Pocket PC and Windows Mobile-based devices...

 or any of the other programs in the list below, and a video containing the text will be displayed.

Video-processing

This example takes an actual video, applies some simple processing, and returns it to the output.
AviSource("C:\Example.avi")
ReduceBy2
GreyScale
The AviSource function is used to load a video from a real location. The DirectShowSource function could also be used. ReduceBy2 divides the vertical and horizontal size of the video in half, and GreyScale forces the video to greyscale
Grayscale
In photography and computing, a grayscale or greyscale digital image is an image in which the value of each pixel is a single sample, that is, it carries only intensity information...

 colors.

Again, the above script can be entered into a .avs file and opened in a video player or editor. Assuming C:\Example.avi exists, it will play a copy of that file, except that it will be half the size and greyscale
Grayscale
In photography and computing, a grayscale or greyscale digital image is an image in which the value of each pixel is a single sample, that is, it carries only intensity information...

.

User defined

The AviSynth scripting language allows for users to define their own functions.

This is an example of a function that allows you to dissolve from one clip to another without damaging interlacing lines.


clip1 = AVISource("video1.avi")
clip2 = AVISource("video2.avi")
interlaced_dissolve(clip1, clip2, 30) # dissolve from clip1 to clip2 over 30 frames
function interlaced_dissolve(clip clip1, clip clip2, int iter) {
clip1 = clip1.SeparateFields
evn1 = clip1.SelectEven
odd1 = clip1.SelectOdd

clip2 = clip2.SeparateFields
evn2 = clip2.SelectEven
odd2 = clip2.SelectOdd

evn = Dissolve(evn1, evn2, iter)
odd = Dissolve(odd1, odd2, iter)
Interleave(evn, odd).Weave.DoubleWeave.SelectOdd
}


AviSynth 3.0 code rewrite

AviSynth 3.0 was a complete rewrite
Rewrite (programming)
A rewrite in computer programming is the act or result of re-implementing a large portion of existing functionality without re-use of its source code. When the rewrite is not using existing code at all, it is common to speak of a rewrite from scratch...

 of AviSynth 2.x, and aimed to overcome the limitations of AviSynth 2.x.
Adding improvements such as an abstracted color space
Color space
A color model is an abstract mathematical model describing the way colors can be represented as tuples of numbers, typically as three or four values or color components...

 model, in which new color spaces (including two with 45-bit depth) could be supported through a plug-in mechanism, better cache management for better performance, and using Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...

 rather than the homegrown language employed in current versions.

AviSynth 3.0 was to be available for other operating systems than Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

, instead relying on GStreamer
GStreamer
GStreamer is a pipeline-based multimedia framework written in the C programming language with the type system based on GObject.GStreamer allows a programmer to create a variety of media-handling components, including simple audio playback, audio and video playback, recording, streaming and editing...

, extending support to platforms such as Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

, Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 and BSD.

Development has been stalled since August 2007.

AviSynth for non-Windows operating systems

AviSynth 2.xx may be used under operating systems other than Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 through the use of Wine
Wine (software)
Wine is a free software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine also provides a software library, known as Winelib, against which developers can compile Windows applications to help port them to Unix-like...

. To work on scripts VirtualDub
VirtualDub
VirtualDub is a video capture and video processing utility for Microsoft Windows written by Avery Lee.It is designed to process linear video streams, including filtering and recompression...

/VirtualDubMod
VirtualDubMod
VirtualDubMod is an open source video capture and linear processing tool for Microsoft Windows. It is based on Avery Lee's VirtualDub, and is licensed under the GPL. VirtualDubMod is hosted on SourceForge and is at version 1.5.10.2 ....

 can be used as on Windows. To interface between AviSynth under Wine
Wine (software)
Wine is a free software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine also provides a software library, known as Winelib, against which developers can compile Windows applications to help port them to Unix-like...

 and for example FFmpeg
FFmpeg
FFmpeg is a free software project that produces libraries and programs for handling multimedia data. The most notable parts of FFmpeg are libavcodec, an audio/video codec library used by several other projects, libavformat, an audio/video container mux and demux library, and the ffmpeg command line...

 running on a Linux host, Avs2YUV can be used. Avs2YUV is a Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...

 command line program that is run under Wine
Wine (software)
Wine is a free software application that aims to allow computer programs written for Microsoft Windows to run on Unix-like operating systems. Wine also provides a software library, known as Winelib, against which developers can compile Windows applications to help port them to Unix-like...

 and renders the output of an AviSynth script to stdout
Standard streams
In Unix and Unix-like operating systems , as well as certain programming language interfaces, the standard streams are preconnected input and output channels between a computer program and its environment when it begins execution...

 that is then piped to FFmpeg
FFmpeg
FFmpeg is a free software project that produces libraries and programs for handling multimedia data. The most notable parts of FFmpeg are libavcodec, an audio/video codec library used by several other projects, libavformat, an audio/video container mux and demux library, and the ffmpeg command line...

. Avs2YUV also supports writing to a Named pipe
Named pipe
In computing, a named pipe is an extension to the traditional pipe concept on Unix and Unix-like systems, and is one of the methods of inter-process communication. The concept is also found in Microsoft Windows, although the semantics differ substantially...

.

AviSynth compatible programs

Program name Comments Homepage
Adobe Premiere Versions 6.0 and later (up to and including CS4) have an AviSynth import plugin available.
Premiere AviSynth import plugin
Cinema Craft Encoder
Cinema Craft Encoder
Cinema Craft Encoder or CCE is a video encoder for MPEG-1 and MPEG-2. It is written in assembly and optimized with SIMD multimedia instructions of compatible x86 processors....

Cinema Craft Encoder is a widely-used MPEG-2 encoder.
Cinema Craft
FFmpeg
FFmpeg
FFmpeg is a free software project that produces libraries and programs for handling multimedia data. The most notable parts of FFmpeg are libavcodec, an audio/video codec library used by several other projects, libavformat, an audio/video container mux and demux library, and the ffmpeg command line...

FFmpeg compiled for windows can receive avisynth input
instructions
MPlayer
MPlayer
MPlayer is a free and open source media player. The program is available for all major operating systems, including Linux and other Unix-like systems, Microsoft Windows and Mac OS X. Versions for OS/2, Syllable, AmigaOS and MorphOS are also available. The Windows version works, with some minor...

MPlayer can play .avs files
Nero Multimedia Suite Nero Showtime can play avs files
TMPGEnc
TMPGEnc
TMPGEnc or TSUNAMI MPEG Encoder is a video transcoder software application primarily for encoding video files to VCD and SVCD-compliant MPEG video formats and was developed by Hiroyuki Hori and Pegasys Inc.. TMPGEnc can also refer to the family of software video encoders created after the success...

 {Plus, Express}
TMPGEnc
TMPGEnc
TMPGEnc or TSUNAMI MPEG Encoder is a video transcoder software application primarily for encoding video files to VCD and SVCD-compliant MPEG video formats and was developed by Hiroyuki Hori and Pegasys Inc.. TMPGEnc can also refer to the family of software video encoders created after the success...

 is a free
Gratis
Gratis is the process of providing goods or services without compensation. It is often referred to in English as "free of charge" or "complimentary"...

 MPEG-1 and MPEG-2 encoder. TMPGEnc Plus and TMPGEnc Express are commercial versions of TMPGEnc that include enhanced functionality, as well as the removal of a 30-day restriction on MPEG-2 encoding present in TMPGEnc.

Pegasys Inc.
VirtualDub
VirtualDub
VirtualDub is a video capture and video processing utility for Microsoft Windows written by Avery Lee.It is designed to process linear video streams, including filtering and recompression...

VirtualDub
VirtualDub
VirtualDub is a video capture and video processing utility for Microsoft Windows written by Avery Lee.It is designed to process linear video streams, including filtering and recompression...

 is a widely-used all-purpose video converter.
VirtualDub
VirtualDubMod
VirtualDubMod
VirtualDubMod is an open source video capture and linear processing tool for Microsoft Windows. It is based on Avery Lee's VirtualDub, and is licensed under the GPL. VirtualDubMod is hosted on SourceForge and is at version 1.5.10.2 ....

VirtualDubMod
VirtualDubMod
VirtualDubMod is an open source video capture and linear processing tool for Microsoft Windows. It is based on Avery Lee's VirtualDub, and is licensed under the GPL. VirtualDubMod is hosted on SourceForge and is at version 1.5.10.2 ....

 contains several AviSynth-specific features such as explicit support for AviSynth scripts, an AviSynth script editor, and more. However, it has not been updated since 2006 and contains many bugs.
VirtualDubMod
Windows Media Player
Windows Media Player
Windows Media Player is a media player and media library application developed by Microsoft that is used for playing audio, video and viewing images on personal computers running the Microsoft Windows operating system, as well as on Pocket PC and Windows Mobile-based devices...

Windows Media Player is capable of loading and playing AviSynth scripts, so it is a good choice for simple playback and testing. It may require some registry tweaks to get it working. Windows Media Home
Media Player Classic
Media Player Classic
Media Player Classic is a compact media player for 32-bit and 64-bit Microsoft Windows. The application mimics the look and feel of the old, lightweight Windows Media Player 6.4 but integrates most options and features found in modern media players...

Media Player Classic is capable of loading and playing AviSynth scripts. The 32-bit version is needed. Media Player Classic
SUPER
SUPER (software)
SUPER is a closed-source freeware front-end for open-source software video players and encoders provided by the FFmpeg, MEncoder, MPlayer, x264, ffmpeg2theora, musepack, Monkey's Audio, True Audio, WavPack, libavcodec, and the Theora/Vorbis RealProducer plugIn projects...

SUPER (Simplified Universal Player, Encoder and Renderer) is freeware
Freeware
Freeware is computer software that is available for use at no cost or for an optional fee, but usually with one or more restricted usage rights. Freeware is in contrast to commercial software, which is typically sold for profit, but might be distributed for a business or commercial purpose in the...

 from eRightSoft that can encode most common video formats and has full AviSynth support.
SUPER
Total video converter
Total video converter
Total Video Converter is a shareware video and audio converter utility from EffectMatrix. It is commonly used to convert most fashionable video formats for various video players as well as show photos slide and burn the converted video to DVD/SVCD/VCD. Started from version 2.21, Total Video...

Total video converter
Total video converter
Total Video Converter is a shareware video and audio converter utility from EffectMatrix. It is commonly used to convert most fashionable video formats for various video players as well as show photos slide and burn the converted video to DVD/SVCD/VCD. Started from version 2.21, Total Video...

 has an Avisynth import plugin available.
Total Video Converter


In addition, several programs have now been created which accept only AviSynth scripts as input - thereby simplifying the programs themselves but giving users the full power of AviSynth for input.

There are also several batch encoding applications that tie together AviSynth with command line audio and video encoders and muxers to provide an all-in-one, modular, customizable video encoding application. MeGUI is an example of this kind of application.

Although AviSynth is meant to be easily opened in simple text editing programs, there are several powerful and friendly editors meant especially for editing AviSynth scripts. AVSEdit was a popular editor, but hasn't been updated since 2004. AvsP is the most used and most powerful editor at the moment.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK