Skip to content

enums

Classes:

  • FlowMode

    Controls how motion vectors are applied to pixels.

  • MVDirection

    Motion vector analyze direction.

  • MVToolsPlugin

    Abstraction around both mvtools plugin versions.

  • MaskMode

    Defines the type of analysis mask to generate.

  • MotionMode

    Controls how motion vectors are searched and selected.

  • PenaltyMode

    Controls how motion estimation penalties scale with hierarchical levels.

  • RFilterMode

    Hierarchical levels smoothing and reducing (halving) filter.

  • SADMode

    Specifies how block differences (SAD) are calculated between frames.

  • SearchMode

    Decides the type of search at every level.

  • SharpMode

    Subpixel interpolation method for pel = 2 or 4.

  • SmoothMode

    This is method for dividing coarse blocks into smaller ones.

FlowMode

Bases: CustomIntEnum

Controls how motion vectors are applied to pixels.

Attributes:

  • ABSOLUTE

    Motion vectors point directly to destination pixels.

  • RELATIVE

    Motion vectors describe how source pixels should be shifted.

ABSOLUTE class-attribute instance-attribute

ABSOLUTE = 0

Motion vectors point directly to destination pixels.

RELATIVE class-attribute instance-attribute

RELATIVE = 1

Motion vectors describe how source pixels should be shifted.

MVDirection

Bases: IntFlag

Motion vector analyze direction.

Attributes:

  • BACKWARD

    Backward motion compensation.

  • BOTH

    Backward and forward motion compensation.

  • FORWARD

    Forward motion compensation.

BACKWARD class-attribute instance-attribute

BACKWARD = 1

Backward motion compensation.

BOTH class-attribute instance-attribute

BOTH = BACKWARD | FORWARD

Backward and forward motion compensation.

FORWARD class-attribute instance-attribute

FORWARD = 2

Forward motion compensation.

MVToolsPlugin

Bases: CustomIntEnum

Abstraction around both mvtools plugin versions.

Methods:

  • Degrain

    Get the Degrain function for motion compensated denoising.

  • from_video

    Automatically select the appropriate plugin based on the given clip.

Attributes:

  • Analyze (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the Analyze function for analyzing motion vectors.

  • BlockFPS (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the BlockFPS function for block-based frame rate conversion.

  • Compensate (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the Compensate function for motion compensation.

  • FLOAT

    Fork by IFeelBloated. Only works with float single precision clips.

  • Flow (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the Flow function for motion vector visualization.

  • FlowBlur (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the FlowBlur function for motion-compensated frame blending.

  • FlowFPS (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the FlowFPS function for motion-compensated frame rate conversion.

  • FlowInter (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the FlowInter function for motion-compensated frame interpolation.

  • INTEGER

    Original plugin. Only accepts integer 8-16 bits clips.

  • Mask (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the Mask function for generating motion masks.

  • Recalculate (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the Recalculate function for refining motion vectors.

  • SCDetection (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the SCDetection function for scene change detection.

  • Super (VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]) –

    Get the Super function for creating motion vector clips.

  • namespace (Any) –

    Get the appropriate MVTools namespace based on plugin type.

Analyze property

Analyze: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Analyze function for analyzing motion vectors.

BlockFPS property

BlockFPS: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the BlockFPS function for block-based frame rate conversion.

Compensate property

Compensate: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Compensate function for motion compensation.

FLOAT class-attribute instance-attribute

FLOAT = 1

Fork by IFeelBloated. Only works with float single precision clips.

Flow property

Flow: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Flow function for motion vector visualization.

FlowBlur property

FlowBlur: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the FlowBlur function for motion-compensated frame blending.

FlowFPS property

FlowFPS: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the FlowFPS function for motion-compensated frame rate conversion.

FlowInter property

FlowInter: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the FlowInter function for motion-compensated frame interpolation.

INTEGER class-attribute instance-attribute

INTEGER = 0

Original plugin. Only accepts integer 8-16 bits clips.

Mask property

Mask: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Mask function for generating motion masks.

Recalculate property

Recalculate: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Recalculate function for refining motion vectors.

SCDetection property

SCDetection: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the SCDetection function for scene change detection.

Super property

Super: VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Super function for creating motion vector clips.

namespace property

namespace: Any

Get the appropriate MVTools namespace based on plugin type.

Degrain

Degrain(
    tr: int | None = None,
) -> VSFunctionAllArgs[VideoNode, ConstantFormatVideoNode]

Get the Degrain function for motion compensated denoising.

Source code
102
103
104
105
106
107
108
109
110
111
def Degrain(self, tr: int | None = None) -> VSFunctionAllArgs[vs.VideoNode, ConstantFormatVideoNode]:
    """Get the Degrain function for motion compensated denoising."""

    if tr is None and self is not MVToolsPlugin.FLOAT:
        raise CustomValueError('This implementation needs a temporal radius!', f'{self.name}.Degrain')

    try:
        return getattr(self.namespace, f"Degrain{fallback(tr, '')}")
    except AttributeError:
        raise CustomValueError('This temporal radius isn\'t supported!', f'{self.name}.Degrain', tr)

from_video classmethod

from_video(clip: VideoNode) -> MVToolsPlugin

Automatically select the appropriate plugin based on the given clip.

Parameters:

  • clip

    (VideoNode) –

    The clip to process.

Returns:

  • MVToolsPlugin

    The accompanying MVTools plugin for the clip.

Source code
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
@classmethod
def from_video(cls, clip: vs.VideoNode) -> MVToolsPlugin:
    """
    Automatically select the appropriate plugin based on the given clip.

    :param clip:    The clip to process.

    :return:        The accompanying MVTools plugin for the clip.
    """
    assert check_variable_format(clip, cls.from_video)

    if clip.format.sample_type is vs.FLOAT:
        return MVToolsPlugin.FLOAT

    return MVToolsPlugin.INTEGER

MaskMode

Bases: CustomIntEnum

Defines the type of analysis mask to generate.

Attributes:

  • COLORMAP

    Creates a color visualization of motion vectors, mapping x/y components to U/V planes.

  • HORIZONTAL

    Visualizes horizontal motion vector components. Values are in pixels + 128.

  • MOTION

    Generates a mask based on motion vector magnitudes.

  • OCCLUSION

    Generates a mask highlighting areas where motion estimation fails due to occlusion.

  • SAD

    Generates a mask based on SAD (Sum of Absolute Differences) values.

  • VERTICAL

    Visualizes vertical motion vector components. Values are in pixels + 128.

COLORMAP class-attribute instance-attribute

COLORMAP = 5

Creates a color visualization of motion vectors, mapping x/y components to U/V planes.

HORIZONTAL class-attribute instance-attribute

HORIZONTAL = 3

Visualizes horizontal motion vector components. Values are in pixels + 128.

MOTION class-attribute instance-attribute

MOTION = 0

Generates a mask based on motion vector magnitudes.

OCCLUSION class-attribute instance-attribute

OCCLUSION = 2

Generates a mask highlighting areas where motion estimation fails due to occlusion.

SAD class-attribute instance-attribute

SAD = 1

Generates a mask based on SAD (Sum of Absolute Differences) values.

VERTICAL class-attribute instance-attribute

VERTICAL = 4

Visualizes vertical motion vector components. Values are in pixels + 128.

MotionMode

Bases: CustomIntEnum

Controls how motion vectors are searched and selected.

Provides presets that configure multiple motion estimation parameters like lambda, LSAD threshold, and penalty values to optimize for either raw SAD scores or motion coherence.

Attributes:

  • COHERENCE

    Optimize for motion vector coherence, preferring vectors that align with surrounding blocks.

  • SAD

    Optimize purely for lowest SAD scores when searching motion vectors.

COHERENCE class-attribute instance-attribute

COHERENCE = 1

Optimize for motion vector coherence, preferring vectors that align with surrounding blocks.

SAD class-attribute instance-attribute

SAD = 0

Optimize purely for lowest SAD scores when searching motion vectors.

PenaltyMode

Bases: CustomIntEnum

Controls how motion estimation penalties scale with hierarchical levels.

Attributes:

  • LINEAR

    Penalties scale linearly with hierarchical level size.

  • NONE

    Penalties remain constant across all hierarchical levels.

  • QUADRATIC

    Penalties scale quadratically with hierarchical level size.

LINEAR class-attribute instance-attribute

LINEAR = 1

Penalties scale linearly with hierarchical level size.

NONE class-attribute instance-attribute

NONE = 0

Penalties remain constant across all hierarchical levels.

QUADRATIC class-attribute instance-attribute

QUADRATIC = 2

Penalties scale quadratically with hierarchical level size.

RFilterMode

Bases: CustomIntEnum

Hierarchical levels smoothing and reducing (halving) filter.

Attributes:

  • AVERAGE

    Simple 4 pixels averaging.

  • CUBIC

    Cubic filter for even more smoothing.

  • QUADRATIC

    Quadratic filter for even more smoothing.

  • TRIANGLE

    Triangle filter for even more smoothing.

  • TRIANGLE_SHIFTED

    Triangle (shifted) filter for more smoothing (decrease aliasing).

AVERAGE class-attribute instance-attribute

AVERAGE = 0

Simple 4 pixels averaging.

CUBIC class-attribute instance-attribute

CUBIC = 4

Cubic filter for even more smoothing.

QUADRATIC class-attribute instance-attribute

QUADRATIC = 3

Quadratic filter for even more smoothing.

TRIANGLE class-attribute instance-attribute

TRIANGLE = 2

Triangle filter for even more smoothing.

TRIANGLE_SHIFTED class-attribute instance-attribute

TRIANGLE_SHIFTED = 1

Triangle (shifted) filter for more smoothing (decrease aliasing).

SADMode

Bases: CustomIntEnum

Specifies how block differences (SAD) are calculated between frames. Can use spatial data, DCT coefficients, SATD, or combinations to improve motion estimation.

Attributes:

  • ADAPTIVE_SATD_DCT

    Adaptively choose between SATD data or DCT-weighted mixed mode for each block.

  • ADAPTIVE_SATD_LUMA

    Adaptively use SATD weighted by SAD, but only when there are significant luma changes.

  • ADAPTIVE_SATD_MIXED

    Adaptively choose between SATD data or an equal mix of SATD and DCT data for each block.

  • ADAPTIVE_SPATIAL_DCT

    Adaptively choose between spatial data or DCT-weighted mixed mode for each block.

  • ADAPTIVE_SPATIAL_MIXED

    Adaptively choose between spatial data or an equal mix of spatial and DCT data for each block.

  • DCT

    Calculate differences using DCT coefficients. Slower, especially for block sizes other than 8x8.

  • MIXED_SADEQSATD_DCT

    Mix of SAD, SATD and DCT data. Weight varies from SAD-only to equal SAD/SATD mix.

  • MIXED_SATD_DCT

    Use both SATD and DCT data, weighted based on the average luma difference between frames.

  • MIXED_SPATIAL_DCT

    Use both spatial and DCT data, weighted based on the average luma difference between frames.

  • SATD

    Use Sum of Absolute Transformed Differences (SATD) instead of SAD for luma comparison.

  • SPATIAL

    Calculate differences using raw pixel values in spatial domain.

ADAPTIVE_SATD_DCT class-attribute instance-attribute

ADAPTIVE_SATD_DCT = 8

Adaptively choose between SATD data or DCT-weighted mixed mode for each block.

ADAPTIVE_SATD_LUMA class-attribute instance-attribute

ADAPTIVE_SATD_LUMA = 10

Adaptively use SATD weighted by SAD, but only when there are significant luma changes.

ADAPTIVE_SATD_MIXED class-attribute instance-attribute

ADAPTIVE_SATD_MIXED = 7

Adaptively choose between SATD data or an equal mix of SATD and DCT data for each block.

ADAPTIVE_SPATIAL_DCT class-attribute instance-attribute

ADAPTIVE_SPATIAL_DCT = 4

Adaptively choose between spatial data or DCT-weighted mixed mode for each block.

ADAPTIVE_SPATIAL_MIXED class-attribute instance-attribute

ADAPTIVE_SPATIAL_MIXED = 3

Adaptively choose between spatial data or an equal mix of spatial and DCT data for each block.

DCT class-attribute instance-attribute

DCT = 1

Calculate differences using DCT coefficients. Slower, especially for block sizes other than 8x8.

MIXED_SADEQSATD_DCT class-attribute instance-attribute

MIXED_SADEQSATD_DCT = 9

Mix of SAD, SATD and DCT data. Weight varies from SAD-only to equal SAD/SATD mix.

MIXED_SATD_DCT class-attribute instance-attribute

MIXED_SATD_DCT = 6

Use both SATD and DCT data, weighted based on the average luma difference between frames.

MIXED_SPATIAL_DCT class-attribute instance-attribute

MIXED_SPATIAL_DCT = 2

Use both spatial and DCT data, weighted based on the average luma difference between frames.

SATD class-attribute instance-attribute

SATD = 5

Use Sum of Absolute Transformed Differences (SATD) instead of SAD for luma comparison.

SPATIAL class-attribute instance-attribute

SPATIAL = 0

Calculate differences using raw pixel values in spatial domain.

SearchMode

Bases: CustomIntEnum

Decides the type of search at every level.

Attributes:

  • DIAMOND

    Logarithmic search, also named Diamond Search.

  • EXHAUSTIVE

    Exhaustive search, square side is 2 * radius + 1. It's slow, but gives the best results SAD-wise.

  • EXHAUSTIVE_H

    Pure horizontal exhaustive search, width is 2 * radius + 1.

  • EXHAUSTIVE_V

    Pure vertical exhaustive search, height is 2 * radius + 1.

  • HEXAGON

    Hexagon search (similar to x264).

  • NSTEP

    N step searches.

  • ONETIME

    One time search.

  • UMH

    Uneven Multi Hexagon search (similar to x264).

DIAMOND class-attribute instance-attribute

DIAMOND = 2

Logarithmic search, also named Diamond Search.

EXHAUSTIVE class-attribute instance-attribute

EXHAUSTIVE = 3

Exhaustive search, square side is 2 * radius + 1. It's slow, but gives the best results SAD-wise.

EXHAUSTIVE_H class-attribute instance-attribute

EXHAUSTIVE_H = 6

Pure horizontal exhaustive search, width is 2 * radius + 1.

EXHAUSTIVE_V class-attribute instance-attribute

EXHAUSTIVE_V = 7

Pure vertical exhaustive search, height is 2 * radius + 1.

HEXAGON class-attribute instance-attribute

HEXAGON = 4

Hexagon search (similar to x264).

NSTEP class-attribute instance-attribute

NSTEP = 1

N step searches.

ONETIME class-attribute instance-attribute

ONETIME = 0

One time search.

UMH class-attribute instance-attribute

UMH = 5

Uneven Multi Hexagon search (similar to x264).

SharpMode

Bases: CustomIntEnum

Subpixel interpolation method for pel = 2 or 4.

This enum controls the calculation of the first level only. If pel=4, bilinear interpolation is always used to compute the second level.

Attributes:

  • BICUBIC

    Bicubic interpolation (4-tap Catmull-Rom).

  • BILINEAR

    Soft bilinear interpolation.

  • WIENER

    Sharper Wiener interpolation (6-tap, similar to Lanczos).

BICUBIC class-attribute instance-attribute

BICUBIC = 1

Bicubic interpolation (4-tap Catmull-Rom).

BILINEAR class-attribute instance-attribute

BILINEAR = 0

Soft bilinear interpolation.

WIENER class-attribute instance-attribute

WIENER = 2

Sharper Wiener interpolation (6-tap, similar to Lanczos).

SmoothMode

Bases: CustomIntEnum

This is method for dividing coarse blocks into smaller ones.

Attributes:

  • BILINEAR

    Bilinear interpolation of 4 neighbors.

  • NEAREST

    Use motion of nearest block.

BILINEAR class-attribute instance-attribute

BILINEAR = 1

Bilinear interpolation of 4 neighbors.

NEAREST class-attribute instance-attribute

NEAREST = 0

Use motion of nearest block.