node-av 1.0.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -41
- package/dist/api/bitstream-filter.d.ts +180 -123
- package/dist/api/bitstream-filter.js +182 -126
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +286 -130
- package/dist/api/decoder.js +321 -159
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +254 -158
- package/dist/api/encoder.js +326 -298
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +912 -0
- package/dist/api/filter-presets.js +1407 -0
- package/dist/api/filter-presets.js.map +1 -0
- package/dist/api/filter.d.ts +280 -284
- package/dist/api/filter.js +435 -509
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +226 -159
- package/dist/api/hardware.js +405 -287
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +3 -2
- package/dist/api/index.js +1 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +65 -61
- package/dist/api/io-stream.js +45 -47
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +244 -141
- package/dist/api/media-input.js +207 -104
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +206 -128
- package/dist/api/media-output.js +212 -129
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +168 -38
- package/dist/api/pipeline.js +238 -14
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +22 -182
- package/dist/api/utilities/audio-sample.d.ts +1 -1
- package/dist/api/utilities/image.d.ts +1 -1
- package/dist/api/utilities/media-type.d.ts +1 -1
- package/dist/api/utilities/pixel-format.d.ts +1 -1
- package/dist/api/utilities/sample-format.d.ts +1 -1
- package/dist/api/utilities/timestamp.d.ts +1 -1
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.js +9 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/{lib → constants}/channel-layouts.d.ts +1 -1
- package/dist/constants/channel-layouts.js.map +1 -0
- package/dist/{lib → constants}/constants.d.ts +19 -4
- package/dist/{lib → constants}/constants.js +15 -1
- package/dist/constants/constants.js.map +1 -0
- package/dist/constants/decoders.d.ts +609 -0
- package/dist/constants/decoders.js +617 -0
- package/dist/constants/decoders.js.map +1 -0
- package/dist/constants/encoders.d.ts +285 -0
- package/dist/constants/encoders.js +298 -0
- package/dist/constants/encoders.js.map +1 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +5 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +128 -171
- package/dist/lib/audio-fifo.js +130 -173
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.d.ts +7 -5
- package/dist/lib/binding.js +5 -0
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +139 -184
- package/dist/lib/bitstream-filter-context.js +139 -188
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/bitstream-filter.d.ts +69 -55
- package/dist/lib/bitstream-filter.js +68 -54
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +317 -381
- package/dist/lib/codec-context.js +316 -381
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +161 -171
- package/dist/lib/codec-parameters.js +162 -172
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +92 -105
- package/dist/lib/codec-parser.js +92 -103
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +328 -217
- package/dist/lib/codec.js +392 -218
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +150 -204
- package/dist/lib/dictionary.js +159 -213
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +97 -131
- package/dist/lib/error.js +98 -128
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +317 -194
- package/dist/lib/filter-context.js +335 -200
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +252 -293
- package/dist/lib/filter-graph.js +253 -294
- package/dist/lib/filter-graph.js.map +1 -1
- package/dist/lib/filter-inout.d.ts +87 -95
- package/dist/lib/filter-inout.js +87 -95
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/filter.d.ts +93 -111
- package/dist/lib/filter.js +94 -112
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +321 -429
- package/dist/lib/format-context.js +314 -386
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +263 -406
- package/dist/lib/frame.js +263 -408
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +150 -204
- package/dist/lib/hardware-device-context.js +149 -203
- package/dist/lib/hardware-device-context.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +171 -181
- package/dist/lib/hardware-frames-context.js +171 -181
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/index.d.ts +2 -3
- package/dist/lib/index.js +2 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/input-format.d.ts +90 -118
- package/dist/lib/input-format.js +89 -117
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +210 -242
- package/dist/lib/io-context.js +221 -253
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +86 -120
- package/dist/lib/log.js +85 -122
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +127 -112
- package/dist/lib/native-types.js +9 -0
- package/dist/lib/native-types.js.map +1 -1
- package/dist/lib/option.d.ts +285 -242
- package/dist/lib/option.js +310 -250
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +78 -102
- package/dist/lib/output-format.js +77 -101
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +173 -241
- package/dist/lib/packet.js +172 -241
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/rational.d.ts +0 -2
- package/dist/lib/rational.js +0 -2
- package/dist/lib/rational.js.map +1 -1
- package/dist/lib/software-resample-context.d.ts +242 -326
- package/dist/lib/software-resample-context.js +242 -326
- package/dist/lib/software-resample-context.js.map +1 -1
- package/dist/lib/software-scale-context.d.ts +130 -174
- package/dist/lib/software-scale-context.js +132 -176
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +88 -198
- package/dist/lib/stream.js +87 -197
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/utilities.d.ts +372 -181
- package/dist/lib/utilities.js +373 -182
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +0 -1
- package/package.json +32 -24
- package/release_notes.md +43 -13
- package/CHANGELOG.md +0 -8
- package/dist/lib/channel-layouts.js.map +0 -1
- package/dist/lib/constants.js.map +0 -1
- /package/dist/{lib → constants}/channel-layouts.js +0 -0
package/dist/lib/filter.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { NativeFilter, NativeWrapper } from './native-types.js';
|
|
2
2
|
import type { FilterPad } from './types.js';
|
|
3
3
|
/**
|
|
4
|
-
* Filter
|
|
4
|
+
* Filter descriptor for video/audio processing.
|
|
5
5
|
*
|
|
6
|
-
* Represents a
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Represents a filter that can be used in filter graphs for processing
|
|
7
|
+
* audio and video frames. Filters can be sources (no inputs), sinks (no outputs),
|
|
8
|
+
* or processors (with both inputs and outputs). Each filter has specific
|
|
9
|
+
* capabilities and pad configurations.
|
|
9
10
|
*
|
|
10
11
|
* Direct mapping to FFmpeg's AVFilter.
|
|
11
12
|
*
|
|
@@ -13,219 +14,200 @@ import type { FilterPad } from './types.js';
|
|
|
13
14
|
* ```typescript
|
|
14
15
|
* import { Filter } from 'node-av';
|
|
15
16
|
*
|
|
16
|
-
* //
|
|
17
|
+
* // Get a specific filter
|
|
17
18
|
* const scaleFilter = Filter.getByName('scale');
|
|
18
|
-
* if (
|
|
19
|
+
* if (scaleFilter) {
|
|
20
|
+
* console.log(`Filter: ${scaleFilter.name}`);
|
|
21
|
+
* console.log(`Description: ${scaleFilter.description}`);
|
|
22
|
+
* console.log(`Inputs: ${scaleFilter.inputs.length}`);
|
|
23
|
+
* console.log(`Outputs: ${scaleFilter.outputs.length}`);
|
|
24
|
+
* }
|
|
19
25
|
*
|
|
20
|
-
* //
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* console.log(`Inputs: ${scaleFilter.inputs.length}`);
|
|
24
|
-
* console.log(`Outputs: ${scaleFilter.outputs.length}`);
|
|
25
|
-
*
|
|
26
|
-
* // Get all video filters
|
|
27
|
-
* const allFilters = Filter.getList();
|
|
28
|
-
* const videoFilters = allFilters.filter(f => f.isVideo());
|
|
26
|
+
* // List all video filters
|
|
27
|
+
* const filters = Filter.getList();
|
|
28
|
+
* const videoFilters = filters.filter(f => f.isVideo());
|
|
29
29
|
* console.log(`Found ${videoFilters.length} video filters`);
|
|
30
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* @see [AVFilter](https://ffmpeg.org/doxygen/trunk/structAVFilter.html) - FFmpeg Doxygen
|
|
33
|
+
* @see {@link FilterContext} For using filters in graphs
|
|
34
|
+
* @see {@link FilterGraph} For building filter pipelines
|
|
31
35
|
*/
|
|
32
36
|
export declare class Filter implements NativeWrapper<NativeFilter> {
|
|
33
37
|
private native;
|
|
34
38
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* Filters are global immutable objects managed by FFmpeg.
|
|
38
|
-
* Use the static factory methods to obtain filter instances.
|
|
39
|
-
*
|
|
39
|
+
* @param native - The native filter instance
|
|
40
40
|
* @internal
|
|
41
|
-
*
|
|
42
|
-
* @param native - Native AVFilter to wrap
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* import { Filter } from 'node-av';
|
|
47
|
-
*
|
|
48
|
-
* // Don't use constructor directly
|
|
49
|
-
* // const filter = new Filter(); // Wrong
|
|
50
|
-
*
|
|
51
|
-
* // Use static factory methods instead
|
|
52
|
-
* const filter = Filter.getByName('scale'); // Correct
|
|
53
|
-
* const filters = Filter.getList(); // Correct
|
|
54
|
-
* ```
|
|
55
41
|
*/
|
|
56
42
|
constructor(native: NativeFilter);
|
|
57
43
|
/**
|
|
58
|
-
*
|
|
44
|
+
* Get a filter by name.
|
|
59
45
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
46
|
+
* Retrieves a specific filter descriptor by its name.
|
|
47
|
+
* Common filter names include 'scale', 'crop', 'overlay', 'aformat', etc.
|
|
62
48
|
*
|
|
63
|
-
* Direct mapping to avfilter_get_by_name()
|
|
49
|
+
* Direct mapping to avfilter_get_by_name().
|
|
64
50
|
*
|
|
65
|
-
* @param name -
|
|
66
|
-
*
|
|
67
|
-
* @returns The filter if found, null otherwise
|
|
51
|
+
* @param name - Name of the filter
|
|
52
|
+
* @returns Filter instance if found, null otherwise
|
|
68
53
|
*
|
|
69
54
|
* @example
|
|
70
55
|
* ```typescript
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* const scaleFilter = Filter.getByName('scale');
|
|
75
|
-
* if (!scaleFilter) {
|
|
56
|
+
* // Get video scaling filter
|
|
57
|
+
* const scale = Filter.getByName('scale');
|
|
58
|
+
* if (!scale) {
|
|
76
59
|
* throw new Error('Scale filter not available');
|
|
77
60
|
* }
|
|
78
61
|
*
|
|
79
|
-
* //
|
|
80
|
-
* const
|
|
81
|
-
* if (!volumeFilter) {
|
|
82
|
-
* throw new Error('Volume filter not available');
|
|
83
|
-
* }
|
|
62
|
+
* // Get audio format filter
|
|
63
|
+
* const aformat = Filter.getByName('aformat');
|
|
84
64
|
* ```
|
|
85
65
|
*
|
|
86
|
-
* @see {@link getList} To
|
|
66
|
+
* @see {@link getList} To list all available filters
|
|
87
67
|
*/
|
|
88
68
|
static getByName(name: string): Filter | null;
|
|
89
69
|
/**
|
|
90
70
|
* Get list of all available filters.
|
|
91
71
|
*
|
|
92
|
-
* Returns all registered filters in
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* Direct mapping to avfilter_iterate()
|
|
72
|
+
* Returns an array of all registered filters in FFmpeg.
|
|
73
|
+
* Useful for discovering available filters or building filter lists.
|
|
96
74
|
*
|
|
97
|
-
* @returns Array of all
|
|
75
|
+
* @returns Array of all available filters
|
|
98
76
|
*
|
|
99
77
|
* @example
|
|
100
78
|
* ```typescript
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* });
|
|
79
|
+
* // List all filters
|
|
80
|
+
* const filters = Filter.getList();
|
|
81
|
+
* console.log(`Total filters: ${filters.length}`);
|
|
82
|
+
*
|
|
83
|
+
* // Find all source filters (generators)
|
|
84
|
+
* const sources = filters.filter(f => f.isSource());
|
|
85
|
+
* console.log(`Source filters: ${sources.length}`);
|
|
86
|
+
*
|
|
87
|
+
* // Find all sink filters (outputs)
|
|
88
|
+
* const sinks = filters.filter(f => f.isSink());
|
|
89
|
+
* console.log(`Sink filters: ${sinks.length}`);
|
|
113
90
|
* ```
|
|
114
91
|
*
|
|
115
|
-
* @see {@link getByName} To
|
|
92
|
+
* @see {@link getByName} To get a specific filter
|
|
116
93
|
*/
|
|
117
94
|
static getList(): Filter[];
|
|
118
95
|
/**
|
|
119
96
|
* Filter name.
|
|
120
97
|
*
|
|
121
|
-
*
|
|
98
|
+
* Unique identifier for the filter (e.g., 'scale', 'overlay').
|
|
122
99
|
*
|
|
123
|
-
*
|
|
100
|
+
* Direct mapping to AVFilter->name.
|
|
124
101
|
*/
|
|
125
102
|
get name(): string | null;
|
|
126
103
|
/**
|
|
127
104
|
* Filter description.
|
|
128
105
|
*
|
|
129
|
-
* Direct mapping to AVFilter->description
|
|
130
|
-
*
|
|
131
106
|
* Human-readable description of what the filter does.
|
|
107
|
+
*
|
|
108
|
+
* Direct mapping to AVFilter->description.
|
|
132
109
|
*/
|
|
133
110
|
get description(): string | null;
|
|
134
111
|
/**
|
|
135
112
|
* Input pads.
|
|
136
113
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* Array of input connection points for the filter.
|
|
114
|
+
* Array of input pad descriptors.
|
|
140
115
|
* Empty array for source filters.
|
|
116
|
+
*
|
|
117
|
+
* Direct mapping to AVFilter->inputs.
|
|
141
118
|
*/
|
|
142
119
|
get inputs(): FilterPad[];
|
|
143
120
|
/**
|
|
144
121
|
* Output pads.
|
|
145
122
|
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* Array of output connection points for the filter.
|
|
123
|
+
* Array of output pad descriptors.
|
|
149
124
|
* Empty array for sink filters.
|
|
125
|
+
*
|
|
126
|
+
* Direct mapping to AVFilter->outputs.
|
|
150
127
|
*/
|
|
151
128
|
get outputs(): FilterPad[];
|
|
152
129
|
/**
|
|
153
130
|
* Filter flags.
|
|
154
131
|
*
|
|
155
|
-
*
|
|
132
|
+
* Combination of AVFILTER_FLAG_* values indicating filter capabilities.
|
|
156
133
|
*
|
|
157
|
-
*
|
|
134
|
+
* Direct mapping to AVFilter->flags.
|
|
158
135
|
*/
|
|
159
136
|
get flags(): number;
|
|
160
137
|
/**
|
|
161
|
-
* Check if
|
|
138
|
+
* Check if filter is a source.
|
|
162
139
|
*
|
|
163
|
-
* Source filters
|
|
140
|
+
* Source filters generate frames without input
|
|
141
|
+
* (e.g., 'testsrc', 'color', 'anullsrc').
|
|
164
142
|
*
|
|
165
|
-
* @returns
|
|
143
|
+
* @returns True if filter has no inputs
|
|
166
144
|
*
|
|
167
145
|
* @example
|
|
168
146
|
* ```typescript
|
|
169
|
-
* const filter = Filter.getByName('
|
|
170
|
-
* if (filter
|
|
147
|
+
* const filter = Filter.getByName('testsrc');
|
|
148
|
+
* if (filter?.isSource()) {
|
|
171
149
|
* console.log('This is a source filter');
|
|
172
150
|
* }
|
|
173
151
|
* ```
|
|
152
|
+
*
|
|
153
|
+
* @see {@link isSink} To check for sink filters
|
|
174
154
|
*/
|
|
175
155
|
isSource(): boolean;
|
|
176
156
|
/**
|
|
177
|
-
* Check if
|
|
157
|
+
* Check if filter is a sink.
|
|
178
158
|
*
|
|
179
|
-
* Sink filters
|
|
159
|
+
* Sink filters consume frames without output
|
|
160
|
+
* (e.g., 'nullsink', 'buffersink').
|
|
180
161
|
*
|
|
181
|
-
* @returns
|
|
162
|
+
* @returns True if filter has no outputs
|
|
182
163
|
*
|
|
183
164
|
* @example
|
|
184
165
|
* ```typescript
|
|
185
|
-
* const filter = Filter.getByName('
|
|
186
|
-
* if (filter
|
|
166
|
+
* const filter = Filter.getByName('nullsink');
|
|
167
|
+
* if (filter?.isSink()) {
|
|
187
168
|
* console.log('This is a sink filter');
|
|
188
169
|
* }
|
|
189
170
|
* ```
|
|
171
|
+
*
|
|
172
|
+
* @see {@link isSource} To check for source filters
|
|
190
173
|
*/
|
|
191
174
|
isSink(): boolean;
|
|
192
175
|
/**
|
|
193
|
-
* Check if
|
|
176
|
+
* Check if filter processes video.
|
|
194
177
|
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @returns true if the filter processes video data, false otherwise
|
|
178
|
+
* @returns True if filter has video inputs or outputs
|
|
198
179
|
*
|
|
199
180
|
* @example
|
|
200
181
|
* ```typescript
|
|
201
|
-
* const
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* }
|
|
182
|
+
* const filters = Filter.getList();
|
|
183
|
+
* const videoFilters = filters.filter(f => f.isVideo());
|
|
184
|
+
* console.log(`Video filters: ${videoFilters.length}`);
|
|
205
185
|
* ```
|
|
186
|
+
*
|
|
187
|
+
* @see {@link isAudio} To check for audio filters
|
|
206
188
|
*/
|
|
207
189
|
isVideo(): boolean;
|
|
208
190
|
/**
|
|
209
|
-
* Check if
|
|
210
|
-
*
|
|
211
|
-
* Checks if any input or output pad handles audio data.
|
|
191
|
+
* Check if filter processes audio.
|
|
212
192
|
*
|
|
213
|
-
* @returns
|
|
193
|
+
* @returns True if filter has audio inputs or outputs
|
|
214
194
|
*
|
|
215
195
|
* @example
|
|
216
196
|
* ```typescript
|
|
217
|
-
* const
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* }
|
|
197
|
+
* const filters = Filter.getList();
|
|
198
|
+
* const audioFilters = filters.filter(f => f.isAudio());
|
|
199
|
+
* console.log(`Audio filters: ${audioFilters.length}`);
|
|
221
200
|
* ```
|
|
201
|
+
*
|
|
202
|
+
* @see {@link isVideo} To check for video filters
|
|
222
203
|
*/
|
|
223
204
|
isAudio(): boolean;
|
|
224
205
|
/**
|
|
225
|
-
* Get the native
|
|
206
|
+
* Get the underlying native Filter object.
|
|
226
207
|
*
|
|
227
|
-
* @
|
|
228
|
-
*
|
|
208
|
+
* @returns The native Filter binding object
|
|
209
|
+
*
|
|
210
|
+
* @internal
|
|
229
211
|
*/
|
|
230
212
|
getNative(): NativeFilter;
|
|
231
213
|
}
|