node-av 6.2.0-beta.3 → 6.2.0-beta.31
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 +13 -8
- package/dist/api/audio-frame-buffer.d.ts +438 -7
- package/dist/api/audio-frame-buffer.js +792 -52
- package/dist/api/audio-frame-buffer.js.map +1 -1
- package/dist/api/bitstream-filter.d.ts +82 -4
- package/dist/api/bitstream-filter.js +197 -100
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +5 -0
- package/dist/api/decoder.js +13 -6
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/demuxer.d.ts +29 -4
- package/dist/api/demuxer.js +209 -60
- package/dist/api/demuxer.js.map +1 -1
- package/dist/api/encoder-pool.d.ts +43 -1
- package/dist/api/encoder-pool.js +121 -9
- package/dist/api/encoder-pool.js.map +1 -1
- package/dist/api/encoder.d.ts +58 -2
- package/dist/api/encoder.js +173 -57
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter.js +15 -6
- package/dist/api/filter.js.map +1 -1
- package/dist/api/fmp4-stream.d.ts +327 -8
- package/dist/api/fmp4-stream.js +663 -123
- package/dist/api/fmp4-stream.js.map +1 -1
- package/dist/api/hardware.d.ts +2 -0
- package/dist/api/hardware.js +25 -4
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/io-stream.d.ts +3 -2
- package/dist/api/io-stream.js +77 -5
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/muxer.d.ts +289 -7
- package/dist/api/muxer.js +696 -109
- package/dist/api/muxer.js.map +1 -1
- package/dist/api/pipeline.d.ts +24 -0
- package/dist/api/pipeline.js +76 -5
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/rtp-stream.d.ts +77 -8
- package/dist/api/rtp-stream.js +316 -88
- package/dist/api/rtp-stream.js.map +1 -1
- package/dist/api/scaler.d.ts +124 -21
- package/dist/api/scaler.js +347 -114
- package/dist/api/scaler.js.map +1 -1
- package/dist/api/utilities/async-queue.d.ts +3 -0
- package/dist/api/utilities/async-queue.js +8 -0
- package/dist/api/utilities/async-queue.js.map +1 -1
- 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/webrtc-stream.d.ts +2 -0
- package/dist/api/webrtc-stream.js +46 -12
- package/dist/api/webrtc-stream.js.map +1 -1
- package/dist/api/whisper.d.ts +2 -0
- package/dist/api/whisper.js +63 -23
- package/dist/api/whisper.js.map +1 -1
- package/dist/constants/constants.d.ts +1 -0
- package/dist/constants/constants.js +1 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/constants/filter-options.d.ts +2 -0
- package/dist/ffmpeg/install.js +104 -26
- package/dist/ffmpeg/install.js.map +1 -1
- package/dist/ffmpeg/utils.js +7 -4
- package/dist/ffmpeg/utils.js.map +1 -1
- package/dist/lib/binding.d.ts +10 -1
- package/dist/lib/binding.js +25 -16
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/bitstream-filter-context.d.ts +2 -0
- package/dist/lib/bitstream-filter-context.js +2 -0
- package/dist/lib/bitstream-filter-context.js.map +1 -1
- package/dist/lib/codec-context.d.ts +0 -2
- package/dist/lib/codec-context.js +4 -22
- package/dist/lib/codec-context.js.map +1 -1
- package/dist/lib/filter-context.d.ts +3 -1
- package/dist/lib/filter-context.js +5 -11
- package/dist/lib/filter-context.js.map +1 -1
- package/dist/lib/filter-graph-segment.d.ts +3 -2
- package/dist/lib/filter-graph-segment.js +3 -2
- package/dist/lib/filter-graph-segment.js.map +1 -1
- package/dist/lib/filter-graph.d.ts +4 -4
- package/dist/lib/filter-graph.js +4 -4
- package/dist/lib/filter-inout.d.ts +4 -0
- package/dist/lib/filter-inout.js +4 -0
- package/dist/lib/filter-inout.js.map +1 -1
- package/dist/lib/format-context.d.ts +72 -7
- package/dist/lib/format-context.js +80 -22
- package/dist/lib/format-context.js.map +1 -1
- package/dist/lib/frame.d.ts +17 -13
- package/dist/lib/frame.js +24 -23
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/hardware-frames-context.d.ts +0 -1
- package/dist/lib/hardware-frames-context.js +2 -8
- package/dist/lib/hardware-frames-context.js.map +1 -1
- package/dist/lib/io-context.d.ts +4 -2
- package/dist/lib/io-context.js +4 -2
- package/dist/lib/io-context.js.map +1 -1
- package/dist/lib/native-types.d.ts +7 -5
- package/dist/lib/option.d.ts +26 -0
- package/dist/lib/option.js +42 -18
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/packet.d.ts +5 -0
- package/dist/lib/packet.js +5 -0
- package/dist/lib/packet.js.map +1 -1
- package/dist/lib/stream.d.ts +8 -4
- package/dist/lib/stream.js +22 -24
- package/dist/lib/stream.js.map +1 -1
- package/install/check.js +40 -79
- package/package.json +45 -34
- package/build_mac_local.sh +0 -69
package/dist/lib/stream.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CodecParameters } from './codec-parameters.js';
|
|
2
2
|
import { CodecParser } from './codec-parser.js';
|
|
3
3
|
import { Dictionary } from './dictionary.js';
|
|
4
|
+
import { Packet } from './packet.js';
|
|
4
5
|
import { Rational } from './rational.js';
|
|
5
6
|
import type { AVDiscard, AVDisposition, AVStreamEventFlag } from '../constants/constants.js';
|
|
6
7
|
import type { NativeStream, NativeWrapper } from './native-types.js';
|
|
7
|
-
import type { Packet } from './packet.js';
|
|
8
8
|
/**
|
|
9
9
|
* Media stream within a format context.
|
|
10
10
|
*
|
|
@@ -13,6 +13,10 @@ import type { Packet } from './packet.js';
|
|
|
13
13
|
* metadata, and disposition flags. Each stream in a file has a unique index and may
|
|
14
14
|
* contain packets of compressed data.
|
|
15
15
|
*
|
|
16
|
+
* A stream belongs to its format context. Once that context is closed or freed, the
|
|
17
|
+
* stream and its codecpar read their defaults (e.g. index -1) and ignore writes;
|
|
18
|
+
* copy what must outlive the context first.
|
|
19
|
+
*
|
|
16
20
|
* Direct mapping to FFmpeg's AVStream.
|
|
17
21
|
*
|
|
18
22
|
* @example
|
|
@@ -48,9 +52,7 @@ import type { Packet } from './packet.js';
|
|
|
48
52
|
*/
|
|
49
53
|
export declare class Stream implements NativeWrapper<NativeStream> {
|
|
50
54
|
private native;
|
|
51
|
-
private _metadata?;
|
|
52
55
|
private _codecpar?;
|
|
53
|
-
private _parser?;
|
|
54
56
|
/**
|
|
55
57
|
* @param native - The native stream instance
|
|
56
58
|
*
|
|
@@ -81,6 +83,7 @@ export declare class Stream implements NativeWrapper<NativeStream> {
|
|
|
81
83
|
*
|
|
82
84
|
* Contains essential codec configuration for this stream.
|
|
83
85
|
* Used to initialize decoders and describe stream properties.
|
|
86
|
+
* Reads defaults once the format context is closed or freed.
|
|
84
87
|
*
|
|
85
88
|
* Direct mapping to AVStream->codecpar.
|
|
86
89
|
*/
|
|
@@ -192,7 +195,8 @@ export declare class Stream implements NativeWrapper<NativeStream> {
|
|
|
192
195
|
* Dictionary containing stream-specific metadata
|
|
193
196
|
* (e.g., language, title, encoder settings).
|
|
194
197
|
*
|
|
195
|
-
*
|
|
198
|
+
* Returns a copy of AVStream->metadata - mutating the returned Dictionary
|
|
199
|
+
* does not affect the stream. Assign it back to apply changes.
|
|
196
200
|
*/
|
|
197
201
|
get metadata(): Dictionary | null;
|
|
198
202
|
set metadata(value: Dictionary | null);
|
package/dist/lib/stream.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CodecParameters } from './codec-parameters.js';
|
|
2
2
|
import { CodecParser } from './codec-parser.js';
|
|
3
3
|
import { Dictionary } from './dictionary.js';
|
|
4
|
+
import { Packet } from './packet.js';
|
|
4
5
|
import { Rational } from './rational.js';
|
|
5
6
|
/**
|
|
6
7
|
* Media stream within a format context.
|
|
@@ -10,6 +11,10 @@ import { Rational } from './rational.js';
|
|
|
10
11
|
* metadata, and disposition flags. Each stream in a file has a unique index and may
|
|
11
12
|
* contain packets of compressed data.
|
|
12
13
|
*
|
|
14
|
+
* A stream belongs to its format context. Once that context is closed or freed, the
|
|
15
|
+
* stream and its codecpar read their defaults (e.g. index -1) and ignore writes;
|
|
16
|
+
* copy what must outlive the context first.
|
|
17
|
+
*
|
|
13
18
|
* Direct mapping to FFmpeg's AVStream.
|
|
14
19
|
*
|
|
15
20
|
* @example
|
|
@@ -45,9 +50,7 @@ import { Rational } from './rational.js';
|
|
|
45
50
|
*/
|
|
46
51
|
export class Stream {
|
|
47
52
|
native;
|
|
48
|
-
_metadata; // Cache for metadata wrapper
|
|
49
53
|
_codecpar; // Cache the wrapped codecpar
|
|
50
|
-
_parser; // Cache the wrapped parser
|
|
51
54
|
/**
|
|
52
55
|
* @param native - The native stream instance
|
|
53
56
|
*
|
|
@@ -86,6 +89,7 @@ export class Stream {
|
|
|
86
89
|
*
|
|
87
90
|
* Contains essential codec configuration for this stream.
|
|
88
91
|
* Used to initialize decoders and describe stream properties.
|
|
92
|
+
* Reads defaults once the format context is closed or freed.
|
|
89
93
|
*
|
|
90
94
|
* Direct mapping to AVStream->codecpar.
|
|
91
95
|
*/
|
|
@@ -265,28 +269,20 @@ export class Stream {
|
|
|
265
269
|
* Dictionary containing stream-specific metadata
|
|
266
270
|
* (e.g., language, title, encoder settings).
|
|
267
271
|
*
|
|
268
|
-
*
|
|
272
|
+
* Returns a copy of AVStream->metadata - mutating the returned Dictionary
|
|
273
|
+
* does not affect the stream. Assign it back to apply changes.
|
|
269
274
|
*/
|
|
270
275
|
get metadata() {
|
|
271
276
|
const native = this.native.metadata;
|
|
272
277
|
if (!native) {
|
|
273
|
-
// Clear cache if native is null
|
|
274
|
-
this._metadata = undefined;
|
|
275
278
|
return null;
|
|
276
279
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
// Create and cache new wrapper
|
|
282
|
-
const device = Object.create(Dictionary.prototype);
|
|
283
|
-
device.native = native;
|
|
284
|
-
this._metadata = device;
|
|
285
|
-
return device;
|
|
280
|
+
const dict = Object.create(Dictionary.prototype);
|
|
281
|
+
dict.native = native;
|
|
282
|
+
return dict;
|
|
286
283
|
}
|
|
287
284
|
set metadata(value) {
|
|
288
285
|
this.native.metadata = value?.getNative() ?? null;
|
|
289
|
-
this._metadata = undefined;
|
|
290
286
|
}
|
|
291
287
|
/**
|
|
292
288
|
* Attached picture.
|
|
@@ -297,7 +293,15 @@ export class Stream {
|
|
|
297
293
|
* Direct mapping to AVStream->attached_pic.
|
|
298
294
|
*/
|
|
299
295
|
get attachedPic() {
|
|
300
|
-
|
|
296
|
+
const native = this.native.attachedPic;
|
|
297
|
+
if (!native) {
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
// The native getter refs the picture data into a new packet - the returned
|
|
301
|
+
// wrapper owns that ref (freed on GC, or free() to release earlier)
|
|
302
|
+
const packet = Object.create(Packet.prototype);
|
|
303
|
+
packet.native = native;
|
|
304
|
+
return packet;
|
|
301
305
|
}
|
|
302
306
|
/**
|
|
303
307
|
* Event flags.
|
|
@@ -336,20 +340,14 @@ export class Stream {
|
|
|
336
340
|
* @see {@link CodecParser} For parser details
|
|
337
341
|
*/
|
|
338
342
|
get parser() {
|
|
343
|
+
// Not cached: the native getter returns a fresh object per access, so an
|
|
344
|
+
// identity-based cache can never hit
|
|
339
345
|
const native = this.native.parser;
|
|
340
346
|
if (!native) {
|
|
341
|
-
// Clear cache if native is null
|
|
342
|
-
this._parser = undefined;
|
|
343
347
|
return null;
|
|
344
348
|
}
|
|
345
|
-
// Return cached wrapper if available and still valid
|
|
346
|
-
if (this._parser && this._parser.native === native) {
|
|
347
|
-
return this._parser;
|
|
348
|
-
}
|
|
349
|
-
// Create and cache new wrapper
|
|
350
349
|
const parser = Object.create(CodecParser.prototype);
|
|
351
350
|
parser.native = native;
|
|
352
|
-
this._parser = parser;
|
|
353
351
|
return parser;
|
|
354
352
|
}
|
|
355
353
|
/**
|
package/dist/lib/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/lib/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/lib/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,OAAO,MAAM;IACT,MAAM,CAAe;IACrB,SAAS,CAAmB,CAAC,6BAA6B;IAElE;;;;OAIG;IACH,YAAY,MAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAC3B,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,EAAE,CAAC,KAAa;QAClB,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC;IACzB,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,QAAQ;QACV,+CAA+C;QAC/C,IAAI,IAAI,CAAC,SAA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CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;gBAC9C,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
|
package/install/check.js
CHANGED
|
@@ -4,8 +4,7 @@ import { existsSync } from 'node:fs';
|
|
|
4
4
|
import { createRequire } from 'node:module';
|
|
5
5
|
import { join } from 'node:path';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { log, spawnRebuild, useGlobalFFmpeg } from './ffmpeg.js';
|
|
7
|
+
import { log } from './ffmpeg.js';
|
|
9
8
|
|
|
10
9
|
const require = createRequire(import.meta.url);
|
|
11
10
|
|
|
@@ -15,22 +14,21 @@ const tryLoadPrebuilt = () => {
|
|
|
15
14
|
const arch = process.arch;
|
|
16
15
|
|
|
17
16
|
if (platform === 'win32') {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
17
|
+
// MinGW builds are discontinued, Windows ships MSVC only
|
|
18
|
+
// const useMingW = type() !== 'Windows_NT';
|
|
19
|
+
// if (useMingW) {
|
|
20
|
+
// try {
|
|
21
|
+
// const packageName = `@seydx/node-av-${platform}-${arch}-mingw`;
|
|
22
|
+
// const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
23
|
+
// if (existsSync(packageJsonPath)) {
|
|
24
|
+
// log(`Using prebuilt binary from ${packageName}`);
|
|
25
|
+
// return true;
|
|
26
|
+
// }
|
|
27
|
+
// } catch {
|
|
28
|
+
// // Package not installed
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
32
31
|
|
|
33
|
-
// Fallback to MSVC
|
|
34
32
|
try {
|
|
35
33
|
const packageName = `@seydx/node-av-${platform}-${arch}-msvc`;
|
|
36
34
|
// Check if the package is installed (don't check for .node file yet - it may be extracted by postinstall)
|
|
@@ -67,87 +65,50 @@ const tryLoadPrebuilt = () => {
|
|
|
67
65
|
return false;
|
|
68
66
|
};
|
|
69
67
|
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// Check for required build dependencies
|
|
74
|
-
const missingDeps = [];
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
require('node-addon-api');
|
|
78
|
-
} catch {
|
|
79
|
-
missingDeps.push('node-addon-api');
|
|
68
|
+
const isMuslLibc = () => {
|
|
69
|
+
if (process.platform !== 'linux') {
|
|
70
|
+
return false;
|
|
80
71
|
}
|
|
81
72
|
|
|
82
73
|
try {
|
|
83
|
-
|
|
74
|
+
const report = process.report?.getReport?.();
|
|
75
|
+
return !report?.header?.glibcVersionRuntime;
|
|
84
76
|
} catch {
|
|
85
|
-
|
|
77
|
+
return false;
|
|
86
78
|
}
|
|
79
|
+
};
|
|
87
80
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
log('Please install:');
|
|
92
|
-
log(` npm install --save-dev ${missingDeps.join(' ')}`);
|
|
93
|
-
log('');
|
|
94
|
-
log('Then run npm install again.');
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
81
|
+
const noPrebuiltError = () => {
|
|
82
|
+
log('');
|
|
83
|
+
log(`No prebuilt binary available for ${process.platform}-${process.arch}.`);
|
|
97
84
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (status !== 0) {
|
|
102
|
-
log('');
|
|
103
|
-
log('Build failed. Please ensure you have:');
|
|
104
|
-
log(' - FFmpeg 7.1+ libraries and headers installed');
|
|
105
|
-
log(' - Python 3.12+ installed');
|
|
106
|
-
log(' - A C++ compiler with C++17 support');
|
|
107
|
-
log('');
|
|
108
|
-
log('See https://github.com/seydx/node-av for detailed requirements');
|
|
109
|
-
process.exit(status);
|
|
85
|
+
if (isMuslLibc()) {
|
|
86
|
+
log('Note: You appear to be on a musl-based system (e.g. Alpine Linux).');
|
|
87
|
+
log('Prebuilt binaries are only provided for glibc-based Linux distributions.');
|
|
110
88
|
}
|
|
111
89
|
|
|
112
|
-
log('
|
|
90
|
+
log('The published npm package does not contain the native sources,');
|
|
91
|
+
log('so it cannot be built from source inside node_modules.');
|
|
92
|
+
log('To build from source, clone the repository and follow the build instructions:');
|
|
93
|
+
log(' https://github.com/seydx/node-av');
|
|
94
|
+
process.exit(1);
|
|
113
95
|
};
|
|
114
96
|
|
|
115
97
|
(async () => {
|
|
116
98
|
try {
|
|
117
99
|
const shouldBuildFromSource = process.env.npm_config_build_from_source === 'true';
|
|
118
100
|
|
|
119
|
-
// Priority 1: User explicitly wants to build from source
|
|
120
101
|
if (shouldBuildFromSource) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
log('Please install FFmpeg 7.1+ with development headers');
|
|
124
|
-
process.exit(1);
|
|
125
|
-
}
|
|
126
|
-
// Fall through to build logic below
|
|
127
|
-
} else {
|
|
128
|
-
// Priority 2: Try to use prebuilt binary if not forcing source build
|
|
129
|
-
if (tryLoadPrebuilt()) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
102
|
+
log('--build-from-source was specified, but the published npm package cannot be built from source.');
|
|
103
|
+
noPrebuiltError();
|
|
132
104
|
}
|
|
133
105
|
|
|
134
|
-
//
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
if (shouldBuildFromSource) {
|
|
138
|
-
log('Building from source as requested');
|
|
139
|
-
} else {
|
|
140
|
-
log('No prebuilt binary available for your platform');
|
|
141
|
-
log('System FFmpeg detected, building from source automatically');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
buildFromSource();
|
|
145
|
-
} else {
|
|
146
|
-
// No FFmpeg found and no prebuilt available
|
|
147
|
-
log('⚠️ No prebuilt binary and no system FFmpeg found');
|
|
148
|
-
log('See https://github.com/seydx/node-av for installation instructions');
|
|
149
|
-
process.exit(1);
|
|
106
|
+
// Try to use prebuilt binary
|
|
107
|
+
if (tryLoadPrebuilt()) {
|
|
108
|
+
return;
|
|
150
109
|
}
|
|
110
|
+
|
|
111
|
+
noPrebuiltError();
|
|
151
112
|
} catch (err) {
|
|
152
113
|
console.error(`node-av: Installation error: ${err.message}`);
|
|
153
114
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-av",
|
|
3
|
-
"version": "6.2.0-beta.
|
|
3
|
+
"version": "6.2.0-beta.31",
|
|
4
4
|
"description": "FFmpeg bindings for Node.js",
|
|
5
5
|
"author": "seydx (https://github.com/seydx/node-av)",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=22.18.0"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"install",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE.md"
|
|
15
|
+
],
|
|
7
16
|
"main": "./dist/index.js",
|
|
8
17
|
"types": "./dist/index.d.ts",
|
|
9
18
|
"exports": {
|
|
@@ -67,6 +76,7 @@
|
|
|
67
76
|
"install-updates": "npm i --save",
|
|
68
77
|
"lint": "eslint .",
|
|
69
78
|
"lint:fix": "eslint --fix .",
|
|
79
|
+
"lint:gyp": "node scripts/check-gyp-sync.js",
|
|
70
80
|
"patch:ffmpeg": "node scripts/patch-ffmpeg.js",
|
|
71
81
|
"postinstall": "node dist/ffmpeg/install.js",
|
|
72
82
|
"predocs": "typedoc && cpy README.md docs/ --rename=index.md",
|
|
@@ -84,57 +94,58 @@
|
|
|
84
94
|
"unzipper": "^0.12.5"
|
|
85
95
|
},
|
|
86
96
|
"optionalDependencies": {
|
|
87
|
-
"
|
|
88
|
-
"@seydx/node-av-darwin-
|
|
89
|
-
"@seydx/node-av-
|
|
90
|
-
"@seydx/node-av-linux-
|
|
91
|
-
"@seydx/node-av-
|
|
92
|
-
"@seydx/node-av-win32-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
97
|
+
"@seydx/node-av-darwin-arm64": "6.2.0-beta.31",
|
|
98
|
+
"@seydx/node-av-darwin-x64": "6.2.0-beta.31",
|
|
99
|
+
"@seydx/node-av-linux-arm64": "6.2.0-beta.31",
|
|
100
|
+
"@seydx/node-av-linux-x64": "6.2.0-beta.31",
|
|
101
|
+
"@seydx/node-av-win32-arm64-msvc": "6.2.0-beta.31",
|
|
102
|
+
"@seydx/node-av-win32-x64-msvc": "6.2.0-beta.31"
|
|
103
|
+
},
|
|
104
|
+
"peerDependencies": {
|
|
105
|
+
"werift": "^0.24.3 || ^0.25.0"
|
|
106
|
+
},
|
|
107
|
+
"peerDependenciesMeta": {
|
|
108
|
+
"werift": {
|
|
109
|
+
"optional": true
|
|
110
|
+
}
|
|
96
111
|
},
|
|
97
112
|
"devDependencies": {
|
|
98
113
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
99
|
-
"@types/node": "^26.
|
|
114
|
+
"@types/node": "^26.6.5",
|
|
100
115
|
"@types/node-abi": "^3.0.3",
|
|
101
|
-
"@types/semver": "^7.
|
|
116
|
+
"@types/semver": "^7.8.0",
|
|
102
117
|
"@types/unzipper": "^0.10.11",
|
|
103
|
-
"@types/ws": "^8.18.
|
|
104
|
-
"@typescript-eslint/parser": "^8.
|
|
105
|
-
"concurrently": "^10.0.
|
|
118
|
+
"@types/ws": "^8.18.2",
|
|
119
|
+
"@typescript-eslint/parser": "^8.71.2",
|
|
120
|
+
"concurrently": "^10.0.6",
|
|
106
121
|
"cpy-cli": "^7.0.0",
|
|
107
122
|
"cross-env": "^10.1.0",
|
|
108
123
|
"eslint": "9.39.2",
|
|
109
|
-
"eslint-plugin-jsdoc": "^
|
|
110
|
-
"globals": "^17.
|
|
111
|
-
"node-addon-api": "^8.9.
|
|
112
|
-
"node-gyp": "^13.0
|
|
113
|
-
"prettier": "^3.9.
|
|
124
|
+
"eslint-plugin-jsdoc": "^65.3.11",
|
|
125
|
+
"globals": "^17.13.0",
|
|
126
|
+
"node-addon-api": "^8.9.2",
|
|
127
|
+
"node-gyp": "^13.1.0",
|
|
128
|
+
"prettier": "^3.9.10",
|
|
114
129
|
"rimraf": "^6.1.3",
|
|
115
|
-
"sharp": "^0.35.
|
|
116
|
-
"tsx": "^4.23.
|
|
130
|
+
"sharp": "^0.35.5",
|
|
131
|
+
"tsx": "^4.23.15",
|
|
117
132
|
"typedoc": "^0.28.20",
|
|
118
|
-
"typedoc-plugin-markdown": "^4.
|
|
119
|
-
"typedoc-vitepress-theme": "^1.1.
|
|
133
|
+
"typedoc-plugin-markdown": "^4.14.0",
|
|
134
|
+
"typedoc-vitepress-theme": "^1.1.4",
|
|
120
135
|
"typescript": "5.9.3",
|
|
121
|
-
"typescript-eslint": "^8.
|
|
122
|
-
"updates": "^
|
|
123
|
-
"vitepress": "^2.0.0-alpha.
|
|
124
|
-
"werift": "^0.
|
|
125
|
-
"ws": "^8.
|
|
136
|
+
"typescript-eslint": "^8.71.2",
|
|
137
|
+
"updates": "^19.2.1",
|
|
138
|
+
"vitepress": "^2.0.0-alpha.20",
|
|
139
|
+
"werift": "^0.25.1",
|
|
140
|
+
"ws": "^8.22.0"
|
|
126
141
|
},
|
|
127
142
|
"overrides": {
|
|
128
143
|
"werift": {
|
|
129
|
-
"@shinyoshiaki/binary-data": "npm:@seydx/binary-data@0.6.2"
|
|
130
|
-
"ip": "npm:neoip@2.1.0"
|
|
144
|
+
"@shinyoshiaki/binary-data": "npm:@seydx/binary-data@0.6.2"
|
|
131
145
|
},
|
|
132
146
|
"werift-dtls": {
|
|
133
147
|
"@shinyoshiaki/binary-data": "npm:@seydx/binary-data@0.6.2"
|
|
134
148
|
},
|
|
135
|
-
"werift-ice": {
|
|
136
|
-
"ip": "npm:neoip@2.1.0"
|
|
137
|
-
},
|
|
138
149
|
"werift-sctp": {
|
|
139
150
|
"@shinyoshiaki/binary-data": "npm:@seydx/binary-data@0.6.2"
|
|
140
151
|
}
|
package/build_mac_local.sh
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
-
BUILDER_DIR="$SCRIPT_DIR/externals/jellyfin-ffmpeg/builder"
|
|
6
|
-
BUILD_DIR="$BUILDER_DIR/build"
|
|
7
|
-
|
|
8
|
-
echo ""
|
|
9
|
-
echo "=== FFmpeg Local Build ==="
|
|
10
|
-
echo ""
|
|
11
|
-
echo " 1) Full build (clean + dependencies + FFmpeg)"
|
|
12
|
-
echo " 2) FFmpeg only (skip dependency builds)"
|
|
13
|
-
echo ""
|
|
14
|
-
read -rp "Choose [1/2]: " choice
|
|
15
|
-
|
|
16
|
-
case "$choice" in
|
|
17
|
-
1)
|
|
18
|
-
echo ""
|
|
19
|
-
echo "=> Full build selected. Cleaning build + prefix directories..."
|
|
20
|
-
rm -rf "$BUILD_DIR"
|
|
21
|
-
sudo rm -rf /opt/ffbuild/prefix
|
|
22
|
-
SKIP_BUILD=""
|
|
23
|
-
;;
|
|
24
|
-
2)
|
|
25
|
-
echo ""
|
|
26
|
-
echo "=> FFmpeg-only build selected. Skipping dependencies..."
|
|
27
|
-
SKIP_BUILD="--skip-build"
|
|
28
|
-
;;
|
|
29
|
-
*)
|
|
30
|
-
echo "Invalid choice."
|
|
31
|
-
exit 1
|
|
32
|
-
;;
|
|
33
|
-
esac
|
|
34
|
-
|
|
35
|
-
# Ensure submodules are initialized
|
|
36
|
-
if [ ! -f "$SCRIPT_DIR/externals/jellyfin-ffmpeg/configure" ]; then
|
|
37
|
-
echo "=> Initializing git submodules..."
|
|
38
|
-
git -C "$SCRIPT_DIR" submodule update --init --recursive
|
|
39
|
-
fi
|
|
40
|
-
|
|
41
|
-
# Log everything to terminal and file
|
|
42
|
-
LOG_FILE="$SCRIPT_DIR/ffmpeg_build.log"
|
|
43
|
-
exec > >(tee "$LOG_FILE") 2>&1
|
|
44
|
-
|
|
45
|
-
# Ensure /opt/ffbuild exists with correct permissions
|
|
46
|
-
sudo mkdir -p /opt/ffbuild/prefix
|
|
47
|
-
sudo chown -R "$(whoami):staff" /opt/ffbuild
|
|
48
|
-
sudo chmod -R 755 /opt/ffbuild
|
|
49
|
-
|
|
50
|
-
cd "$SCRIPT_DIR"
|
|
51
|
-
|
|
52
|
-
# Apply FFmpeg patches (skips if already applied)
|
|
53
|
-
node scripts/patch-ffmpeg.js
|
|
54
|
-
|
|
55
|
-
cd "$BUILDER_DIR"
|
|
56
|
-
|
|
57
|
-
# Run Jellyfin build script
|
|
58
|
-
./buildmac.sh arm64 $SKIP_BUILD
|
|
59
|
-
|
|
60
|
-
# The build script uses /ffbuild/prefix but we need /opt/ffbuild/prefix
|
|
61
|
-
cd ..
|
|
62
|
-
make install DESTDIR="" prefix="/opt/ffbuild/prefix"
|
|
63
|
-
|
|
64
|
-
# Fix permissions after install
|
|
65
|
-
sudo chown -R "$(whoami):staff" /opt/ffbuild
|
|
66
|
-
|
|
67
|
-
cd "$SCRIPT_DIR"
|
|
68
|
-
|
|
69
|
-
# npm run build:native
|