From Avisynth wiki
Jump to: navigation, search
Author mysteryx93
Version v1.3
Category Frame Rate Converters
Discussion Doom9 Forum



Script and plugin set to increase the frame rate with interpolation and fine artifact removal.


Required Plugins

Latest versions of the following filters are recommended unless stated otherwise.

Syntax and Parameters


Script containing FrameRateConverter() and InterpolateDoubles() functions.


FrameRateConverter (clip C, int "NewNum", int "NewDen", string "Preset", int "BlkSize", int "BlkSizeV", bool "FrameDouble", string "Output", bool "Debug", clip "Prefilter", int "MaskThr", int "MaskOcc", int "SkipThr", int "BlendOver", int "SkipOver", bool "Stp", int "Dct", int "DctRe", int "BlendRatio")

clip   =
Input clip.

int  NewNum =
The new framerate numerator (if FrameDouble = false, default = 60).

int  NewDen =
The new framerate denominator (if FrameDouble = false, default = 1)

string  Preset = "normal"
The speed/quality preset: [ "slowest" | "slower" | "slow" | "normal" | "fast" | "faster" | "anime" ]

int  BlkSize =
The block size; available sizes are 6, 8, 12, 16, 24, 32, 48 and 64.
Defaults for 4/3 video of height:
  • 0-359: 8
  • 360-749: 12
  • 750-1199: 16
  • 1200-1699: 24
  • 1600-2160: 32

int  BlkSizeV = BlkSize
The vertical block size. (default = BlkSize)

bool  FrameDouble = true
Whether to double the frame rate and preserve original frames (default = true)

string  Output = "auto"
Output mode [ "auto" | "flow" | "over" | "none" | "raw" | "mask" | "skip" |" diff" | "stripe" ] (default = "auto")
auto=normal artifact masking; flow=interpolation only; over=mask as cyan overlay, stripes mask as yellow; none=ConvertFPS only; raw=raw mask;
mask=mask only; skip=mask used to Skip; diff=mask where alternate interpolation is better; stripe=mask used to cover stripes.

bool  Debug = false
Whether to display AverageLuma values of Skip, Mask and Raw. (Default = false)

clip  Prefilter = none
Specifies a prefilter such as RgTools' RemoveGrain(21). Recommended only when not using a denoiser (Default=none)

int  MaskThr = 120
The threshold where a block is considered bad, between 0 and 255. Smaller = stronger.
0 to disable artifact masking. (Default = 120)

int  MaskOcc = 105
Occlusion mask threshold, between 0 and 255. 0 to disable occlusion masking. (Default = 105)

int  SkipThr = 55
The threshold where a block is counted for the skip mask, between 0 and 255. Smaller = stronger.
Must be smaller (stronger) than MaskThr. (Default = 55)

int  BlendOver = 70
Try fallback block size when artifacts cover more than specified threshold, or 0 to disable.
If it fails again, it will revert to frame blending. (default = 70)

int  SkipOver = 210
Skip interpolation of frames when artifacts cover more than specified threshold, or 0 to disable. (Default = 210)

bool  Stp = true
Whether to detect and blend stripes (default=true)

int  Dct = 0
Overrides DCT parameter for MAnalyse (default: Normal=0, Slow=4, Slowest=1)

int  DctRe = 0
Overrides DCT parameter for MRecalculate (default: Fast=0, Normal=4, Slowest=1)

int  BlendRatio = 40
Changes the blend ratio used to fill artifact zones. 0 = frame copy and 100 = full blend.
Other values provide a result in-between to eliminate ghost effects. Default = 40.


Replace double frames with interpolated frames using FrameRateConverter.

InterpolateDoubles (clip C, float "Thr", bool "Show", string "Preset", int "BlkSize", int "BlkSizeV", int "MaskThr", int "MaskOcc", int "SkipThr", int "BlendOver", int "SkipOver", bool "Stp", int "Dct", int "DctRe")

clip   =
Input clip.

float  Thr = 0.1
Frames will be replaced when Luma difference with previous frame is greater than threshold (default=0.1)

bool  Show = false
If true, "FRAME FIXED" will be written on replaced frames (default=false)

All other parameters are the same as FrameRateConverter().


Plugin containing StripeMask(), ContinuousMask(), ConvertFpsLimit(), and ConditionalFilterMT functions.


Builds a mask detecting horizontal and vertical straight lines and patterns, as MvTools tends to fail in such areas.

StripeMask (clip, int "blksize", int "blksizev", int "overlap", int "overlapv", int "thr", int "Comp", int "CompV", int "str", int "strf", bool "lines")

clip   =
Input clip.

int  blksize = 16
int  blksizev = blksize
The horizontal and vertical block size. (default: BlkSize=16, BlkSizeV=BlkSize)

int  overlap = blksize/4
int  overlap = blksize/4
How many pixels to overlap between blocks, generally between 1/4 and 1/2 of block size. (default = BlkSize/4)

int  thr = 26
Dynamic content gives blended (grey) line averages while lines and stripes have contrast between average values. This specifies the contrast threshold where a line average is taken for calculations. A lower value gives a stronger and more sensitive mask. (default = 26)

int  Comp =
int  CompV =
How many lines averages to compare with each other. (default = 2 with BlkSize<16 and 3 with BlkSize>=16)

int  str = 255
The value to set on the mask when a pattern is detected, between 0 and 255. (default = 255)

int  strf = 0
If > 0, calculates the next frame and set its patterns to this value, between 0 and 255. (default = 0)

bool  lines = false
If true, display the raw contrast lines being used for calculations. If false, the pattern areas between those lines will be marked. (default = false)


ContinuousMask (clip, int "radius")

clip   =
Input clip.

int  radius = 16
Radius must be above 1.


Same as ConvertFps but with an extra parameter.

ConvertFpsLimit (clip, int numerator, int denominator, int "zone", int "vbi", int "ratio")

clip   =
Input clip.

int   =
int   =
The new framerate is set to numerator divided by denominator.

int  zone = -1
If specified, puts the filter into Switch mode. Must be greater or equal to zero. If zero, the filter will perform a hard switch, that is, it will immediately display the next frame below the switch line. If greater than zero, specifies the height (in lines) of the transition zone, where one frame is gradually blended into the next.

int  vbi = 0
If specified in Switch mode, specifies that the filter should apply a timing correction for the vertical blanking interval (VBI). Integer number greater than zero, indicating the height of the VBI of the target frames, in lines.

int  ratio = 100
Changes the blend ratio. 0 = frame copy and 100 = full blend. Other values provide a result in-between to eliminate ghost effects. Default = 100.


Avisynth+ MT provides great capabilities to process videos. However, conditional functions are not compatible with MT (multi-threading) due to design limitations. To work around this problem, this class provides a subset of conditional features that will work with MT mode.

Currently supported: ConditionalFilter
ConditionalFilterMT (clip testclip, clip source1, clip source2, string expression1, string expression2, string expression3, bool "show")

Example: this will apply blur to all frames with AverageLuma < 50

vid = AviSource("Source.avi")
vid_blur = vid.Blur(1.5)
ConditionalFilterMT(vid, vid_blur, vid, "AverageLuma", "lessthan", "50")

All the standard function expressions are supported. However, only a single plain function name is supported -- no expression. Do not include parenthesis.

  • AverageLuma
  • AverageChromaU
  • AverageChromaV
  • RGBDifference
  • LumaDifference
  • ChromaUDifference
  • ChromaVDifference
  • YDifferenceFromPrevious
  • UDifferenceFromPrevious
  • VDifferenceFromPrevious
  • RGBDifferenceFromPrevious
  • YDifferenceToNext
  • UDifferenceToNext
  • VDifferenceToNext
  • RGBDifferenceToNext
  • YPlaneMax
  • YPlaneMin
  • YPlaneMedian
  • UPlaneMax
  • UPlaneMin
  • UPlaneMedian
  • VPlaneMax
  • VPlaneMin
  • VPlaneMedian
  • YPlaneMinMaxDifference
  • UPlaneMinMaxDifference
  • VPlaneMinMaxDifference

Functions comparing two clips will compare testclip with source1. Some functions have threshold and offset parameters. These parameters are not currently supported and are left at 0.





External Links

  • GitHub - Source code repository.

Back to External Filters

Personal tools