Class: Filter

AviSynth. Filter

new Filter(child)

A JavaScript-created filter. This allows you to write a custom filter using JavaScript. Replace the AviSynth.Filter#getFrame function with your own implementation to create your own filter.

Note that because the child is required to be present (the video information must be populated) - you can't extend this class in JavaScript.

FIXME: it should be possible to extend this class. This will probably be done by setting "defaults" for the video information. The entire set of video information required is basically the same as those taken by AviSynth's BlankClip filter: int "length", int "width", int "height", string "pixel_type", float "fps", int "fps_denominator", int "audio_rate", int "channels", string "sample_type", int "color", int "color_yuv"

Parameters:
Name Type Description
child AviSynth.VideoInfo the source filter to get frames from
Source:
See:

Extends

Members

<readonly> audioBits :number

The number of bits used in a single audio sample.
Type:
  • number
Inherited From:
Source:

<readonly> audioChannels :number

The number of audio channels.
Type:
  • number
Inherited From:
Source:

<readonly> audioLength :number

The total number of samples in the audio portion of the clip.
Type:
  • number
Inherited From:
Source:

<readonly> audioLengthF :number

The total number of samples in the audio portion of the clip. This is literally identical to the audioLength member and is included only for symmetry with the AviSynth scripting language.
Type:
  • number
Inherited From:
Source:

<readonly> audioRate :number

The audio rate of the clip in hertz.
Type:
  • number
Inherited From:
Source:

<readonly> child :AviSynth.VideoInfo

The child source of frames. If this was created without a child clip, this will return {@code null}.
Type:
Source:

<readonly> colorSpace :string

The exact colorspace the clip is in. (NOTE: A future version will likely replace the string return value with the corresponding AviSynth.ColorSpace object.)
Type:
  • string
Inherited From:
Source:

<readonly> frameCount :number

The number of frames available in the video clip.
Type:
  • number
Inherited From:
Source:

<readonly> frameRate :number

The frame rate of the clip as a floating point number. Note that it isn't stored that way internally - the actual frame rate is a ratio stored as integers. Those are available via the frameRateNumerator and frameRateDenominator members.
Type:
  • number
Inherited From:
Source:

<readonly> frameRateDenominator :number

The denominator of the frame rate ratio.
Type:
  • number
Inherited From:
Source:

<readonly> frameRateNumerator :number

The numerator of the frame rate ratio.
Type:
  • number
Inherited From:
Source:

<readonly> hasAudio :boolean

Whether or not the clip has audio.
Type:
  • boolean
Inherited From:
Source:

<readonly> hasVideo :boolean

Whether or not the clip has video.
Type:
  • boolean
Inherited From:
Source:

<readonly> height :number

The height of the video frame.
Type:
  • number
Inherited From:
Source:

<readonly> isAudioFloat :boolean

If the audio samples are floating point.
Type:
  • boolean
Inherited From:
Source:

<readonly> isAudioInt :boolean

If the audio samples are integers.
Type:
  • boolean
Inherited From:
Source:

<readonly> isFieldBased :boolean

Assuming the clip is interlaced (there's no flag for that in AviSynth), this indicates that both the top and bottom lines are stored in a single frame.
Type:
  • boolean
Inherited From:
Source:

<readonly> isFrameBased :boolean

Assuming the clip is interlaced (there's no flag for that in AviSynth), this indicates that the top and bottom lines are stored in separate frames.
Type:
  • boolean
Inherited From:
Source:

<readonly> isInterleaved :boolean

If the video is stored in an interleaved format.
Type:
  • boolean
Inherited From:
Source:
See:

<readonly> isPlanar :boolean

If the video is stored in a planar format.
Type:
  • boolean
Inherited From:
Source:
See:

<readonly> isRGB :boolean

If the color format is RGB. (RGB24 or RGB32.)
Type:
  • boolean
Inherited From:
Source:

<readonly> isRGB24 :boolean

If the color format is RGB24.
Type:
  • boolean
Inherited From:
Source:

<readonly> isRGB32 :boolean

If the color format is RGB32.
Type:
  • boolean
Inherited From:
Source:

<readonly> isYUV :boolean

If the color format is YUV. (YUY2 or YV12.)
Type:
  • boolean
Inherited From:
Source:

<readonly> isYUY2 :boolean

If the color format is YUY2.
Type:
  • boolean
Inherited From:
Source:

<readonly> isYV12 :boolean

If the color format is YV12.
Type:
  • boolean
Inherited From:
Source:

<readonly> width :number

The width of the video frame.
Type:
  • number
Inherited From:
Source:

Methods

getFrame(frame) → {AviSynth.VideoFrame}

Gets a single frame from the clip, assuming this clip has video. Unlike the AviSynth.Clip version, this is pure JavaScript, meaning you can replace this function with whatever you like.

The default implementation is simply:

function(n) { return this.child.getFrame(n); }

Parameters:
Name Type Description
frame number the frame to get (0-index, 0 is the first frame)
Source:
Returns:
a single video frame from the clip
Type
AviSynth.VideoFrame