webcodecs-node 0.2.2 → 0.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.
Files changed (121) hide show
  1. package/README.md +4 -0
  2. package/dist/__tests__/AudioDecoder.test.js +3 -3
  3. package/dist/__tests__/AudioDecoder.test.js.map +1 -1
  4. package/dist/__tests__/ImageDecoder.wpt.test.d.ts +8 -0
  5. package/dist/__tests__/ImageDecoder.wpt.test.d.ts.map +1 -0
  6. package/dist/__tests__/ImageDecoder.wpt.test.js +135 -0
  7. package/dist/__tests__/ImageDecoder.wpt.test.js.map +1 -0
  8. package/dist/__tests__/NodeAvDecoder.test.d.ts +2 -0
  9. package/dist/__tests__/NodeAvDecoder.test.d.ts.map +1 -0
  10. package/dist/__tests__/NodeAvDecoder.test.js +199 -0
  11. package/dist/__tests__/NodeAvDecoder.test.js.map +1 -0
  12. package/dist/__tests__/NodeAvEncoder.test.d.ts +2 -0
  13. package/dist/__tests__/NodeAvEncoder.test.d.ts.map +1 -0
  14. package/dist/__tests__/NodeAvEncoder.test.js +176 -0
  15. package/dist/__tests__/NodeAvEncoder.test.js.map +1 -0
  16. package/dist/__tests__/VideoFrame.test.js.map +1 -1
  17. package/dist/backends/index.d.ts +3 -0
  18. package/dist/backends/index.d.ts.map +1 -0
  19. package/dist/backends/index.js +2 -0
  20. package/dist/backends/index.js.map +1 -0
  21. package/dist/backends/types.d.ts +165 -0
  22. package/dist/backends/types.d.ts.map +1 -0
  23. package/dist/backends/types.js +25 -0
  24. package/dist/backends/types.js.map +1 -0
  25. package/dist/core/AudioData.d.ts +1 -1
  26. package/dist/core/AudioData.d.ts.map +1 -1
  27. package/dist/core/AudioData.js +13 -9
  28. package/dist/core/AudioData.js.map +1 -1
  29. package/dist/core/VideoFrame.d.ts +25 -10
  30. package/dist/core/VideoFrame.d.ts.map +1 -1
  31. package/dist/core/VideoFrame.js +115 -65
  32. package/dist/core/VideoFrame.js.map +1 -1
  33. package/dist/decoders/AudioDecoder.d.ts +6 -12
  34. package/dist/decoders/AudioDecoder.d.ts.map +1 -1
  35. package/dist/decoders/AudioDecoder.js +57 -147
  36. package/dist/decoders/AudioDecoder.js.map +1 -1
  37. package/dist/decoders/ImageDecoder.d.ts +1 -0
  38. package/dist/decoders/ImageDecoder.d.ts.map +1 -1
  39. package/dist/decoders/ImageDecoder.js +59 -0
  40. package/dist/decoders/ImageDecoder.js.map +1 -1
  41. package/dist/decoders/VideoDecoder.d.ts +6 -13
  42. package/dist/decoders/VideoDecoder.d.ts.map +1 -1
  43. package/dist/decoders/VideoDecoder.js +49 -130
  44. package/dist/decoders/VideoDecoder.js.map +1 -1
  45. package/dist/demos/demo-conversion.js +2 -2
  46. package/dist/demos/demo-conversion.js.map +1 -1
  47. package/dist/demos/demo-four-corners.d.ts +6 -0
  48. package/dist/demos/demo-four-corners.d.ts.map +1 -0
  49. package/dist/demos/demo-four-corners.js +218 -0
  50. package/dist/demos/demo-four-corners.js.map +1 -0
  51. package/dist/demos/demo-samples.js +228 -64
  52. package/dist/demos/demo-samples.js.map +1 -1
  53. package/dist/encoders/AudioEncoder.d.ts +6 -13
  54. package/dist/encoders/AudioEncoder.d.ts.map +1 -1
  55. package/dist/encoders/AudioEncoder.js +81 -213
  56. package/dist/encoders/AudioEncoder.js.map +1 -1
  57. package/dist/encoders/VideoEncoder.d.ts +5 -14
  58. package/dist/encoders/VideoEncoder.d.ts.map +1 -1
  59. package/dist/encoders/VideoEncoder.js +39 -159
  60. package/dist/encoders/VideoEncoder.js.map +1 -1
  61. package/dist/formats/conversions/frame-converter.d.ts +17 -0
  62. package/dist/formats/conversions/frame-converter.d.ts.map +1 -1
  63. package/dist/formats/conversions/frame-converter.js +127 -0
  64. package/dist/formats/conversions/frame-converter.js.map +1 -1
  65. package/dist/formats/conversions/index.d.ts +1 -0
  66. package/dist/formats/conversions/index.d.ts.map +1 -1
  67. package/dist/formats/conversions/index.js +2 -0
  68. package/dist/formats/conversions/index.js.map +1 -1
  69. package/dist/hardware/detection.d.ts +1 -1
  70. package/dist/hardware/detection.d.ts.map +1 -1
  71. package/dist/hardware/detection.js +54 -27
  72. package/dist/hardware/detection.js.map +1 -1
  73. package/dist/mediabunny/FFmpegAudioDecoder.d.ts +2 -16
  74. package/dist/mediabunny/FFmpegAudioDecoder.d.ts.map +1 -1
  75. package/dist/mediabunny/FFmpegAudioDecoder.js +59 -184
  76. package/dist/mediabunny/FFmpegAudioDecoder.js.map +1 -1
  77. package/dist/mediabunny/FFmpegAudioEncoder.d.ts +4 -38
  78. package/dist/mediabunny/FFmpegAudioEncoder.d.ts.map +1 -1
  79. package/dist/mediabunny/FFmpegAudioEncoder.js +64 -328
  80. package/dist/mediabunny/FFmpegAudioEncoder.js.map +1 -1
  81. package/dist/mediabunny/FFmpegVideoDecoder.d.ts +2 -36
  82. package/dist/mediabunny/FFmpegVideoDecoder.d.ts.map +1 -1
  83. package/dist/mediabunny/FFmpegVideoDecoder.js +37 -278
  84. package/dist/mediabunny/FFmpegVideoDecoder.js.map +1 -1
  85. package/dist/mediabunny/FFmpegVideoEncoder.d.ts +6 -35
  86. package/dist/mediabunny/FFmpegVideoEncoder.d.ts.map +1 -1
  87. package/dist/mediabunny/FFmpegVideoEncoder.js +46 -334
  88. package/dist/mediabunny/FFmpegVideoEncoder.js.map +1 -1
  89. package/dist/node-av/HardwarePipeline.d.ts +36 -0
  90. package/dist/node-av/HardwarePipeline.d.ts.map +1 -0
  91. package/dist/node-av/HardwarePipeline.js +243 -0
  92. package/dist/node-av/HardwarePipeline.js.map +1 -0
  93. package/dist/node-av/NodeAvAudioDecoder.d.ts +46 -0
  94. package/dist/node-av/NodeAvAudioDecoder.d.ts.map +1 -0
  95. package/dist/node-av/NodeAvAudioDecoder.js +343 -0
  96. package/dist/node-av/NodeAvAudioDecoder.js.map +1 -0
  97. package/dist/node-av/NodeAvAudioEncoder.d.ts +44 -0
  98. package/dist/node-av/NodeAvAudioEncoder.d.ts.map +1 -0
  99. package/dist/node-av/NodeAvAudioEncoder.js +385 -0
  100. package/dist/node-av/NodeAvAudioEncoder.js.map +1 -0
  101. package/dist/node-av/NodeAvImageDecoder.d.ts +95 -0
  102. package/dist/node-av/NodeAvImageDecoder.d.ts.map +1 -0
  103. package/dist/node-av/NodeAvImageDecoder.js +287 -0
  104. package/dist/node-av/NodeAvImageDecoder.js.map +1 -0
  105. package/dist/node-av/NodeAvVideoDecoder.d.ts +43 -0
  106. package/dist/node-av/NodeAvVideoDecoder.d.ts.map +1 -0
  107. package/dist/node-av/NodeAvVideoDecoder.js +361 -0
  108. package/dist/node-av/NodeAvVideoDecoder.js.map +1 -0
  109. package/dist/node-av/NodeAvVideoEncoder.d.ts +44 -0
  110. package/dist/node-av/NodeAvVideoEncoder.d.ts.map +1 -0
  111. package/dist/node-av/NodeAvVideoEncoder.js +397 -0
  112. package/dist/node-av/NodeAvVideoEncoder.js.map +1 -0
  113. package/dist/utils/event-target.d.ts +42 -0
  114. package/dist/utils/event-target.d.ts.map +1 -0
  115. package/dist/utils/event-target.js +96 -0
  116. package/dist/utils/event-target.js.map +1 -0
  117. package/dist/utils/index.d.ts +1 -0
  118. package/dist/utils/index.d.ts.map +1 -1
  119. package/dist/utils/index.js +2 -0
  120. package/dist/utils/index.js.map +1 -1
  121. package/package.json +14 -6
@@ -0,0 +1,361 @@
1
+ /**
2
+ * NodeAvVideoDecoder - Video decoder using node-av native bindings
3
+ *
4
+ * Implements the VideoDecoderBackend interface for decoding video streams
5
+ * using FFmpeg's libav* libraries via node-av.
6
+ */
7
+ import { EventEmitter } from 'events';
8
+ import { Decoder, FilterAPI, HardwareContext } from 'node-av/api';
9
+ import { FormatContext, Packet, Rational } from 'node-av/lib';
10
+ import { AVMEDIA_TYPE_VIDEO, AV_PKT_FLAG_KEY, AV_CODEC_ID_H264, AV_CODEC_ID_HEVC, AV_CODEC_ID_VP8, AV_CODEC_ID_VP9, AV_CODEC_ID_AV1, AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR0, AV_PIX_FMT_NV12, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB0, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA420P, } from 'node-av/constants';
11
+ import { DEFAULT_FRAMERATE } from '../backends/types.js';
12
+ import { parseCodecString } from '../hardware/index.js';
13
+ import { createLogger } from '../utils/logger.js';
14
+ import { selectBestFilterChain, getNextFilterChain, describePipeline } from './HardwarePipeline.js';
15
+ const logger = createLogger('NodeAvVideoDecoder');
16
+ /** Maximum filter chain fallback attempts */
17
+ const MAX_FILTER_CHAIN_ATTEMPTS = 10;
18
+ /** Known problematic hardware decoders */
19
+ const SKIP_HARDWARE_CODECS = ['vp9', 'av1'];
20
+ /**
21
+ * NodeAV-backed video decoder implementing VideoDecoderBackend interface
22
+ */
23
+ export class NodeAvVideoDecoder extends EventEmitter {
24
+ decoder = null;
25
+ hardware = null;
26
+ formatContext = null;
27
+ stream = null;
28
+ filter = null;
29
+ config = null;
30
+ queue = [];
31
+ processing = false;
32
+ processingPromise = null;
33
+ shuttingDown = false;
34
+ packetIndex = 0;
35
+ packetTimeBase = new Rational(1, DEFAULT_FRAMERATE);
36
+ outputPixelFormat = AV_PIX_FMT_YUV420P;
37
+ filterDescription = null;
38
+ hardwarePreference = 'no-preference';
39
+ get isHealthy() {
40
+ return !this.shuttingDown;
41
+ }
42
+ startDecoder(config) {
43
+ this.config = { ...config };
44
+ const framerate = config.framerate ?? DEFAULT_FRAMERATE;
45
+ this.packetTimeBase = new Rational(1, framerate);
46
+ this.outputPixelFormat = mapPixelFormat(config.outputPixelFormat ?? 'yuv420p');
47
+ this.hardwarePreference = config.hardwareAcceleration ?? 'no-preference';
48
+ }
49
+ write(data) {
50
+ if (!this.config || this.shuttingDown) {
51
+ return false;
52
+ }
53
+ this.queue.push(Buffer.from(data));
54
+ void this.processQueue();
55
+ return true;
56
+ }
57
+ end() {
58
+ if (this.shuttingDown)
59
+ return;
60
+ this.shuttingDown = true;
61
+ void this.finish().catch((err) => this.emit('error', err));
62
+ }
63
+ kill() {
64
+ this.shuttingDown = true;
65
+ this.cleanup();
66
+ this.emit('close', null);
67
+ }
68
+ async shutdown() {
69
+ this.end();
70
+ }
71
+ async processQueue() {
72
+ if (this.processingPromise) {
73
+ return this.processingPromise;
74
+ }
75
+ this.processingPromise = (async () => {
76
+ if (this.processing)
77
+ return;
78
+ this.processing = true;
79
+ try {
80
+ while (this.queue.length > 0) {
81
+ const data = this.queue.shift();
82
+ // Emit chunkAccepted when chunk starts processing (for dequeue event)
83
+ // Use setImmediate to ensure emit happens after write() returns
84
+ setImmediate(() => this.emit('chunkAccepted'));
85
+ await this.decodeBuffer(data);
86
+ }
87
+ }
88
+ catch (err) {
89
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
90
+ }
91
+ finally {
92
+ this.processing = false;
93
+ this.processingPromise = null;
94
+ }
95
+ })();
96
+ return this.processingPromise;
97
+ }
98
+ async ensureDecoder() {
99
+ if (this.decoder || !this.config) {
100
+ return;
101
+ }
102
+ const codecName = parseCodecString(this.config.codec) ?? this.config.codec ?? 'h264';
103
+ const codecId = mapCodecId(codecName);
104
+ if (!codecId) {
105
+ throw new Error(`Unsupported codec: ${this.config.codec}`);
106
+ }
107
+ this.formatContext = new FormatContext();
108
+ this.formatContext.allocContext();
109
+ this.stream = this.formatContext.newStream();
110
+ this.stream.timeBase = this.packetTimeBase;
111
+ const params = this.stream.codecpar;
112
+ params.codecType = AVMEDIA_TYPE_VIDEO;
113
+ params.codecId = codecId;
114
+ params.width = this.config.width;
115
+ params.height = this.config.height;
116
+ if (this.config.description) {
117
+ params.extradata = Buffer.from(this.config.description);
118
+ }
119
+ // Only try hardware if explicitly requested and not a known problematic codec
120
+ const shouldTryHardware = this.hardwarePreference === 'prefer-hardware' &&
121
+ !SKIP_HARDWARE_CODECS.includes(codecName);
122
+ if (shouldTryHardware) {
123
+ try {
124
+ this.hardware = HardwareContext.auto();
125
+ }
126
+ catch {
127
+ this.hardware = null;
128
+ }
129
+ }
130
+ this.decoder = await Decoder.create(this.stream, {
131
+ hardware: this.hardware ?? undefined,
132
+ exitOnError: true,
133
+ });
134
+ this.logDecoderSelection(codecName);
135
+ }
136
+ logDecoderSelection(codecName) {
137
+ const hwName = this.hardware?.deviceTypeName;
138
+ if (hwName && this.decoder?.isHardware()) {
139
+ logger.info(`Using hardware decoder (${hwName}) for ${codecName}`);
140
+ }
141
+ else if (hwName) {
142
+ logger.info(`Hardware context ${hwName} unavailable, decoding in software`);
143
+ }
144
+ else if (this.hardwarePreference === 'prefer-hardware') {
145
+ logger.info('Hardware requested but not available, decoding in software');
146
+ }
147
+ else {
148
+ logger.debug(`Using software decoder for ${codecName}`);
149
+ }
150
+ }
151
+ async decodeBuffer(buffer) {
152
+ await this.ensureDecoder();
153
+ if (!this.decoder || !this.stream) {
154
+ throw new Error('Decoder not initialized');
155
+ }
156
+ const packet = new Packet();
157
+ packet.alloc();
158
+ packet.streamIndex = this.stream.index;
159
+ packet.pts = BigInt(this.packetIndex);
160
+ packet.dts = BigInt(this.packetIndex);
161
+ packet.timeBase = this.packetTimeBase;
162
+ packet.data = buffer;
163
+ packet.duration = 1n;
164
+ if (this.packetIndex === 0) {
165
+ // Cast to any to handle strict type checking on flags
166
+ packet.flags |= AV_PKT_FLAG_KEY;
167
+ }
168
+ await this.decoder.decode(packet);
169
+ packet.unref();
170
+ await this.drainFrames();
171
+ this.packetIndex++;
172
+ }
173
+ async drainFrames() {
174
+ if (!this.decoder)
175
+ return;
176
+ let frame = await this.decoder.receive();
177
+ while (frame) {
178
+ if (frame === undefined) {
179
+ break;
180
+ }
181
+ const converted = await this.toOutputBuffer(frame);
182
+ frame.unref();
183
+ if (converted) {
184
+ this.emit('frame', converted);
185
+ }
186
+ frame = await this.decoder.receive();
187
+ }
188
+ }
189
+ async toOutputBuffer(frame) {
190
+ const outputFormatName = pixelFormatToFFmpegName(this.outputPixelFormat);
191
+ const isHardwareFrame = Boolean(frame.hwFramesCtx);
192
+ // If frame already matches requested format and is software, just export
193
+ if (!isHardwareFrame && frame.format === this.outputPixelFormat) {
194
+ return frame.toBuffer();
195
+ }
196
+ // Try to process with current or new filter chain
197
+ // If it fails, automatically try the next chain in the fallback sequence
198
+ let attempts = 0;
199
+ while (attempts < MAX_FILTER_CHAIN_ATTEMPTS) {
200
+ attempts++;
201
+ // Get filter chain (either current or select new one)
202
+ let description;
203
+ if (!this.filter || this.filterDescription === null) {
204
+ description = selectBestFilterChain(this.hardware, outputFormatName, isHardwareFrame);
205
+ }
206
+ else {
207
+ description = this.filterDescription;
208
+ }
209
+ // Create filter if needed
210
+ if (!this.filter || this.filterDescription !== description) {
211
+ this.filter?.close();
212
+ // Log the selected pipeline
213
+ const hwType = this.hardware?.deviceTypeName ?? 'software';
214
+ logger.debug(`Pipeline: ${describePipeline(description, hwType)}`);
215
+ try {
216
+ this.filter = FilterAPI.create(description, {
217
+ hardware: this.hardware ?? undefined,
218
+ });
219
+ this.filterDescription = description;
220
+ }
221
+ catch (err) {
222
+ // Filter creation failed, try next chain
223
+ logger.debug('Filter creation failed, trying next chain...');
224
+ this.filter = null;
225
+ this.filterDescription = null;
226
+ const nextChain = getNextFilterChain(this.hardware, outputFormatName, isHardwareFrame);
227
+ if (!nextChain) {
228
+ throw err; // No more chains to try
229
+ }
230
+ continue;
231
+ }
232
+ }
233
+ // Try to process the frame
234
+ try {
235
+ await this.filter.process(frame);
236
+ // Drain a single frame from the filter
237
+ let filtered = await this.filter.receive();
238
+ while (filtered === null) {
239
+ filtered = await this.filter.receive();
240
+ }
241
+ if (!filtered) {
242
+ return null;
243
+ }
244
+ const buffer = filtered.toBuffer();
245
+ filtered.unref();
246
+ return buffer;
247
+ }
248
+ catch (err) {
249
+ // Processing failed - close filter and try next chain
250
+ logger.debug(`Filter processing failed: ${err instanceof Error ? err.message : err}`);
251
+ this.filter?.close();
252
+ this.filter = null;
253
+ this.filterDescription = null;
254
+ const nextChain = getNextFilterChain(this.hardware, outputFormatName, isHardwareFrame);
255
+ if (!nextChain) {
256
+ throw err; // No more chains to try
257
+ }
258
+ // Loop will continue with next chain
259
+ }
260
+ }
261
+ throw new Error(`Failed to find working filter chain after ${MAX_FILTER_CHAIN_ATTEMPTS} attempts`);
262
+ }
263
+ async finish() {
264
+ await this.processQueue();
265
+ if (this.processingPromise) {
266
+ await this.processingPromise;
267
+ }
268
+ if (this.decoder) {
269
+ try {
270
+ await this.decoder.flush();
271
+ await this.drainFrames();
272
+ }
273
+ catch (err) {
274
+ this.emit('error', err instanceof Error ? err : new Error(String(err)));
275
+ }
276
+ }
277
+ this.emit('close', 0);
278
+ this.cleanup();
279
+ }
280
+ cleanup() {
281
+ this.filter?.close();
282
+ this.filter = null;
283
+ this.decoder?.close();
284
+ this.decoder = null;
285
+ this.hardware?.dispose();
286
+ this.hardware = null;
287
+ this.formatContext = null;
288
+ this.stream = null;
289
+ this.queue = [];
290
+ }
291
+ }
292
+ function mapCodecId(codec) {
293
+ switch (codec.toLowerCase()) {
294
+ case 'h264':
295
+ return AV_CODEC_ID_H264;
296
+ case 'hevc':
297
+ case 'h265':
298
+ return AV_CODEC_ID_HEVC;
299
+ case 'vp8':
300
+ return AV_CODEC_ID_VP8;
301
+ case 'vp9':
302
+ return AV_CODEC_ID_VP9;
303
+ case 'av1':
304
+ return AV_CODEC_ID_AV1;
305
+ default:
306
+ return null;
307
+ }
308
+ }
309
+ function mapPixelFormat(format) {
310
+ const fmt = format.toUpperCase();
311
+ switch (fmt) {
312
+ case 'I420':
313
+ case 'YUV420P':
314
+ return AV_PIX_FMT_YUV420P;
315
+ case 'I420A':
316
+ case 'YUVA420P':
317
+ return AV_PIX_FMT_YUVA420P;
318
+ case 'I422':
319
+ case 'YUV422P':
320
+ return AV_PIX_FMT_YUV422P;
321
+ case 'I444':
322
+ case 'YUV444P':
323
+ return AV_PIX_FMT_YUV444P;
324
+ case 'NV12':
325
+ return AV_PIX_FMT_NV12;
326
+ case 'BGRA':
327
+ return AV_PIX_FMT_BGRA;
328
+ case 'BGRX':
329
+ return AV_PIX_FMT_BGR0;
330
+ case 'RGBA':
331
+ return AV_PIX_FMT_RGBA;
332
+ case 'RGBX':
333
+ return AV_PIX_FMT_RGB0;
334
+ default:
335
+ return AV_PIX_FMT_YUV420P;
336
+ }
337
+ }
338
+ function pixelFormatToFFmpegName(fmt) {
339
+ switch (fmt) {
340
+ case AV_PIX_FMT_BGRA:
341
+ return 'bgra';
342
+ case AV_PIX_FMT_BGR0:
343
+ return 'bgr0';
344
+ case AV_PIX_FMT_RGBA:
345
+ return 'rgba';
346
+ case AV_PIX_FMT_RGB0:
347
+ return 'rgb0';
348
+ case AV_PIX_FMT_NV12:
349
+ return 'nv12';
350
+ case AV_PIX_FMT_YUV422P:
351
+ return 'yuv422p';
352
+ case AV_PIX_FMT_YUV444P:
353
+ return 'yuv444p';
354
+ case AV_PIX_FMT_YUVA420P:
355
+ return 'yuva420p';
356
+ case AV_PIX_FMT_YUV420P:
357
+ default:
358
+ return 'yuv420p';
359
+ }
360
+ }
361
+ //# sourceMappingURL=NodeAvVideoDecoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeAvVideoDecoder.js","sourceRoot":"","sources":["../../src/node-av/NodeAvVideoDecoder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAU,QAAQ,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,GAGpB,MA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eAAe;YAClB,OAAO,MAAM,CAAC;QAChB,KAAK,kBAAkB;YACrB,OAAO,SAAS,CAAC;QACnB,KAAK,kBAAkB;YACrB,OAAO,SAAS,CAAC;QACnB,KAAK,mBAAmB;YACtB,OAAO,UAAU,CAAC;QACpB,KAAK,kBAAkB,CAAC;QACxB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * NodeAvVideoEncoder - Video encoder using node-av native bindings
3
+ *
4
+ * Implements the VideoEncoderBackend interface for encoding video frames
5
+ * using FFmpeg's libav* libraries via node-av.
6
+ */
7
+ import { EventEmitter } from 'events';
8
+ import type { VideoEncoderBackend, VideoEncoderBackendConfig } from '../backends/types.js';
9
+ /**
10
+ * NodeAV-backed video encoder implementing VideoEncoderBackend interface
11
+ */
12
+ export declare class NodeAvVideoEncoder extends EventEmitter implements VideoEncoderBackend {
13
+ private encoder;
14
+ private hardware;
15
+ private config;
16
+ private frameIndex;
17
+ private queue;
18
+ private processing;
19
+ private processingPromise;
20
+ private shuttingDown;
21
+ private inputPixelFormat;
22
+ private encoderPixelFormat;
23
+ private timeBase;
24
+ get isHealthy(): boolean;
25
+ startEncoder(config: VideoEncoderBackendConfig): void;
26
+ write(data: Buffer | Uint8Array): boolean;
27
+ end(): void;
28
+ kill(): void;
29
+ shutdown(): Promise<void>;
30
+ private processQueue;
31
+ private ensureEncoder;
32
+ private configurePixelFormat;
33
+ private selectEncoderCodec;
34
+ private buildEncoderOptions;
35
+ private configureVpxOptions;
36
+ private configureSvtAv1Options;
37
+ private configureX26xOptions;
38
+ private encodeBuffer;
39
+ private createFrame;
40
+ private drainPackets;
41
+ private finish;
42
+ private cleanup;
43
+ }
44
+ //# sourceMappingURL=NodeAvVideoEncoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NodeAvVideoEncoder.d.ts","sourceRoot":"","sources":["../../src/node-av/NodeAvVideoEncoder.ts"],"names":[],"mappings":"AAA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