AviSynth

AviSynth
Developer(s) AviSynth developers
Stable release 2.6.0 (May 31, 2015 (2015-05-31)) [±]
Preview release 2.6.0 (May 31, 2015 (2015-05-31)) [±]
Written in C++
Operating system Windows
Type Digital video frameserver
License GNU GPL
Website www.avisynth.nl

AviSynth is a frameserver program for Microsoft Windows developed by Ben Rudiak-Gould, Edwin van Eggelen, Klaus Post, Richard Berg, Ian Brabham and others.[1] It is free software under GNU GPL license.

Scripting video editor

AviSynth acts as a non-linear video editor controlled entirely by scripting (without a GUI).[2] It stands as an intermediary between a digital video source, like an AVI or MPEG file, and a VFW receiving program, which is typically a media player, video editing software, or an encoder.

AviSynth communicates with any program that supports AVIs through the Video for Windows system by acting as a "fake" AVI file.[3] 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, inverse telecine, loading and splicing still images, doing color corrections, denoising, and many other things.

Technically, it acts as a codec for AviSynth scripts, which represent edit decision lists in the form of text files written in the AviSynth scripting language. The scripting language can be extended through the use of external plugins (as opposed to internal plugins, which are included with AviSynth itself). An external plugin list is maintained at AviSynth Filter Collection.

AviSynth filters work in several color spaces including RGB, YUY2 and YV12 (Also YV16, YV24, YV411 and Y8 in Avisynth 2.6).[4] 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). The program will play the video file "myAvi.avi" cropped 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 an imperative language, lacking most program flow control structures,[5] but containing many features familiar to programmers, including variables, distinct datatypes, conditionals, and complex expressions.

The language deals primarily with the video clip 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: 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 video filters. These can be combined in infinite ways by user-defined functions (subroutines that return a value). Most functions take a video stream as an argument and make changes to this stream; there is also a support library of math functions, string functions and so on.

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 - 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 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 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.

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 of AviSynth 2.x, and aimed to overcome the limitations of AviSynth 2.x. Adding improvements such as an abstracted color space 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 rather than the homegrown language employed in current versions.[6]

AviSynth 3.0 was to be available for other operating systems than Windows, instead relying on GStreamer, extending support to platforms such as Linux, Mac OS X and BSD.

Development has been stalled since August 2007.[6][7]

AviSynth for non-Windows operating systems

AviSynth 2.xx may be used under operating systems other than Windows through the use of Wine. To work on scripts VirtualDub/VirtualDubMod can be used as on Windows. To interface between AviSynth under Wine and for example FFmpeg running on a Linux host, Avs2YUV can be used. Avs2YUV is a Windows command line program that is run under Wine and renders the output of an AviSynth script to stdout that is then piped to FFmpeg. Avs2YUV also supports writing to a named pipe.[8]

AvxSynth is a Linux port of AviSynth. More details can be found here: www.avxsynth.org

AviSynth compatible programs

Program name License Comments Homepage
Adobe Premiere Pro Proprietary, commercial Versions 6.0 and later (up to and including CS4) have an AviSynth import plugin available.

Premiere AviSynth import plugin

Avanti GUI Proprietary, freeware Avanti GUI is a free front-end for FFmpeg with the option to insert AviSynth as pre-processor.

Avanti GUI

Cinema Craft Encoder Proprietary Cinema Craft Encoder is a commercial MPEG-2 encoder that supports AviSynth input.

Cinema Craft

FFmpeg LGPL2.1+, GPL 2+ FFmpeg compiled for windows can receive AviSynth input

instructions

MPlayer GPL MPlayer can play .avs files
Microsoft Expression Encoder Proprietary, freemium Microsoft Expression Encoder can import and transcode .avs files.
GOM Player Proprietary, freeware, ad-supported can play .avs files
Nero Multimedia Suite Proprietary, commercial Nero Showtime can play avs files
TMPGEnc Shareware/freeware TMPGEnc is a free 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 GPL VirtualDub is a widely used all-purpose video converter. VirtualDub
VirtualDubMod GPL VirtualDubMod 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.[9] VirtualDubMod
Windows Media Player Proprietary, component of Windows / freeware 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 GPL Media Player Classic is capable of loading and playing AviSynth scripts. The 32-bit version is needed. Media Player Classic
SUPER Proprietary, freeware, ad-supported SUPER (Simplified Universal Player, Encoder and Renderer) is freeware from eRightSoft that can encode most common video formats and has full AviSynth support. SUPER
Total video converter Proprietary, trialware Total video converter 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 scripts are meant to be easily opened in simple text editing programs, there are several editors meant especially for editing AviSynth scripts such as AvsPMod.

See also

References

  1. "Avisynth Copyright". AviSynth Mediawiki. AviSynth Team. Retrieved 11 September 2015.
  2. "Main Page - Avisynth". AviSynth Mediawiki. AviSynth Team. Retrieved 10 April 2013.
  3. "More about AviSynth - Avisynth". AviSynth Wiki. AviSynth Team. Retrieved 10 April 2013.
  4. "Changelist 25-26 - Avisynth". AviSynth Wiki. Avisynth Team. Retrieved 10 April 2013.
  5. Ben Rudiak-Gould. "AviSynth syntax: control structures (in the broad sense)". Archived from the original on October 14, 2007. Retrieved Sep 21, 2014.
  6. 1 2 "Avisynth 3 - dead project". Retrieved 2009-06-17.
  7. "AviSynth v3". Archived from the original on 29 June 2009. Retrieved 2009-06-17.
  8. "Avs2YUV". Retrieved 2011-01-09.
  9. "SourceForge.net: VirtualDubMod: Bugs". Retrieved 2009-12-03.

External links

This article is issued from Wikipedia - version of the Friday, April 01, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.