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.
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.
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.
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
[]
ornull
.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;