stickboy's AviSynth Stuff

This page contains functions and plug-ins that I have written for AviSynth, an open-source, script-based, non-linear video editor.

My goals are to write functions and plug-ins that improve the expressiveness and readability of the scripting language; I want to make it easier for other people to write AviSynth scripts.

Functions

Documentation for each function is included in the script file itself. To use these functions, either download the .avsi script and copy it to your AviSynth plug-ins directory, or copy and paste the functions you want into your own script.

Some functions may require using the latest stable version of AviSynth and also may require jdl-util.avsi.

jdl-util.avsi

General-purpose, utility functions.
My other scripts are dependent on this file.

  • Min, Max, Clamp
    These functions are superceded by the more general versions in my Min/Max plug-in.
  • Quote, Endl
  • AssertEval
  • Throw
  • Undefined
  • NullClip
  • JDL_ImageSource (rationale and discussion)
  • Trim2, Trim3 (rationale and discussion)
    I recommend using these instead of Trim in your own user-defined functions.
  • JDL_LengthenClip
    Superceded by my ApplyEvery plugin.
  • SetParity
  • AssumeScaledFPS
  • JDL_ShiftFrame
  • NoArgFunctionWrapper (rationale and discussion)
    Allows the use of Animate or ApplyRange with functions or filters that take no arguments.
  • JDL_FunctionDefined
  • HasVideo, HasAudio

jdl-range.avsi

Functions that operate on ranges in a clip.

  • JDL_ApplyRange, JDL_ApplyRangeOld
  • JDL_ApplyFrame
  • JDL_ApplyEvery
    Superceded by my ApplyEvery plugin.
  • JDL_SimpleApplyEvery
  • JDL_DeleteRange
  • JDL_SingleFrame
  • JDL_ReplaceRange
  • JDL_FreezeRegion
  • JDL_FreezeLoop

jdl-telecine.avsi

Functions for use with telecined material.

  • JDL_Telecine
  • JDL_IVTCPattern, JDL_IVTCPattern2, JDL_IVTCPatternSegment
  • JDL_DecimatePattern, JDL_DecimatePattern2
  • JDL_ShowFrameOffset

jdl-interlace.avsi

Functions for use with interlaced material.

  • JDL_SelectField, JDL_SelectTopField, JDL_SelectBottomField
  • JDL_ReverseFieldDominance
  • JDL_UnfoldFieldsVertical, JDL_FoldFieldsVertical (rationale and discussion)
    These functions provide a means to use spatial-temporal filters on interlaced clips.
  • JDL_InterlacedResize
  • JDL_SimpleBob
  • JDL_DupeField
  • JDL_Interlace

jdl-effects.avsi

Functions for creating effects. Also includes miscellaneous, exotic, and specialized functions.

  • JDL_Blackout
  • JDL_Silence
  • JDL_FadeIO, JDL_FadeVideo, JDL_FadeAudio
  • JDL_Invert
  • JDL_Wipe (discussion)
  • JDL_MaskTransition (discussion)
  • JDL_Fill
  • JDL_Slow
  • JDL_ReplaceFirstScanline
  • JDL_SplitYUV, JDL_MergeYUV, JDL_SplitRGB
  • JDL_SplitScreenCompare

jdl-wrappers.avsi

Various wrapper functions.

Plug-ins (discussion)

Documentation for each plug-in is included. Source code also is included under a BSD-style license.

ApplyEvery

(v0.3.1) A collection of AviSynth functions that operate at regular intervals in a clip.

  • ApplyEvery
    Applies a filter at regular intervals in a clip.
  • DeleteEvery
    A complement to the built-in SelectEvery function.
  • DeleteFrames
    A variable-argument version of the built-in DeleteFrame function.
  • InterleaveEvery
    Mixes two clips together in a specified pattern. Undoes the work of SelectEvery and DeleteEvery.
  • RepeatEveryFrame
    Repeats every frame a specified number of times.
  • LengthenClip
  • WhileEval
    Provides a crude looping construct.

GetSystemEnv

(v0.3.0) Retrieves system environment variables.

  • GetSystemEnv
  • GetWorkingDir
  • SetWorkingDir
  • GetFileInfo

Min/Max

(v0.1.1) Min/Max functions that can take variable numbers of arguments.

RemapFrames

(v0.3.1) A collection of functions to rearrange frames between clips. Remaps the frame indices in a clip or from a second clip as specified by an input text file or by an input string. Efficient alternatives to long chains of FreezeFrame, DeleteFrame, or ApplyRange.

  • RemapFrames
  • RemapFramesSimple
  • ReplaceFramesSimple

SelectByString

(v0.3.0) A version of AviSynth's Select function that operates on strings

Shuffle

(v0.1.5) Randomly shuffles the frames in a clip.

TestHarness

(v0.1.1) Provides simple logging and testing functions. Intended primarily for use by developers.

  • LogOpen, LogClose, LogString
  • SetCacheHints
  • ScanClip
  • CompareFiles

Threshold

(v0.1.2) Threshold and coring functions. They map pixels darker than a specified threshold to pure black; all other pixels can be mapped to pure white or can be left untouched.

Other AviSynth Stuff

Working around AviSynth limitations

Other writings

Samples

TextPad syntax definition file for AviSynth

Revision history

2010-11-26
  • Fixed a mistake in JDL_IVTCPattern2. (Thanks, Mark I.!) typo in HasVideo. (Thanks, tacman1123!)
2008-10-16
  • Fixed a typo in HasVideo. (Thanks, tacman1123!)
2008-09-13
  • Added JDL_SimpleBob and JDL_InterlacedResize to jdl-interlace.avsi.
  • Adjusted some script comments.
2008-07-08
  • Added a link to logo-example.zip.
2008-06-28
  • Fixed a syntax error in JDL_SplitYUV. Oops.
2008-06-09
  • Added SetWorkingDir to my GetSystemEnv plug-in.
2006-09-24
  • Rewrote JDL_ImageSource in jdl-util.avsi.
  • Updated comments in a number of files. Many functions are now commented to list their external requirements.
2006-01-02
  • Created an RSS feed for updates.
  • Added preset-aware AssumeFPS/ChangeFPS/ConvertFPS wrappers to jdl-wrappers.avsi.
  • Added GetFileInfo to my GetSystemEnv plug-in and fixed a bug.
2005-08-26
  • Updated my RemapFrames plug-in. The RemapFrames function's argument handling was broken. I also updated the documentation to provide some examples for adapting existing AviSynth scripts.
2005-04-03
  • Added my GetSystemEnv plug-in. Moved GetWorkingDir from my TestHarness plug-in to GetSystemEnv.
2005-01-23
  • Added RepeatEveryFrame to my ApplyEvery plug-in. Fixed some integer overflow issues too.
2005-01-10
  • Added JDL_IVTCPatternSegment to my jdl-telecine.avsi.
  • Slight tweaks to JDL_ReverseFieldDominance.
2004-12-24
  • Added ReplaceFramesSimple to my RemapFrames plug-in.
2004-12-19
  • Added AssumeScaledFPS to jdl-util.avsi. Modified many of my other scripts to use it.
2004-12-07
  • Slight tweak to JDL_SimpleApplyEvery to filter first.
2004-09-26
  • Added JDL_FreezeLoop to jdl-range.avsi.
2004-08-14
  • Added RemapFramesSimple to my RemapFrames plug-in.
2004-07-26
  • Added HasAudio to jdl-util.avsi. Updated a number of functions in jdl-effects.avsi to handle clips without audio tracks correctly.
2004-07-07
  • Fixed an off-by-one discrepancy in JDL_Wipe. Added JDL_MaskTransition to jdl-effects.avsi.
2004-07-03
  • Added my TestHarness plug-in.
2004-06-26
  • Added my RemapFrames plug-in.
2004-06-13
  • jdl-effects.avsi now contains miscellaneous, exotic functions too. Moved JDL_ReplaceFirstScanline into it and added JDL_SplitYUV, JDL_MergeYUV, JDL_SplitRGB, and JDL_SplitScreenCompare.
2004-06-02
  • Improved error-checking in a number of functions. Split off JDL_ReverseFieldDominance, JDL_UnfoldFieldsVertical, JDL_FoldFieldsVertical, and JDL_Interlace into a separate jdl-interlace.avsi file. Added functions JDL_SelectField, JDL_SelectTopField, and JDL_SelectBottomField.
2004-05-31
  • I realized that JDL_ReverseFieldDominance and JDL_SimpleBob were kind of broken. I've rewritten JDL_ReverseFieldDominance and removed its bobFunc parameter; it now always uses AviSynth's internal Bob function. The behaviors of the various bob deinterlacers out there are too inconsistent, and keeping the bob function generic isn't worth it. Consequently, JDL_SimpleBob is no longer necessary, and I've removed it until it's fixed.
2004-04-13
  • Fixed a stupid Shuffle bug.
2004-04-10
  • Minor updates to ApplyEvery and Threshold.
2004-04-08
  • Added an else parameter to SelectByString/SelectByStringEval.
  • Updated JDL_Wipe and TemporalSoftenPreset to use the new version of SelectByString.
2004-04-03
  • Removed my FunctionDefined plug-in and replaced it with a user-defined function (JDL_FunctionDefined). A plug-in version doesn't make sense for script authors to use, since it has a chicken-and-egg problem.
  • JDL_Telecine and JDL_IVTCPattern now set the field-order correctly in the output clip.
  • Added WhileEval to my ApplyEvery plug-in.
2004-04-01
  • Added JDL_SimpleApplyEvery to jdl-range.avsi.
  • Modified JDL_LengthenClip and JDL_ApplyEvery to use my ApplyEvery plug-in if available.
  • Minor updates to ApplyEvery.
2004-03-31
  • Merged the ApplyEvery and DeleteEvery plug-ins and added a new InterleaveEvery function.
2004-03-20
  • I got tired of looking up the parameter order to Crop, so I added CropWrapper to jdl-wrappers.avsi. Oh, and the link's fixed too now.
  • Added Undefined and fixed a bug in JDL_ImageSource's compatibility check in jdl-util.avsi .
2004-03-20
  • Added an experimental ApplyEvery plug-in.
  • Modified JDL_ImageSource to work with the 2004-03-20 AviSynth alpha binary. Older AviSynth versions are still supported too.
2004-03-19
  • Added my DeleteEvery plug-in.
  • Improved error reporting in SelectByString.
2004-03-16
  • Added stricter argument checks to Threshold.
2004-03-15
  • Added stricter argument type-checking to SelectByString.
  • Modified seeding behavior to Shuffle and updated the Shuffle examples (again).
2004-03-14
  • Simplified JDL_Interlace and JDL_ReverseFieldDominance. (Hopefully I didn't break anything.)
  • Made the start and end parameters to JDL_ImageSource optional.
2004-03-12
  • Added my Threshold plug-in.
  • Updated the Shuffle examples.
2004-03-10
  • Added my FunctionDefined plug-in.
2004-03-09
  • Added my Shuffle plug-in.
  • Tweaked some of the error-handling code in SelectByString.
2004-03-07
  • Modified TemporalSoftenPreset to allow overriding of preset values.
  • Added Endl to jdl-util.avsi.
  • Added a link to WarpEnterprises' awesome triple-quote discovery and an article about (ab)using the ternary operator (both under "Working around AviSynth limitations").
  • Fixed a few omissions in the TextPad syntax definition file.
2004-03-03
  • Added my Min/Max plug-in.
  • Minor updates to the SelectByString documentation and examples.
2004-03-02
  • Updated my SelectByString plug-in. No longer requires AviSynth C. It also now includes better documentation and examples.
2004-02-29
  • Added jdl-wrappers.avsi.
  • Updated TextPad syntax definition file.
2004-02-02
  • I keep forgetting why DoubleWeave flips the field-order, so I wrote an article about it for reference.
2004-01-24
  • Fixed: JDL_FreezeRegion didn't work with YUY2 and didn't allow the start frame to be the same as the end frame.
2003-12-23
  • Added JDL_Slow to jdl-effects.avsi.
  • Moved JDL_Blackout, JDL_Silence, JDL_FadeIO, JDL_FadeVideo, and JDL_FadeAudio to jdl-effects.avsi.
2003-11-21
  • Added JDL_FadeIO and JDL_FadeVideo to jdl-util.avsi.
2003-11-03
  • Added JDL_FadeAudio to jdl-util.avsi.
  • Added JDL_Fill to jdl-effects.avsi.
  • Minor changes to jdl-telecine.avsi.
  • Added additional error-checking to JDL_ApplyRange.
2003-09-21
  • Changed the syntax to JDL_Blackout and JDL_Silence and moved them to jdl-util.avsi. They no longer operate on ranges directly and instead are intended to be used with ApplyRange (or JDL_ApplyRange). Be sure to use the latest version of AviSynth when using ApplyRange on audio.
  • Modified JDL_ApplyRange to filter before splicing (the old implementation spliced first). This change affects the behavior of temporal filters and of filters that operate on frame numbers. (It also more closely matches the behavior of the internal ApplyRange function.)
2003-09-13
  • Added my simplistic SelectByString AviSynth C plug-in.
2003-09-06
  • Added the following functions to jdl-util.avsi: quote, AssertEval, JDL_LengthenClip
  • Added JDL_ApplyEvery to jdl-range.avsi
  • Renamed most functions to avoid potential namespace clashes. It's ugly, I know, and I apologize for any inconvenience it causes.
2003-08-31
  • Modified IVTCPattern/IVTCPattern2 slightly (again).
2003-08-20
  • Oops, I broke Trim2's support for negative values of end. Should be fixed now, hopefully without breaking anything else.
2003-08-16
  • Fixed: ReplaceRange/BlankRange/Blackout/Silence didn't work if the range was at the start or at the end of a clip.
  • Added an option to ReverseFieldDominance to bob-deinterlace the first and last frames of the output clip. I'm not sure how useful this is.
  • Added the following functions to jdl-util.avsi: min, max, clamp, SimpleBob, ShiftFrame
  • Modified IVTCPattern/IVTCPattern2 slightly.
2003-08-13
  • Modified a number of functions to handle null clips properly.
  • Bounds-checking for Trim2 significantly relaxed; now allows bounds beyond the end of the clip.
2003-08-09
  • Initial release of scripts.
RSS 2.0
Questions? Comments? Bugs? I welcome feedback. Contact me.
Please direct general AviSynth questions to the AviSynth Usage forum on doom9.org.

Written by James D. Lin (stickboy) and assigned to the public domain.