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.


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.


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


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


Functions for use with telecined material.

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


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


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


Various wrapper functions.

Plug-ins (discussion)

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


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


(v0.3.0) Retrieves system environment variables.

  • GetSystemEnv
  • GetWorkingDir
  • SetWorkingDir
  • GetFileInfo


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


(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


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


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


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

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


(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


TextPad syntax definition file for AviSynth

Revision history

  • Fixed a mistake in JDL_IVTCPattern2. (Thanks, Mark I.!) typo in HasVideo. (Thanks, tacman1123!)
  • Fixed a typo in HasVideo. (Thanks, tacman1123!)
  • Added JDL_SimpleBob and JDL_InterlacedResize to jdl-interlace.avsi.
  • Adjusted some script comments.
  • Added a link to
  • Fixed a syntax error in JDL_SplitYUV. Oops.
  • Added SetWorkingDir to my GetSystemEnv plug-in.
  • Rewrote JDL_ImageSource in jdl-util.avsi.
  • Updated comments in a number of files. Many functions are now commented to list their external requirements.
  • 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.
  • 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.
  • Added my GetSystemEnv plug-in. Moved GetWorkingDir from my TestHarness plug-in to GetSystemEnv.
  • Added RepeatEveryFrame to my ApplyEvery plug-in. Fixed some integer overflow issues too.
  • Added JDL_IVTCPatternSegment to my jdl-telecine.avsi.
  • Slight tweaks to JDL_ReverseFieldDominance.
  • Added ReplaceFramesSimple to my RemapFrames plug-in.
  • Added AssumeScaledFPS to jdl-util.avsi. Modified many of my other scripts to use it.
  • Slight tweak to JDL_SimpleApplyEvery to filter first.
  • Added JDL_FreezeLoop to jdl-range.avsi.
  • Added RemapFramesSimple to my RemapFrames plug-in.
  • Added HasAudio to jdl-util.avsi. Updated a number of functions in jdl-effects.avsi to handle clips without audio tracks correctly.
  • Fixed an off-by-one discrepancy in JDL_Wipe. Added JDL_MaskTransition to jdl-effects.avsi.
  • Added my TestHarness plug-in.
  • Added my RemapFrames plug-in.
  • 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.
  • 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.
  • 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.
  • Fixed a stupid Shuffle bug.
  • Minor updates to ApplyEvery and Threshold.
  • Added an else parameter to SelectByString/SelectByStringEval.
  • Updated JDL_Wipe and TemporalSoftenPreset to use the new version of SelectByString.
  • 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.
  • 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.
  • Merged the ApplyEvery and DeleteEvery plug-ins and added a new InterleaveEvery function.
  • 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 .
  • 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.
  • Added my DeleteEvery plug-in.
  • Improved error reporting in SelectByString.
  • Added stricter argument checks to Threshold.
  • Added stricter argument type-checking to SelectByString.
  • Modified seeding behavior to Shuffle and updated the Shuffle examples (again).
  • Simplified JDL_Interlace and JDL_ReverseFieldDominance. (Hopefully I didn't break anything.)
  • Made the start and end parameters to JDL_ImageSource optional.
  • Added my Threshold plug-in.
  • Updated the Shuffle examples.
  • Added my FunctionDefined plug-in.
  • Added my Shuffle plug-in.
  • Tweaked some of the error-handling code in SelectByString.
  • 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.
  • Added my Min/Max plug-in.
  • Minor updates to the SelectByString documentation and examples.
  • Updated my SelectByString plug-in. No longer requires AviSynth C. It also now includes better documentation and examples.
  • Added jdl-wrappers.avsi.
  • Updated TextPad syntax definition file.
  • I keep forgetting why DoubleWeave flips the field-order, so I wrote an article about it for reference.
  • Fixed: JDL_FreezeRegion didn't work with YUY2 and didn't allow the start frame to be the same as the end frame.
  • Added JDL_Slow to jdl-effects.avsi.
  • Moved JDL_Blackout, JDL_Silence, JDL_FadeIO, JDL_FadeVideo, and JDL_FadeAudio to jdl-effects.avsi.
  • Added JDL_FadeIO and JDL_FadeVideo to jdl-util.avsi.
  • 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.
  • 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.)
  • Added my simplistic SelectByString AviSynth C plug-in.
  • 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.
  • Modified IVTCPattern/IVTCPattern2 slightly (again).
  • Oops, I broke Trim2's support for negative values of end. Should be fixed now, hopefully without breaking anything else.
  • 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.
  • 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.
  • 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

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