Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Filter<P>

Represents a native FFMPEG filter. Filters are made of four parts: a list of inputs, a name, some parameters, and finally, a list of outputs.

Some of those parts are optional. For example, some filters (sources) have no inputs: These can be represented by instantiating the **Filter class with an empty array [] or null.

const filter = new Filter( null, 'color', {
   color: 'black',
   size: `1920x1080`,
   rate: frameRate,
   duration: '5000'
} );

In the same line, not all filters require parameters, so those can be ommited (or an empty object {} can be passed).

const filter = new Filter( input, 'anullsink' );

When filters have more than one input, an array of streams can be provided. Similarly, by default this module allocates one output stream for each filter. In case a filter outputs more than one though, a fourth parameter can be provided indicating how many output streams should be allocated.

const concatFilter = new Filter(
   [ video1, audio1, video2, audio2 ],
   'concat',
   { n: 2, v: 1, a: 1 },
   2
);

In the example above, the concat filter generates two output streams: one for video, and one for audio (it is always v + a). These can be accessed through the Filter.outputs property, or by destructuring the filter itself.

const video = concatFilter.outputs[ 0 ];
const audio = concatFilter.outputs[ 1 ];
// Or equivalent
const [ video, audio ] = concatFilter;

Type parameters

Hierarchy

  • Filter

Implements

Index

Constructors

constructor

  • new Filter(inputs: Stream | Stream[], name: string, parameters?: P, outputs?: number): Filter
  • Parameters

    • inputs: Stream | Stream[]
    • name: string
    • Default value parameters: P = {} as any
    • Default value outputs: number = 1

    Returns Filter

Properties

Protected _customOutputsCount

_customOutputsCount: number = 1

inputs

inputs: Stream[] = []

name

name: string

outputs

outputs: FilterStreamRef<P, Filter<P>>[] = []

parameters

parameters: P

Accessors

dependencies

  • Returns IFragment[]

Methods

[Symbol.iterator]

clone

compile

compileArguments

  • compileArguments(compiler: ICompiler): string
  • Parameters

    Returns string

compileStreams

  • Parameters

    Returns string

getOutputCount

  • getOutputCount(): number
  • Returns number

getParameter

  • getParameter<T>(name: string, defaultValue?: T): T
  • Type parameters

    • T

    Parameters

    • name: string
    • Default value defaultValue: T = null

    Returns T

materialize

  • materialize(): string

named

  • named(...names: string[]): this
  • Parameters

    • Rest ...names: string[]

    Returns this

Protected rebuildOutputs

  • rebuildOutputs(): void
  • Returns void

Generated using TypeDoc