node-av-lgpl 0.0.0 → 7.1.0-beta.1
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/LICENSE.md +22 -0
- package/README.md +711 -0
- package/dist/api/audio-frame-buffer.d.ts +636 -0
- package/dist/api/audio-frame-buffer.js +1027 -0
- package/dist/api/audio-frame-buffer.js.map +1 -0
- package/dist/api/bitstream-filter.d.ts +938 -0
- package/dist/api/bitstream-filter.js +1427 -0
- package/dist/api/bitstream-filter.js.map +1 -0
- package/dist/api/constants.d.ts +44 -0
- package/dist/api/constants.js +45 -0
- package/dist/api/constants.js.map +1 -0
- package/dist/api/data/test_av1.ivf +0 -0
- package/dist/api/data/test_h264.h264 +0 -0
- package/dist/api/data/test_hevc.h265 +0 -0
- package/dist/api/data/test_mjpeg.mjpeg +0 -0
- package/dist/api/data/test_vp8.ivf +0 -0
- package/dist/api/data/test_vp9.ivf +0 -0
- package/dist/api/decoder.d.ts +1413 -0
- package/dist/api/decoder.js +2367 -0
- package/dist/api/decoder.js.map +1 -0
- package/dist/api/demuxer.d.ts +1295 -0
- package/dist/api/demuxer.js +2344 -0
- package/dist/api/demuxer.js.map +1 -0
- package/dist/api/device.d.ts +589 -0
- package/dist/api/device.js +964 -0
- package/dist/api/device.js.map +1 -0
- package/dist/api/encoder-pool.d.ts +262 -0
- package/dist/api/encoder-pool.js +397 -0
- package/dist/api/encoder-pool.js.map +1 -0
- package/dist/api/encoder.d.ts +1509 -0
- package/dist/api/encoder.js +2619 -0
- package/dist/api/encoder.js.map +1 -0
- package/dist/api/filter-complex.d.ts +828 -0
- package/dist/api/filter-complex.js +1661 -0
- package/dist/api/filter-complex.js.map +1 -0
- package/dist/api/filter-presets.d.ts +800 -0
- package/dist/api/filter-presets.js +1554 -0
- package/dist/api/filter-presets.js.map +1 -0
- package/dist/api/filter.d.ts +1339 -0
- package/dist/api/filter.js +2075 -0
- package/dist/api/filter.js.map +1 -0
- package/dist/api/fmp4-stream.d.ts +797 -0
- package/dist/api/fmp4-stream.js +1428 -0
- package/dist/api/fmp4-stream.js.map +1 -0
- package/dist/api/hardware.d.ts +677 -0
- package/dist/api/hardware.js +1300 -0
- package/dist/api/hardware.js.map +1 -0
- package/dist/api/index.d.ts +21 -0
- package/dist/api/index.js +38 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/io-stream.d.ts +308 -0
- package/dist/api/io-stream.js +358 -0
- package/dist/api/io-stream.js.map +1 -0
- package/dist/api/muxer.d.ts +1311 -0
- package/dist/api/muxer.js +2672 -0
- package/dist/api/muxer.js.map +1 -0
- package/dist/api/pipeline.d.ts +801 -0
- package/dist/api/pipeline.js +1344 -0
- package/dist/api/pipeline.js.map +1 -0
- package/dist/api/probe.d.ts +128 -0
- package/dist/api/probe.js +227 -0
- package/dist/api/probe.js.map +1 -0
- package/dist/api/rtp-stream.d.ts +497 -0
- package/dist/api/rtp-stream.js +1131 -0
- package/dist/api/rtp-stream.js.map +1 -0
- package/dist/api/scaler.d.ts +561 -0
- package/dist/api/scaler.js +918 -0
- package/dist/api/scaler.js.map +1 -0
- package/dist/api/types.d.ts +17 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/api/utilities/async-queue.d.ts +149 -0
- package/dist/api/utilities/async-queue.js +254 -0
- package/dist/api/utilities/async-queue.js.map +1 -0
- package/dist/api/utilities/audio-sample.d.ts +117 -0
- package/dist/api/utilities/audio-sample.js +112 -0
- package/dist/api/utilities/audio-sample.js.map +1 -0
- package/dist/api/utilities/audio-transcode.d.ts +20 -0
- package/dist/api/utilities/audio-transcode.js +27 -0
- package/dist/api/utilities/audio-transcode.js.map +1 -0
- package/dist/api/utilities/channel-layout.d.ts +76 -0
- package/dist/api/utilities/channel-layout.js +80 -0
- package/dist/api/utilities/channel-layout.js.map +1 -0
- package/dist/api/utilities/codec-format.d.ts +87 -0
- package/dist/api/utilities/codec-format.js +117 -0
- package/dist/api/utilities/codec-format.js.map +1 -0
- package/dist/api/utilities/context-options.d.ts +25 -0
- package/dist/api/utilities/context-options.js +23 -0
- package/dist/api/utilities/context-options.js.map +1 -0
- package/dist/api/utilities/electron-shared-texture.d.ts +368 -0
- package/dist/api/utilities/electron-shared-texture.js +540 -0
- package/dist/api/utilities/electron-shared-texture.js.map +1 -0
- package/dist/api/utilities/image.d.ts +207 -0
- package/dist/api/utilities/image.js +213 -0
- package/dist/api/utilities/image.js.map +1 -0
- package/dist/api/utilities/index.d.ts +14 -0
- package/dist/api/utilities/index.js +27 -0
- package/dist/api/utilities/index.js.map +1 -0
- package/dist/api/utilities/live-decoding.d.ts +15 -0
- package/dist/api/utilities/live-decoding.js +32 -0
- package/dist/api/utilities/live-decoding.js.map +1 -0
- package/dist/api/utilities/media-type.d.ts +49 -0
- package/dist/api/utilities/media-type.js +53 -0
- package/dist/api/utilities/media-type.js.map +1 -0
- package/dist/api/utilities/packet-age-watchdog.d.ts +198 -0
- package/dist/api/utilities/packet-age-watchdog.js +594 -0
- package/dist/api/utilities/packet-age-watchdog.js.map +1 -0
- package/dist/api/utilities/pixel-format.d.ts +89 -0
- package/dist/api/utilities/pixel-format.js +97 -0
- package/dist/api/utilities/pixel-format.js.map +1 -0
- package/dist/api/utilities/sample-format.d.ts +129 -0
- package/dist/api/utilities/sample-format.js +141 -0
- package/dist/api/utilities/sample-format.js.map +1 -0
- package/dist/api/utilities/scale-size.d.ts +51 -0
- package/dist/api/utilities/scale-size.js +55 -0
- package/dist/api/utilities/scale-size.js.map +1 -0
- package/dist/api/utilities/scheduler.d.ts +138 -0
- package/dist/api/utilities/scheduler.js +98 -0
- package/dist/api/utilities/scheduler.js.map +1 -0
- package/dist/api/utilities/streaming.d.ts +186 -0
- package/dist/api/utilities/streaming.js +309 -0
- package/dist/api/utilities/streaming.js.map +1 -0
- package/dist/api/utilities/timestamp.d.ts +193 -0
- package/dist/api/utilities/timestamp.js +206 -0
- package/dist/api/utilities/timestamp.js.map +1 -0
- package/dist/api/utilities/video-transcode.d.ts +218 -0
- package/dist/api/utilities/video-transcode.js +624 -0
- package/dist/api/utilities/video-transcode.js.map +1 -0
- package/dist/api/utilities/whisper-model.d.ts +330 -0
- package/dist/api/utilities/whisper-model.js +587 -0
- package/dist/api/utilities/whisper-model.js.map +1 -0
- package/dist/api/utils.d.ts +19 -0
- package/dist/api/utils.js +39 -0
- package/dist/api/utils.js.map +1 -0
- package/dist/api/webrtc-stream.d.ts +294 -0
- package/dist/api/webrtc-stream.js +546 -0
- package/dist/api/webrtc-stream.js.map +1 -0
- package/dist/api/whisper.d.ts +326 -0
- package/dist/api/whisper.js +402 -0
- package/dist/api/whisper.js.map +1 -0
- package/dist/constants/bsf-options.d.ts +364 -0
- package/dist/constants/bsf-options.js +7 -0
- package/dist/constants/bsf-options.js.map +1 -0
- package/dist/constants/channel-layouts.d.ts +53 -0
- package/dist/constants/channel-layouts.js +57 -0
- package/dist/constants/channel-layouts.js.map +1 -0
- package/dist/constants/constants.d.ts +2435 -0
- package/dist/constants/constants.js +1989 -0
- package/dist/constants/constants.js.map +1 -0
- package/dist/constants/decoders.d.ts +651 -0
- package/dist/constants/decoders.js +641 -0
- package/dist/constants/decoders.js.map +1 -0
- package/dist/constants/encoders.d.ts +314 -0
- package/dist/constants/encoders.js +309 -0
- package/dist/constants/encoders.js.map +1 -0
- package/dist/constants/filter-options.d.ts +12099 -0
- package/dist/constants/filter-options.js +7 -0
- package/dist/constants/filter-options.js.map +1 -0
- package/dist/constants/format-options.d.ts +4319 -0
- package/dist/constants/format-options.js +7 -0
- package/dist/constants/format-options.js.map +1 -0
- package/dist/constants/formats.d.ts +18 -0
- package/dist/constants/formats.js +7 -0
- package/dist/constants/formats.js.map +1 -0
- package/dist/constants/hardware.d.ts +26 -0
- package/dist/constants/hardware.js +27 -0
- package/dist/constants/hardware.js.map +1 -0
- package/dist/constants/index.d.ts +10 -0
- package/dist/constants/index.js +6 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/options.d.ts +6217 -0
- package/dist/constants/options.js +7 -0
- package/dist/constants/options.js.map +1 -0
- package/dist/ffmpeg/index.d.ts +101 -0
- package/dist/ffmpeg/index.js +161 -0
- package/dist/ffmpeg/index.js.map +1 -0
- package/dist/ffmpeg/version.d.ts +6 -0
- package/dist/ffmpeg/version.js +7 -0
- package/dist/ffmpeg/version.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/audio-fifo.d.ts +399 -0
- package/dist/lib/audio-fifo.js +431 -0
- package/dist/lib/audio-fifo.js.map +1 -0
- package/dist/lib/binding.d.ts +242 -0
- package/dist/lib/binding.js +102 -0
- package/dist/lib/binding.js.map +1 -0
- package/dist/lib/bitstream-filter-context.d.ts +381 -0
- package/dist/lib/bitstream-filter-context.js +443 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -0
- package/dist/lib/bitstream-filter.d.ts +140 -0
- package/dist/lib/bitstream-filter.js +154 -0
- package/dist/lib/bitstream-filter.js.map +1 -0
- package/dist/lib/codec-context.d.ts +1069 -0
- package/dist/lib/codec-context.js +1336 -0
- package/dist/lib/codec-context.js.map +1 -0
- package/dist/lib/codec-parameters.d.ts +664 -0
- package/dist/lib/codec-parameters.js +813 -0
- package/dist/lib/codec-parameters.js.map +1 -0
- package/dist/lib/codec-parser.d.ts +201 -0
- package/dist/lib/codec-parser.js +213 -0
- package/dist/lib/codec-parser.js.map +1 -0
- package/dist/lib/codec.d.ts +617 -0
- package/dist/lib/codec.js +746 -0
- package/dist/lib/codec.js.map +1 -0
- package/dist/lib/device.d.ts +294 -0
- package/dist/lib/device.js +326 -0
- package/dist/lib/device.js.map +1 -0
- package/dist/lib/dictionary.d.ts +333 -0
- package/dist/lib/dictionary.js +372 -0
- package/dist/lib/dictionary.js.map +1 -0
- package/dist/lib/error.d.ts +311 -0
- package/dist/lib/error.js +395 -0
- package/dist/lib/error.js.map +1 -0
- package/dist/lib/fifo.d.ts +416 -0
- package/dist/lib/fifo.js +453 -0
- package/dist/lib/fifo.js.map +1 -0
- package/dist/lib/filter-context.d.ts +714 -0
- package/dist/lib/filter-context.js +783 -0
- package/dist/lib/filter-context.js.map +1 -0
- package/dist/lib/filter-graph-segment.d.ts +161 -0
- package/dist/lib/filter-graph-segment.js +172 -0
- package/dist/lib/filter-graph-segment.js.map +1 -0
- package/dist/lib/filter-graph.d.ts +641 -0
- package/dist/lib/filter-graph.js +704 -0
- package/dist/lib/filter-graph.js.map +1 -0
- package/dist/lib/filter-inout.d.ts +202 -0
- package/dist/lib/filter-inout.js +261 -0
- package/dist/lib/filter-inout.js.map +1 -0
- package/dist/lib/filter.d.ts +243 -0
- package/dist/lib/filter.js +272 -0
- package/dist/lib/filter.js.map +1 -0
- package/dist/lib/format-context.d.ts +1335 -0
- package/dist/lib/format-context.js +1455 -0
- package/dist/lib/format-context.js.map +1 -0
- package/dist/lib/frame-utils.d.ts +116 -0
- package/dist/lib/frame-utils.js +98 -0
- package/dist/lib/frame-utils.js.map +1 -0
- package/dist/lib/frame.d.ts +1315 -0
- package/dist/lib/frame.js +1535 -0
- package/dist/lib/frame.js.map +1 -0
- package/dist/lib/hardware-device-context.d.ts +362 -0
- package/dist/lib/hardware-device-context.js +383 -0
- package/dist/lib/hardware-device-context.js.map +1 -0
- package/dist/lib/hardware-frames-context.d.ts +418 -0
- package/dist/lib/hardware-frames-context.js +471 -0
- package/dist/lib/hardware-frames-context.js.map +1 -0
- package/dist/lib/index.d.ts +35 -0
- package/dist/lib/index.js +60 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/input-format.d.ts +249 -0
- package/dist/lib/input-format.js +306 -0
- package/dist/lib/input-format.js.map +1 -0
- package/dist/lib/io-context.d.ts +698 -0
- package/dist/lib/io-context.js +771 -0
- package/dist/lib/io-context.js.map +1 -0
- package/dist/lib/log.d.ts +174 -0
- package/dist/lib/log.js +184 -0
- package/dist/lib/log.js.map +1 -0
- package/dist/lib/native-types.d.ts +1024 -0
- package/dist/lib/native-types.js +2 -0
- package/dist/lib/native-types.js.map +1 -0
- package/dist/lib/option.d.ts +953 -0
- package/dist/lib/option.js +1607 -0
- package/dist/lib/option.js.map +1 -0
- package/dist/lib/output-format.d.ts +222 -0
- package/dist/lib/output-format.js +259 -0
- package/dist/lib/output-format.js.map +1 -0
- package/dist/lib/packet.d.ts +521 -0
- package/dist/lib/packet.js +613 -0
- package/dist/lib/packet.js.map +1 -0
- package/dist/lib/rational.d.ts +251 -0
- package/dist/lib/rational.js +278 -0
- package/dist/lib/rational.js.map +1 -0
- package/dist/lib/software-resample-context.d.ts +552 -0
- package/dist/lib/software-resample-context.js +592 -0
- package/dist/lib/software-resample-context.js.map +1 -0
- package/dist/lib/software-scale-context.d.ts +344 -0
- package/dist/lib/software-scale-context.js +366 -0
- package/dist/lib/software-scale-context.js.map +1 -0
- package/dist/lib/stream.d.ts +383 -0
- package/dist/lib/stream.js +524 -0
- package/dist/lib/stream.js.map +1 -0
- package/dist/lib/sync-queue.d.ts +179 -0
- package/dist/lib/sync-queue.js +197 -0
- package/dist/lib/sync-queue.js.map +1 -0
- package/dist/lib/types.d.ts +34 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utilities.d.ts +1198 -0
- package/dist/lib/utilities.js +1302 -0
- package/dist/lib/utilities.js.map +1 -0
- package/dist/utils/electron.d.ts +49 -0
- package/dist/utils/electron.js +63 -0
- package/dist/utils/electron.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/libc.d.ts +11 -0
- package/dist/utils/libc.js +35 -0
- package/dist/utils/libc.js.map +1 -0
- package/dist/utils/variant.d.ts +26 -0
- package/dist/utils/variant.js +31 -0
- package/dist/utils/variant.js.map +1 -0
- package/dist/webrtc/index.d.ts +4 -0
- package/dist/webrtc/index.js +7 -0
- package/dist/webrtc/index.js.map +1 -0
- package/install/check.js +124 -0
- package/install/ffmpeg.js +66 -0
- package/package.json +165 -3
|
@@ -0,0 +1,801 @@
|
|
|
1
|
+
import type { Frame } from '../lib/frame.js';
|
|
2
|
+
import type { Packet } from '../lib/packet.js';
|
|
3
|
+
import type { BitStreamFilterAPI } from './bitstream-filter.js';
|
|
4
|
+
import type { Decoder } from './decoder.js';
|
|
5
|
+
import type { Demuxer } from './demuxer.js';
|
|
6
|
+
import type { Encoder } from './encoder.js';
|
|
7
|
+
import type { FilterAPI } from './filter.js';
|
|
8
|
+
import type { Muxer } from './muxer.js';
|
|
9
|
+
export type StreamName = 'video' | 'audio';
|
|
10
|
+
export type NamedInputs<K extends StreamName = StreamName> = Pick<Record<StreamName, Demuxer>, K>;
|
|
11
|
+
export type NamedStages<K extends StreamName = StreamName> = Pick<Record<StreamName, (Decoder | FilterAPI | FilterAPI[] | Encoder | BitStreamFilterAPI | BitStreamFilterAPI[] | undefined)[] | 'passthrough'>, K>;
|
|
12
|
+
export type NamedOutputs<K extends StreamName = StreamName> = Pick<Record<StreamName, Muxer>, K>;
|
|
13
|
+
/**
|
|
14
|
+
* Pipeline control interface for managing pipeline execution.
|
|
15
|
+
* Allows graceful stopping and completion tracking of running pipelines.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const control = pipeline(input, decoder, encoder, output);
|
|
20
|
+
*
|
|
21
|
+
* // Stop after 10 seconds
|
|
22
|
+
* setTimeout(() => control.stop(), 10000);
|
|
23
|
+
*
|
|
24
|
+
* // Wait for completion
|
|
25
|
+
* await control.completion;
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface PipelineControl {
|
|
29
|
+
/**
|
|
30
|
+
* Stop the pipeline gracefully.
|
|
31
|
+
* The pipeline will stop processing after the current operation completes.
|
|
32
|
+
*/
|
|
33
|
+
stop(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Check if the pipeline has been stopped.
|
|
36
|
+
*
|
|
37
|
+
* @returns True if stop() has been called
|
|
38
|
+
*/
|
|
39
|
+
isStopped(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Promise that resolves when the pipeline completes.
|
|
42
|
+
* Resolves when all processing is finished or the pipeline is stopped.
|
|
43
|
+
* Rejects when processing fails - e.g. the input errors mid-stream (a dead
|
|
44
|
+
* network source reads as an error, not as end-of-file) or a stage throws.
|
|
45
|
+
*/
|
|
46
|
+
readonly completion: Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Latest progress snapshot.
|
|
49
|
+
*
|
|
50
|
+
* Reflects the output packets written so far. Poll this, or pass
|
|
51
|
+
* `onProgress` in {@link PipelineOptions} for push updates.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const control = pipeline(input, decoder, encoder, output);
|
|
56
|
+
* const timer = setInterval(() => console.log(control.progress.fps), 1000);
|
|
57
|
+
* await control.completion;
|
|
58
|
+
* clearInterval(timer);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
readonly progress: PipelineProgress;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Progress statistics for a running pipeline.
|
|
65
|
+
*
|
|
66
|
+
* Derived from the packets written to the output, mirroring the figures
|
|
67
|
+
* FFmpeg's CLI reports (`frame= fps= bitrate= time= speed=`).
|
|
68
|
+
*/
|
|
69
|
+
export interface PipelineProgress {
|
|
70
|
+
/** Number of output packets written so far. */
|
|
71
|
+
frames: number;
|
|
72
|
+
/** Total output bytes written so far. */
|
|
73
|
+
bytes: number;
|
|
74
|
+
/** Furthest output media timestamp reached, in seconds. */
|
|
75
|
+
time: number;
|
|
76
|
+
/** Output packets per wall-clock second. */
|
|
77
|
+
fps: number;
|
|
78
|
+
/** Output bitrate in bits per second (over media time). */
|
|
79
|
+
bitrate: number;
|
|
80
|
+
/** Processing speed relative to real time (media time / wall-clock time). */
|
|
81
|
+
speed: number;
|
|
82
|
+
/** Wall-clock seconds elapsed since the pipeline started. */
|
|
83
|
+
elapsed: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Options for pipeline execution.
|
|
87
|
+
*/
|
|
88
|
+
export interface PipelineOptions {
|
|
89
|
+
/**
|
|
90
|
+
* AbortSignal for cancellation.
|
|
91
|
+
*
|
|
92
|
+
* When aborted, the pipeline stops processing gracefully.
|
|
93
|
+
* Equivalent to calling `control.stop()`.
|
|
94
|
+
*/
|
|
95
|
+
signal?: AbortSignal;
|
|
96
|
+
/**
|
|
97
|
+
* Progress callback.
|
|
98
|
+
*
|
|
99
|
+
* Invoked with the latest {@link PipelineProgress} as output packets are
|
|
100
|
+
* written, throttled to `progressInterval`, plus a final call on completion.
|
|
101
|
+
*/
|
|
102
|
+
onProgress?: (progress: PipelineProgress) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Minimum interval between `onProgress` callbacks, in milliseconds.
|
|
105
|
+
*
|
|
106
|
+
* @default 250
|
|
107
|
+
*/
|
|
108
|
+
progressInterval?: number;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Full transcoding pipeline: input → decoder → encoder → output.
|
|
112
|
+
*
|
|
113
|
+
* @param source - Media input source
|
|
114
|
+
*
|
|
115
|
+
* @param decoder - Decoder for decoding packets to frames
|
|
116
|
+
*
|
|
117
|
+
* @param encoder - Encoder for encoding frames to packets
|
|
118
|
+
*
|
|
119
|
+
* @param output - Media output destination
|
|
120
|
+
*
|
|
121
|
+
* @param options - Pipeline options for cancellation support
|
|
122
|
+
*
|
|
123
|
+
* @returns Pipeline control for managing execution
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const control = pipeline(input, decoder, encoder, output);
|
|
128
|
+
* await control.completion;
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, encoder: Encoder, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
132
|
+
/**
|
|
133
|
+
* Full transcoding pipeline with filter: input → decoder → filter → encoder → output.
|
|
134
|
+
*
|
|
135
|
+
* @param source - Media input source
|
|
136
|
+
*
|
|
137
|
+
* @param decoder - Decoder for decoding packets to frames
|
|
138
|
+
*
|
|
139
|
+
* @param filter - Filter or filter chain for processing frames
|
|
140
|
+
*
|
|
141
|
+
* @param encoder - Encoder for encoding frames to packets
|
|
142
|
+
*
|
|
143
|
+
* @param output - Media output destination
|
|
144
|
+
*
|
|
145
|
+
* @param options - Pipeline options for cancellation support
|
|
146
|
+
*
|
|
147
|
+
* @returns Pipeline control for managing execution
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const control = pipeline(input, decoder, scaleFilter, encoder, output);
|
|
152
|
+
* await control.completion;
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, filter: FilterAPI | FilterAPI[], encoder: Encoder, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
156
|
+
/**
|
|
157
|
+
* Transcoding with bitstream filter: input → decoder → encoder → bsf → output.
|
|
158
|
+
*
|
|
159
|
+
* @param source - Media input source
|
|
160
|
+
*
|
|
161
|
+
* @param decoder - Decoder for decoding packets
|
|
162
|
+
*
|
|
163
|
+
* @param encoder - Encoder for encoding frames
|
|
164
|
+
*
|
|
165
|
+
* @param bsf - Bitstream filter for packet processing
|
|
166
|
+
*
|
|
167
|
+
* @param output - Media output destination
|
|
168
|
+
*
|
|
169
|
+
* @param options - Pipeline options for cancellation support
|
|
170
|
+
*
|
|
171
|
+
* @returns Pipeline control for managing execution
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* const decoder = await Decoder.create(input.video());
|
|
176
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
177
|
+
* const bsf = await BitStreamFilterAPI.create('h264_mp4toannexb');
|
|
178
|
+
* const control = pipeline(input, decoder, encoder, bsf, output);
|
|
179
|
+
* await control.completion;
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, encoder: Encoder, bsf: BitStreamFilterAPI | BitStreamFilterAPI[], output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
183
|
+
/**
|
|
184
|
+
* Full pipeline with filter and bsf: input → decoder → filter → encoder → bsf → output.
|
|
185
|
+
*
|
|
186
|
+
* @param source - Media input source
|
|
187
|
+
*
|
|
188
|
+
* @param decoder - Decoder for decoding packets
|
|
189
|
+
*
|
|
190
|
+
* @param filter - Filter or filter chain
|
|
191
|
+
*
|
|
192
|
+
* @param encoder - Encoder for encoding frames
|
|
193
|
+
*
|
|
194
|
+
* @param bsf - Bitstream filter
|
|
195
|
+
*
|
|
196
|
+
* @param output - Media output destination
|
|
197
|
+
*
|
|
198
|
+
* @param options - Pipeline options for cancellation support
|
|
199
|
+
*
|
|
200
|
+
* @returns Pipeline control for managing execution
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* const decoder = await Decoder.create(input.video());
|
|
205
|
+
* const filter = FilterAPI.create('scale=640:480', { ... });
|
|
206
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
207
|
+
* const bsf = await BitStreamFilterAPI.create('h264_mp4toannexb');
|
|
208
|
+
* const control = pipeline(input, decoder, filter, encoder, bsf, output);
|
|
209
|
+
* await control.completion;
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, filter: FilterAPI | FilterAPI[], encoder: Encoder, bsf: BitStreamFilterAPI | BitStreamFilterAPI[], output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
213
|
+
/**
|
|
214
|
+
* Decode + multiple filters + encode: input → decoder → filter1 → filter2 → encoder → output.
|
|
215
|
+
*
|
|
216
|
+
* @param source - Media input source
|
|
217
|
+
*
|
|
218
|
+
* @param decoder - Decoder for decoding packets
|
|
219
|
+
*
|
|
220
|
+
* @param filter1 - First filter
|
|
221
|
+
*
|
|
222
|
+
* @param filter2 - Second filter
|
|
223
|
+
*
|
|
224
|
+
* @param encoder - Encoder for encoding frames
|
|
225
|
+
*
|
|
226
|
+
* @param output - Media output destination
|
|
227
|
+
*
|
|
228
|
+
* @param options - Pipeline options for cancellation support
|
|
229
|
+
*
|
|
230
|
+
* @returns Pipeline control for managing execution
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const decoder = await Decoder.create(input.video());
|
|
235
|
+
* const scaleFilter = FilterAPI.create('scale=640:480', { ... });
|
|
236
|
+
* const cropFilter = FilterAPI.create('crop=640:360', { ... });
|
|
237
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
238
|
+
* const control = pipeline(input, decoder, scaleFilter, cropFilter, encoder, output);
|
|
239
|
+
* await control.completion;
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, filter1: FilterAPI, filter2: FilterAPI, encoder: Encoder, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
243
|
+
/**
|
|
244
|
+
* Stream copy pipeline: input → output (copies all streams).
|
|
245
|
+
*
|
|
246
|
+
* @param source - Media input source
|
|
247
|
+
*
|
|
248
|
+
* @param output - Media output destination
|
|
249
|
+
*
|
|
250
|
+
* @param options - Pipeline options for cancellation support
|
|
251
|
+
*
|
|
252
|
+
* @returns Pipeline control for managing execution
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* // Copy all streams without re-encoding
|
|
257
|
+
* const control = pipeline(input, output);
|
|
258
|
+
* await control.completion;
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export declare function pipeline(source: Demuxer, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
262
|
+
/**
|
|
263
|
+
* Stream copy with bitstream filter: input → bsf → output.
|
|
264
|
+
*
|
|
265
|
+
* @param source - Media input source
|
|
266
|
+
*
|
|
267
|
+
* @param bsf - Bitstream filter for packet processing
|
|
268
|
+
*
|
|
269
|
+
* @param output - Media output destination
|
|
270
|
+
*
|
|
271
|
+
* @param options - Pipeline options for cancellation support
|
|
272
|
+
*
|
|
273
|
+
* @returns Pipeline control for managing execution
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* // Convert H.264 stream format while copying
|
|
278
|
+
* const bsf = await BitStreamFilterAPI.create('h264_mp4toannexb');
|
|
279
|
+
* const control = pipeline(input, bsf, output);
|
|
280
|
+
* await control.completion;
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export declare function pipeline(source: Demuxer, bsf: BitStreamFilterAPI | BitStreamFilterAPI[], output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
284
|
+
/**
|
|
285
|
+
* Filter + encode + output: frames → filter → encoder → output.
|
|
286
|
+
*
|
|
287
|
+
* @param source - Frame source (async iterable)
|
|
288
|
+
*
|
|
289
|
+
* @param filter - Filter or filter chain
|
|
290
|
+
*
|
|
291
|
+
* @param encoder - Encoder for encoding frames
|
|
292
|
+
*
|
|
293
|
+
* @param output - Media output destination
|
|
294
|
+
*
|
|
295
|
+
* @param options - Pipeline options for cancellation support
|
|
296
|
+
*
|
|
297
|
+
* @returns Pipeline control for managing execution
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* // Process frames from custom source
|
|
302
|
+
* const frameSource = generateFrames(); // Your async frame generator
|
|
303
|
+
* const filter = FilterAPI.create('scale=1920:1080', { ... });
|
|
304
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
305
|
+
* const control = pipeline(frameSource, filter, encoder, output);
|
|
306
|
+
* await control.completion;
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
export declare function pipeline(source: AsyncIterable<Frame | null>, filter: FilterAPI | FilterAPI[], encoder: Encoder, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
310
|
+
/**
|
|
311
|
+
* Encode + output: frames → encoder → output.
|
|
312
|
+
*
|
|
313
|
+
* @param source - Frame source (async iterable)
|
|
314
|
+
*
|
|
315
|
+
* @param encoder - Encoder for encoding frames
|
|
316
|
+
*
|
|
317
|
+
* @param output - Media output destination
|
|
318
|
+
*
|
|
319
|
+
* @param options - Pipeline options for cancellation support
|
|
320
|
+
*
|
|
321
|
+
* @returns Pipeline control for managing execution
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* // Encode raw frames directly
|
|
326
|
+
* const frameSource = generateFrames(); // Your async frame generator
|
|
327
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
328
|
+
* const control = pipeline(frameSource, encoder, output);
|
|
329
|
+
* await control.completion;
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
export declare function pipeline(source: AsyncIterable<Frame | null>, encoder: Encoder, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
333
|
+
/**
|
|
334
|
+
* Partial pipeline: input → decoder (returns frames).
|
|
335
|
+
*
|
|
336
|
+
* @param source - Media input source
|
|
337
|
+
*
|
|
338
|
+
* @param decoder - Decoder for decoding packets
|
|
339
|
+
*
|
|
340
|
+
* @param options - Pipeline options for cancellation support
|
|
341
|
+
*
|
|
342
|
+
* @returns Async generator of frames
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```typescript
|
|
346
|
+
* // Get decoded frames for custom processing
|
|
347
|
+
* const decoder = await Decoder.create(input.video());
|
|
348
|
+
* const frames = pipeline(input, decoder);
|
|
349
|
+
* for await (const frame of frames) {
|
|
350
|
+
* // Process frame
|
|
351
|
+
* frame.free();
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, options?: PipelineOptions): AsyncGenerator<Frame | null>;
|
|
356
|
+
/**
|
|
357
|
+
* Partial pipeline: input → decoder → filter (returns frames).
|
|
358
|
+
*
|
|
359
|
+
* @param source - Media input source
|
|
360
|
+
*
|
|
361
|
+
* @param decoder - Decoder for decoding packets
|
|
362
|
+
*
|
|
363
|
+
* @param filter - Filter or filter chain
|
|
364
|
+
*
|
|
365
|
+
* @param options - Pipeline options for cancellation support
|
|
366
|
+
*
|
|
367
|
+
* @returns Async generator of frames
|
|
368
|
+
*
|
|
369
|
+
* @example
|
|
370
|
+
* ```typescript
|
|
371
|
+
* // Get filtered frames for custom processing
|
|
372
|
+
* const decoder = await Decoder.create(input.video());
|
|
373
|
+
* const filter = FilterAPI.create('scale=640:480', { ... });
|
|
374
|
+
* const frames = pipeline(input, decoder, filter);
|
|
375
|
+
* for await (const frame of frames) {
|
|
376
|
+
* // Process filtered frame
|
|
377
|
+
* frame.free();
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*/
|
|
381
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, filter: FilterAPI | FilterAPI[], options?: PipelineOptions): AsyncGenerator<Frame | null>;
|
|
382
|
+
/**
|
|
383
|
+
* Partial pipeline: input → decoder → filter → encoder (returns packets).
|
|
384
|
+
*
|
|
385
|
+
* @param source - Media input source
|
|
386
|
+
*
|
|
387
|
+
* @param decoder - Decoder for decoding packets
|
|
388
|
+
*
|
|
389
|
+
* @param filter - Filter or filter chain
|
|
390
|
+
*
|
|
391
|
+
* @param encoder - Encoder for encoding frames
|
|
392
|
+
*
|
|
393
|
+
* @param options - Pipeline options for cancellation support
|
|
394
|
+
*
|
|
395
|
+
* @returns Async generator of packets
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* // Get encoded packets for custom output handling
|
|
400
|
+
* const decoder = await Decoder.create(input.video());
|
|
401
|
+
* const filter = FilterAPI.create('scale=640:480', { ... });
|
|
402
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
403
|
+
* const packets = pipeline(input, decoder, filter, encoder);
|
|
404
|
+
* for await (const packet of packets) {
|
|
405
|
+
* // Handle encoded packet
|
|
406
|
+
* packet.free();
|
|
407
|
+
* }
|
|
408
|
+
* ```
|
|
409
|
+
*/
|
|
410
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, filter: FilterAPI | FilterAPI[], encoder: Encoder, options?: PipelineOptions): AsyncGenerator<Packet | null>;
|
|
411
|
+
/**
|
|
412
|
+
* Partial pipeline: input → decoder → encoder (returns packets).
|
|
413
|
+
*
|
|
414
|
+
* @param source - Media input source
|
|
415
|
+
*
|
|
416
|
+
* @param decoder - Decoder for decoding packets
|
|
417
|
+
*
|
|
418
|
+
* @param encoder - Encoder for encoding frames
|
|
419
|
+
*
|
|
420
|
+
* @param options - Pipeline options for cancellation support
|
|
421
|
+
*
|
|
422
|
+
* @returns Async generator of packets
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* ```typescript
|
|
426
|
+
* // Transcode to packets for custom output
|
|
427
|
+
* const decoder = await Decoder.create(input.video());
|
|
428
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
429
|
+
* const packets = pipeline(input, decoder, encoder);
|
|
430
|
+
* for await (const packet of packets) {
|
|
431
|
+
* // Handle transcoded packet
|
|
432
|
+
* packet.free();
|
|
433
|
+
* }
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
export declare function pipeline(source: Demuxer, decoder: Decoder, encoder: Encoder, options?: PipelineOptions): AsyncGenerator<Packet | null>;
|
|
437
|
+
/**
|
|
438
|
+
* Partial pipeline: frames → filter (returns frames).
|
|
439
|
+
*
|
|
440
|
+
* @param source - Frame source (async iterable)
|
|
441
|
+
*
|
|
442
|
+
* @param filter - Filter or filter chain
|
|
443
|
+
*
|
|
444
|
+
* @param options - Pipeline options for cancellation support
|
|
445
|
+
*
|
|
446
|
+
* @returns Async generator of filtered frames
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```typescript
|
|
450
|
+
* // Filter frames from custom source
|
|
451
|
+
* const frameSource = generateFrames();
|
|
452
|
+
* const filter = FilterAPI.create('scale=640:480', { ... });
|
|
453
|
+
* const filteredFrames = pipeline(frameSource, filter);
|
|
454
|
+
* for await (const frame of filteredFrames) {
|
|
455
|
+
* // Process filtered frame
|
|
456
|
+
* frame.free();
|
|
457
|
+
* }
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
export declare function pipeline(source: AsyncIterable<Frame | null>, filter: FilterAPI | FilterAPI[], options?: PipelineOptions): AsyncGenerator<Frame | null>;
|
|
461
|
+
/**
|
|
462
|
+
* Partial pipeline: frames → encoder (returns packets).
|
|
463
|
+
*
|
|
464
|
+
* @param source - Frame source (async iterable)
|
|
465
|
+
*
|
|
466
|
+
* @param encoder - Encoder for encoding frames
|
|
467
|
+
*
|
|
468
|
+
* @param options - Pipeline options for cancellation support
|
|
469
|
+
*
|
|
470
|
+
* @returns Async generator of packets
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```typescript
|
|
474
|
+
* // Encode frames to packets
|
|
475
|
+
* const frameSource = generateFrames();
|
|
476
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
477
|
+
* const packets = pipeline(frameSource, encoder);
|
|
478
|
+
* for await (const packet of packets) {
|
|
479
|
+
* // Handle encoded packet
|
|
480
|
+
* packet.free();
|
|
481
|
+
* }
|
|
482
|
+
* ```
|
|
483
|
+
*/
|
|
484
|
+
export declare function pipeline(source: AsyncIterable<Frame | null>, encoder: Encoder, options?: PipelineOptions): AsyncGenerator<Packet | null>;
|
|
485
|
+
/**
|
|
486
|
+
* Partial pipeline: frames → filter → encoder (returns packets).
|
|
487
|
+
*
|
|
488
|
+
* @param source - Frame source (async iterable)
|
|
489
|
+
*
|
|
490
|
+
* @param filter - Filter or filter chain
|
|
491
|
+
*
|
|
492
|
+
* @param encoder - Encoder for encoding frames
|
|
493
|
+
*
|
|
494
|
+
* @param options - Pipeline options for cancellation support
|
|
495
|
+
*
|
|
496
|
+
* @returns Async generator of packets
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* // Process frames with filter and encode to packets
|
|
501
|
+
* const frameSource = generateFrames();
|
|
502
|
+
* const filter = FilterAPI.create('scale=640:480', { ... });
|
|
503
|
+
* const encoder = await Encoder.create(FF_ENCODER_LIBX264, { ... });
|
|
504
|
+
* const packets = pipeline(frameSource, filter, encoder);
|
|
505
|
+
* for await (const packet of packets) {
|
|
506
|
+
* // Handle encoded packet
|
|
507
|
+
* packet.free();
|
|
508
|
+
* }
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
export declare function pipeline(source: AsyncIterable<Frame | null>, filter: FilterAPI | FilterAPI[], encoder: Encoder, options?: PipelineOptions): AsyncGenerator<Packet | null>;
|
|
512
|
+
/**
|
|
513
|
+
* Named pipeline with shared input and single output.
|
|
514
|
+
*
|
|
515
|
+
* @param input - Shared input source (used for all streams)
|
|
516
|
+
*
|
|
517
|
+
* @param stages - Named processing stages for each stream
|
|
518
|
+
*
|
|
519
|
+
* @param output - Single output destination for all streams
|
|
520
|
+
*
|
|
521
|
+
* @param options - Pipeline options for cancellation support
|
|
522
|
+
*
|
|
523
|
+
* @returns Pipeline control for managing execution
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```typescript
|
|
527
|
+
* // Named pipeline with shared input
|
|
528
|
+
* const control = pipeline(
|
|
529
|
+
* input, // Automatically used for both video and audio
|
|
530
|
+
* {
|
|
531
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
532
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
533
|
+
* },
|
|
534
|
+
* output
|
|
535
|
+
* );
|
|
536
|
+
* await control.completion;
|
|
537
|
+
* ```
|
|
538
|
+
*/
|
|
539
|
+
export declare function pipeline<K extends StreamName>(input: Demuxer, stages: NamedStages<K>, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
540
|
+
/**
|
|
541
|
+
* Named pipeline with single output - all streams go to the same output.
|
|
542
|
+
*
|
|
543
|
+
* @param inputs - Named input sources (video/audio)
|
|
544
|
+
*
|
|
545
|
+
* @param stages - Named processing stages for each stream
|
|
546
|
+
*
|
|
547
|
+
* @param output - Single output destination for all streams
|
|
548
|
+
*
|
|
549
|
+
* @param options - Pipeline options for cancellation support
|
|
550
|
+
*
|
|
551
|
+
* @returns Pipeline control for managing execution
|
|
552
|
+
*
|
|
553
|
+
* @example
|
|
554
|
+
* ```typescript
|
|
555
|
+
* // Named pipeline for muxing
|
|
556
|
+
* const control = pipeline(
|
|
557
|
+
* { video: videoInput, audio: audioInput },
|
|
558
|
+
* {
|
|
559
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
560
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
561
|
+
* },
|
|
562
|
+
* output
|
|
563
|
+
* );
|
|
564
|
+
* await control.completion;
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
567
|
+
export declare function pipeline<K extends StreamName>(inputs: NamedInputs<K>, stages: NamedStages<K>, output: Muxer, options?: PipelineOptions): PipelineControl;
|
|
568
|
+
/**
|
|
569
|
+
* Named pipeline with shared input and multiple outputs.
|
|
570
|
+
*
|
|
571
|
+
* @param input - Shared input source (used for all streams)
|
|
572
|
+
*
|
|
573
|
+
* @param stages - Named processing stages for each stream
|
|
574
|
+
*
|
|
575
|
+
* @param outputs - Named output destinations
|
|
576
|
+
*
|
|
577
|
+
* @param options - Pipeline options for cancellation support
|
|
578
|
+
*
|
|
579
|
+
* @returns Pipeline control for managing execution
|
|
580
|
+
*
|
|
581
|
+
* @example
|
|
582
|
+
* ```typescript
|
|
583
|
+
* // Named pipeline with shared input and separate outputs
|
|
584
|
+
* const control = pipeline(
|
|
585
|
+
* input, // Automatically used for both video and audio
|
|
586
|
+
* {
|
|
587
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
588
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
589
|
+
* },
|
|
590
|
+
* { video: videoOutput, audio: audioOutput }
|
|
591
|
+
* );
|
|
592
|
+
* await control.completion;
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
export declare function pipeline<K extends StreamName>(input: Demuxer, stages: NamedStages<K>, outputs: NamedOutputs<K>, options?: PipelineOptions): PipelineControl;
|
|
596
|
+
/**
|
|
597
|
+
* Named pipeline with multiple outputs - each stream has its own output.
|
|
598
|
+
*
|
|
599
|
+
* @param inputs - Named input sources (video/audio)
|
|
600
|
+
*
|
|
601
|
+
* @param stages - Named processing stages for each stream
|
|
602
|
+
*
|
|
603
|
+
* @param outputs - Named output destinations
|
|
604
|
+
*
|
|
605
|
+
* @param options - Pipeline options for cancellation support
|
|
606
|
+
*
|
|
607
|
+
* @returns Pipeline control for managing execution
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```typescript
|
|
611
|
+
* // Named pipeline for audio/video processing
|
|
612
|
+
* const control = pipeline(
|
|
613
|
+
* { video: videoInput, audio: audioInput },
|
|
614
|
+
* {
|
|
615
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
616
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
617
|
+
* },
|
|
618
|
+
* { video: videoOutput, audio: audioOutput }
|
|
619
|
+
* );
|
|
620
|
+
* await control.completion;
|
|
621
|
+
* ```
|
|
622
|
+
*/
|
|
623
|
+
export declare function pipeline<K extends StreamName>(inputs: NamedInputs<K>, stages: NamedStages<K>, outputs: NamedOutputs<K>, options?: PipelineOptions): PipelineControl;
|
|
624
|
+
/**
|
|
625
|
+
* Partial named pipeline (returns generators for further processing).
|
|
626
|
+
*
|
|
627
|
+
* @param inputs - Named input sources
|
|
628
|
+
*
|
|
629
|
+
* @param stages - Named processing stages
|
|
630
|
+
*
|
|
631
|
+
* @param options - Pipeline options for cancellation support
|
|
632
|
+
*
|
|
633
|
+
* @returns Record of async generators for each stream
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* ```typescript
|
|
637
|
+
* // Partial named pipeline
|
|
638
|
+
* const generators = pipeline(
|
|
639
|
+
* { video: videoInput, audio: audioInput },
|
|
640
|
+
* {
|
|
641
|
+
* video: [videoDecoder, scaleFilter, videoEncoder],
|
|
642
|
+
* audio: [audioDecoder, volumeFilter, audioEncoder]
|
|
643
|
+
* }
|
|
644
|
+
* );
|
|
645
|
+
*
|
|
646
|
+
* // Access individual generators
|
|
647
|
+
* const videoGenerator = generators.video;
|
|
648
|
+
* const audioGenerator = generators.audio;
|
|
649
|
+
*
|
|
650
|
+
* // Use the generators
|
|
651
|
+
* for await (const packet of videoGenerator) {
|
|
652
|
+
* // Process video packet
|
|
653
|
+
* }
|
|
654
|
+
* for await (const packet of audioGenerator) {
|
|
655
|
+
* // Process audio packet
|
|
656
|
+
* }
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
export declare function pipeline<K extends StreamName, T extends Packet | Frame | null = Packet | Frame | null>(inputs: NamedInputs<K>, stages: NamedStages<K>, options?: PipelineOptions): Record<K, AsyncGenerator<T>>;
|
|
660
|
+
/**
|
|
661
|
+
* Accumulates output statistics and emits throttled progress updates.
|
|
662
|
+
*
|
|
663
|
+
* @internal
|
|
664
|
+
*/
|
|
665
|
+
declare class ProgressTracker {
|
|
666
|
+
private readonly onProgress?;
|
|
667
|
+
private readonly throttleMs;
|
|
668
|
+
private frames;
|
|
669
|
+
private bytes;
|
|
670
|
+
private maxTime;
|
|
671
|
+
private readonly startTime;
|
|
672
|
+
private lastEmit;
|
|
673
|
+
/**
|
|
674
|
+
* @param onProgress - Optional callback for push updates
|
|
675
|
+
*
|
|
676
|
+
* @param throttleMs - Minimum interval between callbacks
|
|
677
|
+
*
|
|
678
|
+
* @internal
|
|
679
|
+
*/
|
|
680
|
+
constructor(onProgress?: ((progress: PipelineProgress) => void) | undefined, throttleMs?: number);
|
|
681
|
+
/**
|
|
682
|
+
* Record a written output packet.
|
|
683
|
+
*
|
|
684
|
+
* @param packet - The packet written to the output
|
|
685
|
+
*
|
|
686
|
+
* @internal
|
|
687
|
+
*/
|
|
688
|
+
record(packet: Packet): void;
|
|
689
|
+
/**
|
|
690
|
+
* Build a progress snapshot from the current counters.
|
|
691
|
+
*
|
|
692
|
+
* @returns The current progress statistics
|
|
693
|
+
*
|
|
694
|
+
* @internal
|
|
695
|
+
*/
|
|
696
|
+
snapshot(): PipelineProgress;
|
|
697
|
+
/**
|
|
698
|
+
* Emit a final progress update.
|
|
699
|
+
*
|
|
700
|
+
* @internal
|
|
701
|
+
*/
|
|
702
|
+
finish(): void;
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Pipeline control implementation.
|
|
706
|
+
*
|
|
707
|
+
* @internal
|
|
708
|
+
*/
|
|
709
|
+
export declare class PipelineControlImpl implements PipelineControl {
|
|
710
|
+
private _stopped;
|
|
711
|
+
private _completion;
|
|
712
|
+
private signalCleanup?;
|
|
713
|
+
private tracker?;
|
|
714
|
+
private sources;
|
|
715
|
+
/**
|
|
716
|
+
* @param executionPromise - Promise that resolves when pipeline completes
|
|
717
|
+
*
|
|
718
|
+
* @param signal - Optional AbortSignal for cancellation
|
|
719
|
+
*
|
|
720
|
+
* @param tracker - Optional progress tracker shared with the runner
|
|
721
|
+
*
|
|
722
|
+
* @param sources - Demuxer sources to interrupt on stop (unblocks a stalled read)
|
|
723
|
+
*
|
|
724
|
+
* @internal
|
|
725
|
+
*/
|
|
726
|
+
constructor(executionPromise: Promise<void>, signal?: AbortSignal, tracker?: ProgressTracker, sources?: Demuxer[]);
|
|
727
|
+
/**
|
|
728
|
+
* Stop the pipeline.
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* ```typescript
|
|
732
|
+
* const control = pipeline(input, decoder, filter, encoder, output);
|
|
733
|
+
* control.stop();
|
|
734
|
+
* ```
|
|
735
|
+
*
|
|
736
|
+
* @see {@link PipelineControl.isStopped}
|
|
737
|
+
*/
|
|
738
|
+
stop(): void;
|
|
739
|
+
/**
|
|
740
|
+
* Check if pipeline is stopped.
|
|
741
|
+
*
|
|
742
|
+
* @returns True if stopped
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* ```typescript
|
|
746
|
+
* const control = pipeline(input, decoder, filter, encoder, output);
|
|
747
|
+
* const isStopped = control.isStopped();
|
|
748
|
+
* ```
|
|
749
|
+
*
|
|
750
|
+
* @see {@link PipelineControl.stop}
|
|
751
|
+
*/
|
|
752
|
+
isStopped(): boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Get completion promise.
|
|
755
|
+
*/
|
|
756
|
+
get completion(): Promise<void>;
|
|
757
|
+
/**
|
|
758
|
+
* Get the latest progress snapshot.
|
|
759
|
+
*/
|
|
760
|
+
get progress(): PipelineProgress;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Consume a stream in parallel (for passthrough pipelines).
|
|
764
|
+
* Stream index is already added to output.
|
|
765
|
+
*
|
|
766
|
+
* @param stream - Stream of packets
|
|
767
|
+
*
|
|
768
|
+
* @param output - Media output destination
|
|
769
|
+
*
|
|
770
|
+
* @param streamIndex - Pre-allocated stream index in output
|
|
771
|
+
*
|
|
772
|
+
* @param shouldStop - Function to check if pipeline should stop
|
|
773
|
+
*
|
|
774
|
+
* @param tracker - Optional progress tracker for output statistics
|
|
775
|
+
*
|
|
776
|
+
* @internal
|
|
777
|
+
*/
|
|
778
|
+
export declare function consumeStreamInParallel(stream: AsyncIterable<Packet | null>, output: Muxer, streamIndex: number, shouldStop: () => boolean, tracker?: ProgressTracker): Promise<void>;
|
|
779
|
+
/**
|
|
780
|
+
* Wrap a caller-supplied frame source so a stop request unblocks a stalled pull.
|
|
781
|
+
*
|
|
782
|
+
* A demuxer-backed pipeline unwinds promptly because stop() interrupts the
|
|
783
|
+
* blocking read. A frame source offers no such lever: the consuming loop only
|
|
784
|
+
* notices the stop request once the source yields again, so a source that goes
|
|
785
|
+
* silent (a wedged capture device, a generator awaiting an event that never
|
|
786
|
+
* fires) keeps the pipeline - and with it teardown - waiting forever. Calling
|
|
787
|
+
* `return()` on the source does not help, because an async generator queues
|
|
788
|
+
* that request behind the pending `next()` that is already stuck.
|
|
789
|
+
*
|
|
790
|
+
* Racing every pull against `stopped` supplies the missing lever.
|
|
791
|
+
*
|
|
792
|
+
* @param source - Caller-supplied frame source
|
|
793
|
+
*
|
|
794
|
+
* @param stopped - Resolves once teardown has been requested
|
|
795
|
+
*
|
|
796
|
+
* @yields {Frame | null} Frames from the source until it ends or teardown starts
|
|
797
|
+
*
|
|
798
|
+
* @internal
|
|
799
|
+
*/
|
|
800
|
+
export declare function interruptibleFrameSource(source: AsyncIterable<Frame | null>, stopped: Promise<void>): AsyncGenerator<Frame | null>;
|
|
801
|
+
export {};
|