node-av 1.1.0 → 1.3.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 +51 -59
- package/dist/api/bitstream-filter.d.ts +183 -123
- package/dist/api/bitstream-filter.js +185 -127
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +282 -130
- package/dist/api/decoder.js +290 -142
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +249 -160
- package/dist/api/encoder.js +276 -207
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +1944 -96
- package/dist/api/filter-presets.js +2059 -105
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +264 -200
- package/dist/api/filter.js +269 -231
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +246 -117
- package/dist/api/hardware.js +440 -217
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +65 -55
- package/dist/api/io-stream.js +43 -40
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +242 -139
- package/dist/api/media-input.js +205 -103
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +208 -126
- package/dist/api/media-output.js +212 -126
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +361 -38
- package/dist/api/pipeline.js +255 -14
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +26 -187
- package/dist/api/utilities/audio-sample.d.ts +0 -8
- package/dist/api/utilities/audio-sample.js +0 -8
- package/dist/api/utilities/audio-sample.js.map +1 -1
- package/dist/api/utilities/channel-layout.d.ts +0 -8
- package/dist/api/utilities/channel-layout.js +0 -8
- package/dist/api/utilities/channel-layout.js.map +1 -1
- package/dist/api/utilities/image.d.ts +0 -8
- package/dist/api/utilities/image.js +0 -8
- package/dist/api/utilities/image.js.map +1 -1
- package/dist/api/utilities/index.d.ts +3 -3
- package/dist/api/utilities/index.js +3 -3
- package/dist/api/utilities/index.js.map +1 -1
- package/dist/api/utilities/media-type.d.ts +1 -9
- package/dist/api/utilities/media-type.js +1 -9
- package/dist/api/utilities/media-type.js.map +1 -1
- package/dist/api/utilities/pixel-format.d.ts +1 -9
- package/dist/api/utilities/pixel-format.js +1 -9
- package/dist/api/utilities/pixel-format.js.map +1 -1
- package/dist/api/utilities/sample-format.d.ts +1 -9
- package/dist/api/utilities/sample-format.js +1 -9
- package/dist/api/utilities/sample-format.js.map +1 -1
- package/dist/api/utilities/streaming.d.ts +0 -8
- package/dist/api/utilities/streaming.js +0 -8
- package/dist/api/utilities/streaming.js.map +1 -1
- package/dist/api/utilities/timestamp.d.ts +0 -8
- package/dist/api/utilities/timestamp.js +0 -8
- package/dist/api/utilities/timestamp.js.map +1 -1
- package/dist/api/utils.d.ts +1 -2
- package/dist/api/utils.js +11 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/constants/constants.d.ts +1 -1
- package/dist/constants/constants.js +2 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/lib/audio-fifo.d.ts +127 -170
- package/dist/lib/audio-fifo.js +130 -173
- package/dist/lib/audio-fifo.js.map +1 -1
- package/dist/lib/binding.d.ts +1 -0
- package/dist/lib/binding.js +7 -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 +68 -54
- package/dist/lib/bitstream-filter.js +68 -54
- package/dist/lib/bitstream-filter.js.map +1 -1
- package/dist/lib/codec-context.d.ts +316 -380
- package/dist/lib/codec-context.js +316 -381
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/codec-parameters.d.ts +160 -170
- package/dist/lib/codec-parameters.js +162 -172
- package/dist/lib/codec-parameters.js.map +1 -1
- package/dist/lib/codec-parser.d.ts +91 -104
- package/dist/lib/codec-parser.js +92 -103
- package/dist/lib/codec-parser.js.map +1 -1
- package/dist/lib/codec.d.ts +266 -283
- package/dist/lib/codec.js +270 -287
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +149 -203
- package/dist/lib/dictionary.js +158 -212
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/error.d.ts +96 -130
- package/dist/lib/error.js +98 -128
- package/dist/lib/error.js.map +1 -1
- package/dist/lib/filter-context.d.ts +284 -218
- package/dist/lib/filter-context.js +290 -227
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +251 -292
- 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 +93 -111
- package/dist/lib/filter.js.map +1 -1
- package/dist/lib/format-context.d.ts +320 -428
- package/dist/lib/format-context.js +313 -385
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +262 -405
- package/dist/lib/frame.js +263 -408
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-device-context.d.ts +149 -203
- 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 +170 -180
- 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 +3 -2
- package/dist/lib/index.js +3 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/input-format.d.ts +89 -117
- package/dist/lib/input-format.js +89 -117
- package/dist/lib/input-format.js.map +1 -1
- package/dist/lib/io-context.d.ts +209 -241
- package/dist/lib/io-context.js +220 -252
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/log.d.ts +85 -119
- package/dist/lib/log.js +85 -122
- package/dist/lib/log.js.map +1 -1
- package/dist/lib/native-types.d.ts +118 -106
- package/dist/lib/native-types.js +0 -7
- package/dist/lib/native-types.js.map +1 -1
- package/dist/lib/option.d.ts +437 -218
- package/dist/lib/option.js +462 -226
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/output-format.d.ts +77 -101
- package/dist/lib/output-format.js +77 -101
- package/dist/lib/output-format.js.map +1 -1
- package/dist/lib/packet.d.ts +172 -240
- 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 +241 -325
- 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 +129 -173
- package/dist/lib/software-scale-context.js +131 -175
- package/dist/lib/software-scale-context.js.map +1 -1
- package/dist/lib/stream.d.ts +87 -197
- package/dist/lib/stream.js +87 -197
- package/dist/lib/stream.js.map +1 -1
- package/dist/lib/utilities.d.ts +435 -181
- package/dist/lib/utilities.js +438 -182
- package/dist/lib/utilities.js.map +1 -1
- package/install/check.js +0 -1
- package/install/ffmpeg.js +0 -11
- package/package.json +25 -18
- package/release_notes.md +24 -59
- package/CHANGELOG.md +0 -8
package/dist/api/pipeline.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides a
|
|
5
|
-
* Automatically handles type conversions, buffering, and flushing.
|
|
6
|
-
*
|
|
7
|
-
* Supports two modes:
|
|
8
|
-
* 1. Simple: Single stream with variable parameters
|
|
9
|
-
* 2. Named: Multiple streams with named routing with variable parameters
|
|
10
|
-
*
|
|
11
|
-
* @module api/pipeline
|
|
2
|
+
* @module pipeline
|
|
3
|
+
* High-level media processing pipeline for FFmpeg operations.
|
|
4
|
+
* Provides a fluent API for building transcoding, filtering, and stream processing pipelines.
|
|
12
5
|
*/
|
|
13
6
|
import type { Frame, Packet } from '../lib/index.js';
|
|
14
7
|
import type { BitStreamFilterAPI } from './bitstream-filter.js';
|
|
@@ -17,101 +10,431 @@ import type { Encoder } from './encoder.js';
|
|
|
17
10
|
import type { FilterAPI } from './filter.js';
|
|
18
11
|
import type { MediaInput } from './media-input.js';
|
|
19
12
|
import type { MediaOutput } from './media-output.js';
|
|
20
|
-
type StreamName = 'video' | 'audio';
|
|
21
|
-
type NamedInputs<K extends StreamName = StreamName> = Pick<Record<StreamName, MediaInput>, K>;
|
|
22
|
-
type NamedStages<K extends StreamName = StreamName> = Pick<Record<StreamName, (Decoder | FilterAPI | FilterAPI[] | Encoder | BitStreamFilterAPI | BitStreamFilterAPI[])[] | 'passthrough'>, K>;
|
|
23
|
-
type NamedOutputs<K extends StreamName = StreamName> = Pick<Record<StreamName, MediaOutput>, K>;
|
|
13
|
+
export type StreamName = 'video' | 'audio';
|
|
14
|
+
export type NamedInputs<K extends StreamName = StreamName> = Pick<Record<StreamName, MediaInput>, K>;
|
|
15
|
+
export type NamedStages<K extends StreamName = StreamName> = Pick<Record<StreamName, (Decoder | FilterAPI | FilterAPI[] | Encoder | BitStreamFilterAPI | BitStreamFilterAPI[])[] | 'passthrough'>, K>;
|
|
16
|
+
export type NamedOutputs<K extends StreamName = StreamName> = Pick<Record<StreamName, MediaOutput>, K>;
|
|
24
17
|
/**
|
|
25
|
-
* Pipeline control interface for managing pipeline execution
|
|
18
|
+
* Pipeline control interface for managing pipeline execution.
|
|
19
|
+
* Allows graceful stopping and completion tracking of running pipelines.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const control = pipeline(input, decoder, encoder, output);
|
|
24
|
+
*
|
|
25
|
+
* // Stop after 10 seconds
|
|
26
|
+
* setTimeout(() => control.stop(), 10000);
|
|
27
|
+
*
|
|
28
|
+
* // Wait for completion
|
|
29
|
+
* await control.completion;
|
|
30
|
+
* ```
|
|
26
31
|
*/
|
|
27
32
|
export interface PipelineControl {
|
|
28
33
|
/**
|
|
29
|
-
* Stop the pipeline gracefully
|
|
34
|
+
* Stop the pipeline gracefully.
|
|
35
|
+
* The pipeline will stop processing after the current operation completes.
|
|
30
36
|
*/
|
|
31
37
|
stop(): void;
|
|
32
38
|
/**
|
|
33
|
-
* Check if the pipeline has been stopped
|
|
39
|
+
* Check if the pipeline has been stopped.
|
|
40
|
+
*
|
|
41
|
+
* @returns True if stop() has been called
|
|
34
42
|
*/
|
|
35
43
|
isStopped(): boolean;
|
|
36
44
|
/**
|
|
37
|
-
* Promise that resolves when the pipeline completes
|
|
45
|
+
* Promise that resolves when the pipeline completes.
|
|
46
|
+
* Resolves when all processing is finished or the pipeline is stopped.
|
|
38
47
|
*/
|
|
39
48
|
readonly completion: Promise<void>;
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
42
|
-
* Full transcoding pipeline: input → decoder → encoder → output
|
|
51
|
+
* Full transcoding pipeline: input → decoder → encoder → output.
|
|
52
|
+
*
|
|
53
|
+
* @param source - Media input source
|
|
54
|
+
* @param decoder - Decoder for decoding packets to frames
|
|
55
|
+
* @param encoder - Encoder for encoding frames to packets
|
|
56
|
+
* @param output - Media output destination
|
|
57
|
+
* @returns Pipeline control for managing execution
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const control = pipeline(input, decoder, encoder, output);
|
|
62
|
+
* await control.completion;
|
|
63
|
+
* ```
|
|
43
64
|
*/
|
|
44
65
|
export declare function pipeline(source: MediaInput, decoder: Decoder, encoder: Encoder, output: MediaOutput): PipelineControl;
|
|
45
66
|
/**
|
|
46
|
-
* Full transcoding pipeline with filter: input → decoder → filter → encoder → output
|
|
67
|
+
* Full transcoding pipeline with filter: input → decoder → filter → encoder → output.
|
|
68
|
+
*
|
|
69
|
+
* @param source - Media input source
|
|
70
|
+
* @param decoder - Decoder for decoding packets to frames
|
|
71
|
+
* @param filter - Filter or filter chain for processing frames
|
|
72
|
+
* @param encoder - Encoder for encoding frames to packets
|
|
73
|
+
* @param output - Media output destination
|
|
74
|
+
* @returns Pipeline control for managing execution
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const control = pipeline(input, decoder, scaleFilter, encoder, output);
|
|
79
|
+
* await control.completion;
|
|
80
|
+
* ```
|
|
47
81
|
*/
|
|
48
82
|
export declare function pipeline(source: MediaInput, decoder: Decoder, filter: FilterAPI | FilterAPI[], encoder: Encoder, output: MediaOutput): PipelineControl;
|
|
49
83
|
/**
|
|
50
|
-
* Transcoding with bitstream filter: input → decoder → encoder → bsf → output
|
|
84
|
+
* Transcoding with bitstream filter: input → decoder → encoder → bsf → output.
|
|
85
|
+
*
|
|
86
|
+
* @param source - Media input source
|
|
87
|
+
* @param decoder - Decoder for decoding packets
|
|
88
|
+
* @param encoder - Encoder for encoding frames
|
|
89
|
+
* @param bsf - Bitstream filter for packet processing
|
|
90
|
+
* @param output - Media output destination
|
|
91
|
+
* @returns Pipeline control for managing execution
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const decoder = await Decoder.create(input.video());
|
|
96
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, decoder.getOutputStreamInfo());
|
|
97
|
+
* const bsf = await BitStreamFilterAPI.create('h264_mp4toannexb');
|
|
98
|
+
* const control = pipeline(input, decoder, encoder, bsf, output);
|
|
99
|
+
* await control.completion;
|
|
100
|
+
* ```
|
|
51
101
|
*/
|
|
52
102
|
export declare function pipeline(source: MediaInput, decoder: Decoder, encoder: Encoder, bsf: BitStreamFilterAPI | BitStreamFilterAPI[], output: MediaOutput): PipelineControl;
|
|
53
103
|
/**
|
|
54
|
-
* Full pipeline with filter and bsf: input → decoder → filter → encoder → bsf → output
|
|
104
|
+
* Full pipeline with filter and bsf: input → decoder → filter → encoder → bsf → output.
|
|
105
|
+
*
|
|
106
|
+
* @param source - Media input source
|
|
107
|
+
* @param decoder - Decoder for decoding packets
|
|
108
|
+
* @param filter - Filter or filter chain
|
|
109
|
+
* @param encoder - Encoder for encoding frames
|
|
110
|
+
* @param bsf - Bitstream filter
|
|
111
|
+
* @param output - Media output destination
|
|
112
|
+
* @returns Pipeline control for managing execution
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const decoder = await Decoder.create(input.video());
|
|
117
|
+
* const filter = await FilterAPI.create('scale=640:480');
|
|
118
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, decoder.getOutputStreamInfo());
|
|
119
|
+
* const bsf = await BitStreamFilterAPI.create('h264_mp4toannexb');
|
|
120
|
+
* const control = pipeline(input, decoder, filter, encoder, bsf, output);
|
|
121
|
+
* await control.completion;
|
|
122
|
+
* ```
|
|
55
123
|
*/
|
|
56
124
|
export declare function pipeline(source: MediaInput, decoder: Decoder, filter: FilterAPI | FilterAPI[], encoder: Encoder, bsf: BitStreamFilterAPI | BitStreamFilterAPI[], output: MediaOutput): PipelineControl;
|
|
57
125
|
/**
|
|
58
|
-
* Decode + multiple filters + encode: input → decoder → filter1 → filter2 → encoder → output
|
|
126
|
+
* Decode + multiple filters + encode: input → decoder → filter1 → filter2 → encoder → output.
|
|
127
|
+
*
|
|
128
|
+
* @param source - Media input source
|
|
129
|
+
* @param decoder - Decoder for decoding packets
|
|
130
|
+
* @param filter1 - First filter
|
|
131
|
+
* @param filter2 - Second filter
|
|
132
|
+
* @param encoder - Encoder for encoding frames
|
|
133
|
+
* @param output - Media output destination
|
|
134
|
+
* @returns Pipeline control for managing execution
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const decoder = await Decoder.create(input.video());
|
|
139
|
+
* const scaleFilter = await FilterAPI.create('scale=640:480');
|
|
140
|
+
* const cropFilter = await FilterAPI.create('crop=640:360');
|
|
141
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, decoder.getOutputStreamInfo());
|
|
142
|
+
* const control = pipeline(input, decoder, scaleFilter, cropFilter, encoder, output);
|
|
143
|
+
* await control.completion;
|
|
144
|
+
* ```
|
|
59
145
|
*/
|
|
60
146
|
export declare function pipeline(source: MediaInput, decoder: Decoder, filter1: FilterAPI, filter2: FilterAPI, encoder: Encoder, output: MediaOutput): PipelineControl;
|
|
61
147
|
/**
|
|
62
|
-
* Stream copy pipeline: input → output (copies all streams)
|
|
148
|
+
* Stream copy pipeline: input → output (copies all streams).
|
|
149
|
+
*
|
|
150
|
+
* @param source - Media input source
|
|
151
|
+
* @param output - Media output destination
|
|
152
|
+
* @returns Pipeline control for managing execution
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* // Copy all streams without re-encoding
|
|
157
|
+
* const control = pipeline(input, output);
|
|
158
|
+
* await control.completion;
|
|
159
|
+
* ```
|
|
63
160
|
*/
|
|
64
161
|
export declare function pipeline(source: MediaInput, output: MediaOutput): PipelineControl;
|
|
65
162
|
/**
|
|
66
|
-
* Stream copy with bitstream filter: input → bsf → output
|
|
163
|
+
* Stream copy with bitstream filter: input → bsf → output.
|
|
164
|
+
*
|
|
165
|
+
* @param source - Media input source
|
|
166
|
+
* @param bsf - Bitstream filter for packet processing
|
|
167
|
+
* @param output - Media output destination
|
|
168
|
+
* @returns Pipeline control for managing execution
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* // Convert H.264 stream format while copying
|
|
173
|
+
* const bsf = await BitStreamFilterAPI.create('h264_mp4toannexb');
|
|
174
|
+
* const control = pipeline(input, bsf, output);
|
|
175
|
+
* await control.completion;
|
|
176
|
+
* ```
|
|
67
177
|
*/
|
|
68
178
|
export declare function pipeline(source: MediaInput, bsf: BitStreamFilterAPI | BitStreamFilterAPI[], output: MediaOutput): PipelineControl;
|
|
69
179
|
/**
|
|
70
|
-
* Filter + encode + output: frames → filter → encoder → output
|
|
180
|
+
* Filter + encode + output: frames → filter → encoder → output.
|
|
181
|
+
*
|
|
182
|
+
* @param source - Frame source (async iterable)
|
|
183
|
+
* @param filter - Filter or filter chain
|
|
184
|
+
* @param encoder - Encoder for encoding frames
|
|
185
|
+
* @param output - Media output destination
|
|
186
|
+
* @returns Pipeline control for managing execution
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* // Process frames from custom source
|
|
191
|
+
* const frameSource = generateFrames(); // Your async frame generator
|
|
192
|
+
* const filter = await FilterAPI.create('scale=1920:1080');
|
|
193
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, streamInfo);
|
|
194
|
+
* const control = pipeline(frameSource, filter, encoder, output);
|
|
195
|
+
* await control.completion;
|
|
196
|
+
* ```
|
|
71
197
|
*/
|
|
72
198
|
export declare function pipeline(source: AsyncIterable<Frame>, filter: FilterAPI | FilterAPI[], encoder: Encoder, output: MediaOutput): PipelineControl;
|
|
73
199
|
/**
|
|
74
|
-
* Encode + output: frames → encoder → output
|
|
200
|
+
* Encode + output: frames → encoder → output.
|
|
201
|
+
*
|
|
202
|
+
* @param source - Frame source (async iterable)
|
|
203
|
+
* @param encoder - Encoder for encoding frames
|
|
204
|
+
* @param output - Media output destination
|
|
205
|
+
* @returns Pipeline control for managing execution
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* // Encode raw frames directly
|
|
210
|
+
* const frameSource = generateFrames(); // Your async frame generator
|
|
211
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, streamInfo);
|
|
212
|
+
* const control = pipeline(frameSource, encoder, output);
|
|
213
|
+
* await control.completion;
|
|
214
|
+
* ```
|
|
75
215
|
*/
|
|
76
216
|
export declare function pipeline(source: AsyncIterable<Frame>, encoder: Encoder, output: MediaOutput): PipelineControl;
|
|
77
217
|
/**
|
|
78
|
-
* Partial pipeline: input → decoder (returns frames)
|
|
218
|
+
* Partial pipeline: input → decoder (returns frames).
|
|
219
|
+
*
|
|
220
|
+
* @param source - Media input source
|
|
221
|
+
* @param decoder - Decoder for decoding packets
|
|
222
|
+
* @returns Async generator of frames
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* // Get decoded frames for custom processing
|
|
227
|
+
* const decoder = await Decoder.create(input.video());
|
|
228
|
+
* const frames = pipeline(input, decoder);
|
|
229
|
+
* for await (const frame of frames) {
|
|
230
|
+
* // Process frame
|
|
231
|
+
* frame.free();
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
79
234
|
*/
|
|
80
235
|
export declare function pipeline(source: MediaInput, decoder: Decoder): AsyncGenerator<Frame>;
|
|
81
236
|
/**
|
|
82
|
-
* Partial pipeline: input → decoder → filter (returns frames)
|
|
237
|
+
* Partial pipeline: input → decoder → filter (returns frames).
|
|
238
|
+
*
|
|
239
|
+
* @param source - Media input source
|
|
240
|
+
* @param decoder - Decoder for decoding packets
|
|
241
|
+
* @param filter - Filter or filter chain
|
|
242
|
+
* @returns Async generator of frames
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* // Get filtered frames for custom processing
|
|
247
|
+
* const decoder = await Decoder.create(input.video());
|
|
248
|
+
* const filter = await FilterAPI.create('scale=640:480');
|
|
249
|
+
* const frames = pipeline(input, decoder, filter);
|
|
250
|
+
* for await (const frame of frames) {
|
|
251
|
+
* // Process filtered frame
|
|
252
|
+
* frame.free();
|
|
253
|
+
* }
|
|
254
|
+
* ```
|
|
83
255
|
*/
|
|
84
256
|
export declare function pipeline(source: MediaInput, decoder: Decoder, filter: FilterAPI | FilterAPI[]): AsyncGenerator<Frame>;
|
|
85
257
|
/**
|
|
86
|
-
* Partial pipeline: input → decoder → filter → encoder (returns packets)
|
|
258
|
+
* Partial pipeline: input → decoder → filter → encoder (returns packets).
|
|
259
|
+
*
|
|
260
|
+
* @param source - Media input source
|
|
261
|
+
* @param decoder - Decoder for decoding packets
|
|
262
|
+
* @param filter - Filter or filter chain
|
|
263
|
+
* @param encoder - Encoder for encoding frames
|
|
264
|
+
* @returns Async generator of packets
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* // Get encoded packets for custom output handling
|
|
269
|
+
* const decoder = await Decoder.create(input.video());
|
|
270
|
+
* const filter = await FilterAPI.create('scale=640:480');
|
|
271
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, decoder.getOutputStreamInfo());
|
|
272
|
+
* const packets = pipeline(input, decoder, filter, encoder);
|
|
273
|
+
* for await (const packet of packets) {
|
|
274
|
+
* // Handle encoded packet
|
|
275
|
+
* packet.free();
|
|
276
|
+
* }
|
|
277
|
+
* ```
|
|
87
278
|
*/
|
|
88
279
|
export declare function pipeline(source: MediaInput, decoder: Decoder, filter: FilterAPI | FilterAPI[], encoder: Encoder): AsyncGenerator<Packet>;
|
|
89
280
|
/**
|
|
90
|
-
* Partial pipeline: input → decoder → encoder (returns packets)
|
|
281
|
+
* Partial pipeline: input → decoder → encoder (returns packets).
|
|
282
|
+
*
|
|
283
|
+
* @param source - Media input source
|
|
284
|
+
* @param decoder - Decoder for decoding packets
|
|
285
|
+
* @param encoder - Encoder for encoding frames
|
|
286
|
+
* @returns Async generator of packets
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* // Transcode to packets for custom output
|
|
291
|
+
* const decoder = await Decoder.create(input.video());
|
|
292
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, decoder.getOutputStreamInfo());
|
|
293
|
+
* const packets = pipeline(input, decoder, encoder);
|
|
294
|
+
* for await (const packet of packets) {
|
|
295
|
+
* // Handle transcoded packet
|
|
296
|
+
* packet.free();
|
|
297
|
+
* }
|
|
298
|
+
* ```
|
|
91
299
|
*/
|
|
92
300
|
export declare function pipeline(source: MediaInput, decoder: Decoder, encoder: Encoder): AsyncGenerator<Packet>;
|
|
93
301
|
/**
|
|
94
|
-
* Partial pipeline: frames → filter (returns frames)
|
|
302
|
+
* Partial pipeline: frames → filter (returns frames).
|
|
303
|
+
*
|
|
304
|
+
* @param source - Frame source (async iterable)
|
|
305
|
+
* @param filter - Filter or filter chain
|
|
306
|
+
* @returns Async generator of filtered frames
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* ```typescript
|
|
310
|
+
* // Filter frames from custom source
|
|
311
|
+
* const frameSource = generateFrames();
|
|
312
|
+
* const filter = await FilterAPI.create('scale=640:480');
|
|
313
|
+
* const filteredFrames = pipeline(frameSource, filter);
|
|
314
|
+
* for await (const frame of filteredFrames) {
|
|
315
|
+
* // Process filtered frame
|
|
316
|
+
* frame.free();
|
|
317
|
+
* }
|
|
318
|
+
* ```
|
|
95
319
|
*/
|
|
96
320
|
export declare function pipeline(source: AsyncIterable<Frame>, filter: FilterAPI | FilterAPI[]): AsyncGenerator<Frame>;
|
|
97
321
|
/**
|
|
98
|
-
* Partial pipeline: frames → encoder (returns packets)
|
|
322
|
+
* Partial pipeline: frames → encoder (returns packets).
|
|
323
|
+
*
|
|
324
|
+
* @param source - Frame source (async iterable)
|
|
325
|
+
* @param encoder - Encoder for encoding frames
|
|
326
|
+
* @returns Async generator of packets
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```typescript
|
|
330
|
+
* // Encode frames to packets
|
|
331
|
+
* const frameSource = generateFrames();
|
|
332
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, streamInfo);
|
|
333
|
+
* const packets = pipeline(frameSource, encoder);
|
|
334
|
+
* for await (const packet of packets) {
|
|
335
|
+
* // Handle encoded packet
|
|
336
|
+
* packet.free();
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
99
339
|
*/
|
|
100
340
|
export declare function pipeline(source: AsyncIterable<Frame>, encoder: Encoder): AsyncGenerator<Packet>;
|
|
101
341
|
/**
|
|
102
|
-
* Partial pipeline: frames → filter → encoder (returns packets)
|
|
342
|
+
* Partial pipeline: frames → filter → encoder (returns packets).
|
|
343
|
+
*
|
|
344
|
+
* @param source - Frame source (async iterable)
|
|
345
|
+
* @param filter - Filter or filter chain
|
|
346
|
+
* @param encoder - Encoder for encoding frames
|
|
347
|
+
* @returns Async generator of packets
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```typescript
|
|
351
|
+
* // Process frames with filter and encode to packets
|
|
352
|
+
* const frameSource = generateFrames();
|
|
353
|
+
* const filter = await FilterAPI.create('scale=640:480');
|
|
354
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, streamInfo);
|
|
355
|
+
* const packets = pipeline(frameSource, filter, encoder);
|
|
356
|
+
* for await (const packet of packets) {
|
|
357
|
+
* // Handle encoded packet
|
|
358
|
+
* packet.free();
|
|
359
|
+
* }
|
|
360
|
+
* ```
|
|
103
361
|
*/
|
|
104
362
|
export declare function pipeline(source: AsyncIterable<Frame>, filter: FilterAPI | FilterAPI[], encoder: Encoder): AsyncGenerator<Packet>;
|
|
105
363
|
/**
|
|
106
|
-
* Named pipeline with single output - all streams go to the same output
|
|
364
|
+
* Named pipeline with single output - all streams go to the same output.
|
|
365
|
+
*
|
|
366
|
+
* @param inputs - Named input sources (video/audio)
|
|
367
|
+
* @param stages - Named processing stages for each stream
|
|
368
|
+
* @param output - Single output destination for all streams
|
|
369
|
+
* @returns Pipeline control for managing execution
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```typescript
|
|
373
|
+
* // Named pipeline for muxing
|
|
374
|
+
* const control = pipeline(
|
|
375
|
+
* { video: videoInput, audio: audioInput },
|
|
376
|
+
* {
|
|
377
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
378
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
379
|
+
* },
|
|
380
|
+
* output
|
|
381
|
+
* );
|
|
382
|
+
* await control.completion;
|
|
383
|
+
* ```
|
|
107
384
|
*/
|
|
108
385
|
export declare function pipeline<K extends StreamName>(inputs: NamedInputs<K>, stages: NamedStages<K>, output: MediaOutput): PipelineControl;
|
|
109
386
|
/**
|
|
110
|
-
* Named pipeline with multiple outputs - each stream has its own output
|
|
387
|
+
* Named pipeline with multiple outputs - each stream has its own output.
|
|
388
|
+
*
|
|
389
|
+
* @param inputs - Named input sources (video/audio)
|
|
390
|
+
* @param stages - Named processing stages for each stream
|
|
391
|
+
* @param outputs - Named output destinations
|
|
392
|
+
* @returns Pipeline control for managing execution
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```typescript
|
|
396
|
+
* // Named pipeline for audio/video processing
|
|
397
|
+
* const control = pipeline(
|
|
398
|
+
* { video: videoInput, audio: audioInput },
|
|
399
|
+
* {
|
|
400
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
401
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
402
|
+
* },
|
|
403
|
+
* { video: videoOutput, audio: audioOutput }
|
|
404
|
+
* );
|
|
405
|
+
* await control.completion;
|
|
406
|
+
* ```
|
|
111
407
|
*/
|
|
112
408
|
export declare function pipeline<K extends StreamName>(inputs: NamedInputs<K>, stages: NamedStages<K>, outputs: NamedOutputs<K>): PipelineControl;
|
|
113
409
|
/**
|
|
114
|
-
* Partial named pipeline (returns generators for further processing)
|
|
410
|
+
* Partial named pipeline (returns generators for further processing).
|
|
411
|
+
*
|
|
412
|
+
* @param inputs - Named input sources
|
|
413
|
+
* @param stages - Named processing stages
|
|
414
|
+
* @returns Record of async generators for each stream
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* // Partial named pipeline
|
|
419
|
+
* const generators = pipeline(
|
|
420
|
+
* { video: videoInput, audio: audioInput },
|
|
421
|
+
* {
|
|
422
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
423
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
424
|
+
* }
|
|
425
|
+
* );
|
|
426
|
+
*
|
|
427
|
+
* // Access individual generators
|
|
428
|
+
* const videoGenerator = generators.video;
|
|
429
|
+
* const audioGenerator = generators.audio;
|
|
430
|
+
*
|
|
431
|
+
* // Use the generators
|
|
432
|
+
* for await (const packet of videoGenerator) {
|
|
433
|
+
* // Process video packet
|
|
434
|
+
* }
|
|
435
|
+
* for await (const packet of audioGenerator) {
|
|
436
|
+
* // Process audio packet
|
|
437
|
+
* }
|
|
438
|
+
* ```
|
|
115
439
|
*/
|
|
116
440
|
export declare function pipeline<K extends StreamName, T extends Packet | Frame = Packet | Frame>(inputs: NamedInputs<K>, stages: NamedStages<K>): Record<K, AsyncGenerator<T>>;
|
|
117
|
-
export {};
|