AviSynth

Last updated
AviSynth
Developer(s) AviSynth developers, Doom9 community
Initial release19 May 2000;23 years ago (2000-05-19)
Stable release 2.6.0 (May 31, 2015;8 years ago (2015-05-31)) [±]
Preview release 2.6.1 Alpha 1 (May 17, 2016;7 years ago (2016-05-17)) [±]
Repository
Written in C++, Assembly
Operating system Windows, Linux, macOS
Platform x86 and x86-64
Type Digital video frameserver
License GNU GPL
Website www.avisynth.nl

AviSynth is a frameserver program for Microsoft Windows, Linux and macOS initially developed by Ben Rudiak-Gould, Edwin van Eggelen, Klaus Post, Richard Berg and Ian Brabham in May 2000 [1] and later picked up and maintained by the open source community which is still active nowadays. It is free software licensed under the GNU General Public License.

Contents

Scripting video editor

AviSynth acts as a non-linear video editor controlled entirely by scripting (without a GUI). [2] It emulates an AVI video file (or WAV audio file) as seen by the VFW downstream application, which is typically a media player, video editing software, or an encoder. [3]

AviSynth is built upon filters, which are much like DirectShow filters, but with a different binary interface. Filter capabilities include cropping, deinterlacing, inverse telecine, working with still images, doing basic color grading, reducing video noise, and many other things. AviSynth also performs traditional video editing tasks like cutting, trimming and re-sequencing segments.

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

 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.

Technically, AviSynth constructs a filter graph (like Microsoft GraphEdit but with added capabilities), [4] controlled by scripts written in the AviSynth scripting language. Its functionality can be extended through the use of third-party filters known as plugins. An external plugin list is maintained at AviSynth Filter Collection.

AviSynth is a frameserver the calling program requests audio/video frames and the script serves them. The calling program can call frames in any order, allowing it to pause, jump forward or backward etc., just as with a physical file.

AviSynth scripting language

The scripting language is a dataflow language: [4] a programming paradigm that describes a directed graph of the data flowing between operations. It lacks some procedural programming control structures, [5] but it contains many features familiar to programmers, including variables, distinct datatypes, conditionals, and complex expressions.

The language works primarily with the audio/video clip as a built-in data type. The clip is a complex structure with many attributes such as width, height and duration. [6] The language also has several other more standard data types: int, float, bool and string. [7] These can be used to perform calculations, decisions, and write text such as subtitles to the video.

The script has a single return value, which is the audio and video 'seen' by the program running the script. This is normally the last line of the script, but a return statement may be inserted at any point.

"Hello World"

This example is a "Hello World" program.

 BlankClip()  Subtitle("Hello, world!") 

If the above text is entered into a text file with the .avs extension, it can be opened in Windows Media Player or any of the other programs in the list below, and a video containing the words "Hello, world!" will be displayed.

The BlankClip function creates a new video. 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 both functions both accept many more arguments (for example, controlling the size and length of the blank video, and the positioning, font, and color of the subtitle), this example leaves them out; the functions use built-in default arguments.

Avisynth uses syntactic sugar that makes simple scripts far easier to write: an implicit variable called Last. Without implicit variables, the above script would have to be written like this:

 Last = BlankClip()  Last = Last.Subtitle("Hello, world!")  return Last 

or like this:

 A = BlankClip()  B = A.Subtitle("Hello, world!")  return B 

Explicit clip variables are normally only used for functions involving more than one clip:

 A = BlankClip()  B = A.Subtitle("Hello, world!")  return Dissolve(A, B, 30) # 30-frame cross fade  

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 an AVI video from a real location. To open other media types, the DirectShowSource function could be used instead. ReduceBy2 divides the vertical and horizontal size of the video in half, and GreyScale removes all color information.

AviSynth filters work in many RGB and YUV color spaces to allow all kinds of video input and output. [8] Certain functions only work on specific color spaces, requiring conversion for example, most videos are distributed in a YUV color space, but most color correction is done in one of the RGB spaces. A color-correcting script might look like this:

 DirectShowSource("movie.mp4") # YV12 color space  ConvertToRGB32  RGBAdjust(1.0, 0.95, 1.0) # decrease Green channel  ConvertToYV12 

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")     # call the user-defined function which is defined below:   interlaced_dissolve(clip1, clip2, 30)       # ...the script returns the above result to the calling program        # user-defined function:    # 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         # ...the function returns the above result to the main script  } 

AviSynth 3.0 and AviSynth+

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. [9]

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. [9] [10]

AviSynth+ is a fork of the official AviSynth 2.xx, introducing long-sought features such as 64-bit support, multithreading, deep color spaces, support for recent compilers, new scripting constructs (new control-flow constructs such as loops), and increased performance in many areas. [11] At the same time it retained 100% compatibility to the AviSynth 2.5/2.6 series, both for filters and host applications. At the time of writing (2023-06), it is also actively maintained.

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. [12]

There is a Linux port of AviSynth called AvxSynth. [13]

AviSynth compatible programs

Program nameLicenseCommentsHomepage
Adobe Premiere Pro Proprietary, commercialVersions 6.0 and later (up to and including CS4) have an AviSynth import plugin available. Premiere AviSynth import plugin
Avanti GUI Proprietary, freewareAvanti GUI is a free front-end for FFmpeg with the option to insert AviSynth as pre-processor. Avanti GUI
AvsPmod GPLAvsPmod is AviSynth script editor with builtin player, syntax highlighting and code autocompletion. AvsPmod
Cinema Craft EncoderProprietaryCinema 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
GOM Player Proprietary, freeware, ad-supportedcan play .avs files
Media Player Classic GPLMedia Player Classic is capable of loading and playing AviSynth scripts. The 32-bit version is needed. Media Player Classic
Microsoft Expression Encoder Proprietary, freemiumMicrosoft Expression Encoder can import and transcode .avs files.
MPlayer GPLMPlayer can play .avs files
Nero Multimedia Suite Proprietary, commercialNero Showtime can play avs files
SUPER Proprietary, freeware, ad-supportedSUPER (Simplified Universal Player, Encoder and Renderer) is freeware from eRightSoft that can encode most common video formats and has full AviSynth support. SUPER
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.
Total video converter Proprietary, trialwareTotal video converter has an AviSynth import plugin available. Total Video Converter
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. [14] VirtualDubMod
Windows Media Player Proprietary, component of Windows / freewareWindows 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

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

Related Research Articles

<span class="mw-page-title-main">AWK</span> Programming language

AWK is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. Like sed and grep, it is a filter, and is a standard feature of most Unix-like operating systems.

A "Hello, World!" program is generally a simple computer program which outputs to the screen a message similar to "Hello, World!" while ignoring any user input. A small piece of code in most general-purpose programming languages, this program is used to illustrate a language's basic syntax. A "Hello, World!" program is often the first written by a student of a new programming language, but such a program can also be used as a sanity check to ensure that the computer software intended to compile or run source code is correctly installed, and that its operator understands how to use it.

<span class="mw-page-title-main">Shell script</span> Script written for the shell, or command line interpreter, of an operating system

A shell script is a computer program designed to be run by a Unix shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. A script which sets up the environment, runs the program, and does any necessary cleanup or logging, is called a wrapper.

<span class="mw-page-title-main">ANSI escape code</span> Method used for display options on video text terminals

ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as commands, rather than text to display verbatim.

Gamma correction or gamma is a nonlinear operation used to encode and decode luminance or tristimulus values in video or still image systems. Gamma correction is, in the simplest cases, defined by the following power-law expression:

Windows Media Video (WMV) is a series of video codecs and their corresponding video coding formats developed by Microsoft. It is part of the Windows Media framework. WMV consists of three distinct codecs: The original video compression technology known as WMV, was originally designed for Internet streaming applications, as a competitor to RealVideo. The other compression technologies, WMV Screen and WMV Image, cater for specialized content. After standardization by the Society of Motion Picture and Television Engineers (SMPTE), WMV version 9 was adapted for physical-delivery formats such as HD DVD and Blu-ray Disc and became known as VC-1. Microsoft also developed a digital container format called Advanced Systems Format to store video encoded by Windows Media Video.

<span class="mw-page-title-main">F Sharp (programming language)</span> Microsoft programming language

F# is a general-purpose, strongly typed, multi-paradigm programming language that encompasses functional, imperative, and object-oriented programming methods. It is most often used as a cross-platform Common Language Infrastructure (CLI) language on .NET, but can also generate JavaScript and graphics processing unit (GPU) code.

mIRC scripting language Scripting language embedded in mIRC

The mIRC scripting language is the scripting language embedded in mIRC and Adiirc, IRC clients for Windows but work with WiNE for Linux.

<span class="mw-page-title-main">MediaWiki</span> Free and open-source wiki software

MediaWiki is free and open-source wiki software originally developed by Magnus Manske for use on Wikipedia on January 25, 2002, and further improved by Lee Daniel Crocker, after which it has been coordinated by the Wikimedia Foundation. It powers several wiki hosting websites across the Internet, as well as most websites hosted by the Foundation including Wikipedia, Wiktionary, Wikimedia Commons, Wikiquote, Meta-Wiki and Wikidata, which define a large part of the set requirements for the software. MediaWiki is written in the PHP programming language and stores all text content into a database. The software is optimized to efficiently handle large projects, which can have terabytes of content and hundreds of thousands of views per second. Because Wikipedia is one of the world's largest and most visited websites, achieving scalability through multiple layers of caching and database replication has been a major concern for developers. Another major aspect of MediaWiki is its internationalization; its interface is available in more than 400 languages. The software has more than 1,000 configuration settings and more than 1,800 extensions available for enabling various features to be added or changed. Besides its usage on Wikimedia sites, MediaWiki has been used as a knowledge management and content management system on websites such as Fandom, wikiHow and major internal installations like Intellipedia and Diplopedia.

<span class="mw-page-title-main">VirtualDub</span>

VirtualDub is a free and open-source 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. It uses AVI container format to store captured video. The first version of VirtualDub, written for Windows 95, to be released on SourceForge was uploaded on August 20, 2000.

<span class="mw-page-title-main">Picasa</span> Image organizer and image viewer (2002–2016)

Picasa was a cross-platform image organizer and image viewer for organizing and editing digital photos, integrated with a now defunct photo-sharing website, originally created by a company named Lifescape in 2002. "Picasa" is a blend of the name of Spanish painter Pablo Picasso, the word casa and "pic" for pictures.

Google Video was a free video hosting service, originally launched by Google on January 25, 2005.

<span class="mw-page-title-main">LiVES</span>

LiVES (LiVES Editing System) is a free and open-source video editing software and VJ tool, released under the GNU General Public License version 3 or later. There are binary versions available for most popular Linux distributions (including Debian, Ubuntu, Fedora, Suse, Gentoo, Slackware, Arch Linux, Mandriva and Mageia). There are also ports for BSD, and it will run under Solaris and IRIX. It has been compiled under OS X Leopard, but not thoroughly tested on that platform. In early 2019, a version for Microsoft Windows was announced, with a release slated for in the second half of 2019.

<span class="mw-page-title-main">Avidemux</span> Free and open-source transcoding and video editing software

Avidemux is a free and open-source software application for non-linear video editing and transcoding multimedia files. The developers intend it as "a simple tool for simple video processing tasks" and to allow users "to do elementary things in a very straightforward way". It is written in C++ and uses Qt for its graphical user interface, and FFmpeg for its multimedia functions. Starting with version 2.4, Avidemux also offers a command-line interface, and since version 2.6, the original GTK port has not been maintained and is now discontinued.

SubRip is a free software program for Microsoft Windows which extracts subtitles and their timings from various video formats to a text file. It is released under the GNU GPL. Its subtitle format's file extension is .srt and is widely supported. Each .srt file is a human-readable file format where the subtitles are stored sequentially along with the timing information. Most subtitles distributed on the Internet are in this format.

.properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application. They can also be used for storing strings for Internationalization and localization; these are known as Property Resource Bundles.

<span class="mw-page-title-main">Conky (software)</span> System monitor for the X Window System

Conky is a free software desktop system monitor for the X Window System. It is available for Linux, FreeBSD, and OpenBSD. Conky is highly configurable and is able to monitor many system variables including the status of the CPU, memory, swap space, disk storage, temperatures, processes, network interfaces, battery power, system messages, e-mail inboxes, Arch Linux updates, many popular music players, weather updates, breaking news, and much more. Unlike system monitors that use high-level widget toolkits to render their information, Conky is drawn directly in an X window. This allows it to be configured such that it consumes relatively few system resources.

<span class="mw-page-title-main">Hollywood (programming language)</span> Programming language

Hollywood is a commercially distributed programming language developed by Andreas Falkenhahn which mainly focuses on the creation of multimedia-oriented applications. Hollywood is available for AmigaOS, MorphOS, WarpOS, AROS, Windows, macOS, Linux, Android, and iOS. Hollywood has an inbuilt cross compiler that can automatically save executables for all platforms supported by the software. The generated executables are completely stand-alone and do not have any external dependencies, so they can also be started from a USB flash drive. An optional add-on also allows users to compile projects into APK files.

Tcl is a high-level, general-purpose, interpreted, dynamic programming language. It was designed with the goal of being very simple but powerful. Tcl casts everything into the mold of a command, even programming constructs like variable assignment and procedure definition. Tcl supports multiple programming paradigms, including object-oriented, imperative, functional, and procedural styles.

<span class="mw-page-title-main">AVS Video Editor</span>

AVS Video Editor is a video editing software published by Online Media Technologies Ltd. It is a part of AVS4YOU software suite which includes video, audio, image editing and conversion, disc editing and burning, document conversion and registry cleaner programs. It offers the opportunity to create and edit videos with a vast variety of video and audio effects, text and transitions; capture video from screen, web or DV cameras and VHS tape; record voice; create menus for discs, as well as to save them to plenty of video file formats, burn to discs or publish on Facebook, YouTube, Flickr, etc.

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. 1 2 "The Script Execution Model: The Filter Graph". AviSynth Wiki. AviSynth Team. Retrieved 25 October 2019.
  5. "AviSynth syntax: control structures". AviSynth Wiki. Avisynth Team. Retrieved Sep 21, 2014.
  6. "Clip Properties". AviSynth Wiki. Avisynth Team. Retrieved Oct 27, 2019.
  7. "Script Variables". AviSynth Wiki. Avisynth Team. Retrieved Sep 14, 2017.
  8. "Convert - Avisynth". AviSynth Wiki. AviSynth Team. Retrieved 27 October 2019.
  9. 1 2 "Avisynth 3 - dead project?". Doom9 Forum. Retrieved 2009-06-17.
  10. "AviSynth v3". AviSynth Mediawiki. Retrieved 22 September 2019.
  11. "AviSynth+". AviSynth Mediawiki. Retrieved 22 September 2019.
  12. "Avs2YUV". Akuvian.org. Retrieved 2011-01-09.
  13. "avxsynth/avxsynth: Linux Port of Avisynth". GitHub . Retrieved 2017-09-16.
  14. "SourceForge.net: VirtualDubMod: Bugs" . Retrieved 2009-12-03.