Shared functions

From Avisynth

Jump to: navigation, search

These functions are useful to help understand the syntax of Avisynth scripting. Of course, they are even more useful to actually use. Copy them into a file named *.avsi, put them in your plugin directory, and they will be automatically enabled.

  • Layer Loop
LayerLoop is a function Dividee made upon the release of Avisynth 2 to show off the new Layer and Loop commands.
  • 60 fps deinterlacer
We've asked Tom to include a proper 60fps deinterlacer in his wonderful TomsMoComp, but until then you'll have to make do with TomsBob.
  • Virtual Dub filters
Wilbert's collections of functions for using VirtualDub filters:
to help interface with them.
  • Format conversion
Useful SmoothDeinterlaceFunctions to convert between broadcast formats. Converts back and forth between NTSC and PAL.
  • Multiple sources
Some common EditingFunctions for inserting and splicing multiple video sources.
  • IVTCBlend
Waka demonstrated an IvtcBlend function that uses the information in the "extra" fields of a telecined source to help combat temporal noise.
  • CheckTopFirst
CheckTopFirst helps to determine if your clip is Top-Field-First or Bottom-Field-First.
  • GuessParity
GuessParity checks the parity of your clip.
  • Smoothing interlaced video
InterlacedSmoothing safely processes interlaced video with spatial and temporal filters.
  • A script to help find lip sync DelayAudio value
FindAudioSyncScript (by IanB) helps you to find the appropriate audio delays, if you have desync'ed audio.
An AddAudio function that adds silent audio to a clip. Needed for CCE 2.50 users.
  • Resize based on bits/(pixel*framerate) formula (bpp)
ResizeARC respects AR as possible mantaining MOD32 resolutions, uses bitrate, bpp and the resize function specified as parameters. Usage:
ResizeARC(860, 0.2, "FastBilinearResize")
  • Compressibility test
The script Compressibility test can be used for a compressibility test on a clip. Usage:
CompTest(5)

for a compressibility test on 5% of the movie.

  • DeKafka
DeKafka is a filter for removing logos from broadcast sources. Usage:
clip.dekafka(masklogo,582,36,59,27,255)
  • mfRainbow
mfRainbow removes rainbows (requires AviSynth v2.5). Usage:
Import("mfRainbow-0.1.avs")
AviSource("file.avi")
mfRainbow()
  • mfToon
mfToon darkens cartoon edges (requires AviSynth v2.5). Usage:
Import("mfToon-0.32.avs")
AviSource("file.avi")
mfToon()
  • MoveChroma
MoveChroma is a simple filter combination that helps in moving chroma back, if it has been displaced.
  • CutFinder
CutFinder helps you to find the right position to concatenate 2 video streams.
i.E. if you have, like me, found a video as two 800MB mpeg that won't fit on standard CDs, and on the second CD, a piece of the last frames of the first CD is included.
  • MagicPrisma
Makes a movie look like seen through a kaleidoscope. Uses functions like Layer, BilinearResize and rand. Not realy useful, but shows again how flexible AviSynth is.
  • SeeTheDifference
SeeTheDifference just makes the difference visible between an encoded and an original videoclip. So you can see what you really "lose" when encoding a video.
  • SmoothFreezeFrame
SmoothFreezeFrame is like FreezeFrame, but blends all frames inside the start-end range together to create a smooth result.
  • VScrollTitle
VScrollTitle adds a vertically scrolling title (bottom to top, horizontally centered).
  • LoadOldPlugins
LoadOldPlugins allows one to use 2.0x and 2.5x plugins seamlessly without any calls to LoadPlugin.
A variety of functions, including Trim2/Trim3, UnfoldFieldsVertical/FoldFieldsVertical, NoArgFunctionWrapper, and Wipe.
  • ((Wrapper
Examples of wrapper functions to set default values to filters or to create presets for them.
  • convert60ito24p
convert60ito24p converts a 60fps interlaced NTSC Video into a 24fps progressive Video using different blending technics.
  • ((DVB MPEG-2 Converter))
Converts DVB (Digital Video Broadcasting) MPEG-2 files into RGB24 720px-width video, with an option to return a centre cut-out of a 16:9 frame.
  • red shifter (3d anaglyph?)
This script shifts the red channel up and to the left an arbitrary amount of pixels.
  • Field based speed changing
AlterFPS can be used to speed up or slow down a video by adding or removing fields. It works like the 3:2 pulldown of NTSC film material, except you can choose your new speed. It can also blend frames for progressive frame results, and blend fields like ConvertFPS.
  • Restore24
Restore24 is an AviSynth filter created by Didee, that is able to do the nearly impossible: Restore 24fps FILM out of a fieldblended

FILM -> Telecine -> NTSC -> Blendconversion -> PAL - Video.

  • LimitedSharpen
LimitedSharpen can be used like a traditional sharpener, but producing much less artefacts. It can be used as a replacement for the common "resize(x4)-XSharpen-resize(x1)" combo, with very similar results (perhaps even better) - but at least 2 times faster, since it requires much less oversampling.
  • YLevels
YLevels is a set of filters to replace Levels using MaskTools. It lets you choose different gamma curves, e.g. to boost dark areas without washing out bright ones. Unlike Levels it does not clip values outside the given range; it also uses named/optional parameters, negating the need for wrappers.
  • Multiple clip comparison
BoxCompare will let you compare up to 4 clips with simple annotations. It's basically a wrapper for StackHorizontal/StackVertical.
  • Cdeint
Restores 24fps FILM out of a fieldblended FILM -> Telecine -> NTSC -> Blendconversion -> PAL - Video (alternative for Restore24).
  • DeRainbow
It removes rainbows on the clip, without any visible quality loss.
  • FunkyDeBlock
It gives VERY similar results to blindPP(quant=x,cpu=4) but can eliminate some bitrate pumping effects as well, an delivers a not-insignificant compressibility gain (not as much as removedirt, but hey, we can't all be geniuses).
  • mvfps-like functions
mvfpsflowscd, mvfpsscd, MVFlowBlur:
http://forum.doom9.org/showthread.php?t=105015
http://forum.doom9.org/showthread.php?t=102071
A free collection of 160+ functions -all coded in Avisynth script- installable as a single package, which both adds syntactic sugar to AviSynth script language and serves as an educational example of Avisynth script coding from the elementary up to advanced level. In particular, the implementation of arrays (every Avisynth script's variable type is supported) provides a powerful general-purpose tool to script writers.
  • PowerAnimate
Here is an example of many-times-nested animate functions resulting the possibility for very nice effects.
  • SubtitleMulti
A parameter-compatible Subtitle function which allows the usage of line breaks.
  • MoveField
Moves field 0 or 1 pixelwise.
  • Tint
Tints the image toward a specified colour.
  • AddHalos
Adds glowing halos to bright objects in a clip. Requires Donald Graft's BoxBlur plugin.
  • Diffusion
Adds a softening diffusion to a clip. Requires Donald Graft's BoxBlur plugin.
  • ZoomInFrames
Functions to zoom in some frames of a clip, with optional linear zoom-in/out. Can be used to remove banners, etc. from TV recordings that can't be removed by a delogo plugin.
  • RestoreSuper8Frames
RestoreSuper8Frames allows to synchronize your video camera and your projector purely by software(!) - provided you can slow down the projector to about 2/3 to 1/2 of the camera's frame rate.
Let us assume the camera runs faster than the projector, so one or more video frames per celluloid image occur in the video sequence. RestoreSuper8Frames evaluates the video sequence and picks the least combed frame for each captured celluloid image. The other returned frames are black. Further processing with MultiDecimate gives you exactly the celluloid images as video frames.
Hint: Some camcorders keep the previous field if they capture a black field. This occurs while the shutter is closed. It may be a good idea to capture with removed shutter, as proposed by Fizick.
  • FixChromaticAberration
FixChromaticAberration resizes (and crops) the red/green/blue channels of the image separately. This helps to minimize the colored edges next to the image corners that result from lenses with chromatic aberration.
  • SGradation
SGradation is much like a gamma function, but '2nd order'.
While gamma correction shifts the middle of the histogram to the left or right, SGradation leaves the midtones untouched. Instead, it adjusts the ranges near the ends towards the middle (or even more to the ends). This makes the light in the image look 'softer' or 'harder', without affecting black, white or the midtones.
SGradation is especially useful for images that look kinda 'gothic' because the capturing device could not cope with the dynamic range (contrast) of the source. I wrote and used it when I captured super 8 movies with a camcorder from a projector.
  • deVCR
deVCR elliminates (to a certain degree) the annoying horizontal lines that keep crawling around your VHS or Beta recorded video.

Add more here whenever you come across a cool/useful bit of code.


Back to Script Functions.

Personal tools