node-av 6.2.0-beta.2 → 6.2.0-beta.21

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 (93) hide show
  1. package/README.md +13 -8
  2. package/dist/api/audio-frame-buffer.d.ts +73 -1
  3. package/dist/api/audio-frame-buffer.js +127 -1
  4. package/dist/api/audio-frame-buffer.js.map +1 -1
  5. package/dist/api/bitstream-filter.d.ts +82 -4
  6. package/dist/api/bitstream-filter.js +197 -100
  7. package/dist/api/bitstream-filter.js.map +1 -1
  8. package/dist/api/decoder.d.ts +5 -0
  9. package/dist/api/decoder.js +13 -6
  10. package/dist/api/decoder.js.map +1 -1
  11. package/dist/api/demuxer.d.ts +15 -1
  12. package/dist/api/demuxer.js +165 -54
  13. package/dist/api/demuxer.js.map +1 -1
  14. package/dist/api/encoder-pool.d.ts +43 -1
  15. package/dist/api/encoder-pool.js +121 -9
  16. package/dist/api/encoder-pool.js.map +1 -1
  17. package/dist/api/encoder.d.ts +19 -0
  18. package/dist/api/encoder.js +112 -45
  19. package/dist/api/encoder.js.map +1 -1
  20. package/dist/api/filter.js +15 -6
  21. package/dist/api/filter.js.map +1 -1
  22. package/dist/api/fmp4-stream.d.ts +167 -3
  23. package/dist/api/fmp4-stream.js +423 -90
  24. package/dist/api/fmp4-stream.js.map +1 -1
  25. package/dist/api/hardware.d.ts +2 -0
  26. package/dist/api/hardware.js +25 -4
  27. package/dist/api/hardware.js.map +1 -1
  28. package/dist/api/io-stream.d.ts +3 -2
  29. package/dist/api/io-stream.js +61 -5
  30. package/dist/api/io-stream.js.map +1 -1
  31. package/dist/api/muxer.d.ts +14 -0
  32. package/dist/api/muxer.js +131 -51
  33. package/dist/api/muxer.js.map +1 -1
  34. package/dist/api/pipeline.d.ts +24 -0
  35. package/dist/api/pipeline.js +76 -5
  36. package/dist/api/pipeline.js.map +1 -1
  37. package/dist/api/rtp-stream.d.ts +56 -6
  38. package/dist/api/rtp-stream.js +252 -80
  39. package/dist/api/rtp-stream.js.map +1 -1
  40. package/dist/api/scaler.d.ts +105 -17
  41. package/dist/api/scaler.js +326 -108
  42. package/dist/api/scaler.js.map +1 -1
  43. package/dist/api/utilities/async-queue.d.ts +3 -0
  44. package/dist/api/utilities/async-queue.js +8 -0
  45. package/dist/api/utilities/async-queue.js.map +1 -1
  46. package/dist/api/webrtc-stream.d.ts +2 -0
  47. package/dist/api/webrtc-stream.js +46 -12
  48. package/dist/api/webrtc-stream.js.map +1 -1
  49. package/dist/api/whisper.d.ts +2 -0
  50. package/dist/api/whisper.js +63 -23
  51. package/dist/api/whisper.js.map +1 -1
  52. package/dist/constants/constants.d.ts +1 -0
  53. package/dist/constants/constants.js +1 -0
  54. package/dist/constants/constants.js.map +1 -1
  55. package/dist/constants/filter-options.d.ts +2 -0
  56. package/dist/ffmpeg/install.js +115 -29
  57. package/dist/ffmpeg/install.js.map +1 -1
  58. package/dist/ffmpeg/utils.js +7 -4
  59. package/dist/ffmpeg/utils.js.map +1 -1
  60. package/dist/lib/binding.d.ts +1 -0
  61. package/dist/lib/binding.js +12 -16
  62. package/dist/lib/binding.js.map +1 -1
  63. package/dist/lib/codec-context.d.ts +0 -2
  64. package/dist/lib/codec-context.js +4 -22
  65. package/dist/lib/codec-context.js.map +1 -1
  66. package/dist/lib/filter-context.d.ts +0 -1
  67. package/dist/lib/filter-context.js +2 -11
  68. package/dist/lib/filter-context.js.map +1 -1
  69. package/dist/lib/format-context.d.ts +63 -7
  70. package/dist/lib/format-context.js +70 -21
  71. package/dist/lib/format-context.js.map +1 -1
  72. package/dist/lib/frame.d.ts +11 -11
  73. package/dist/lib/frame.js +13 -20
  74. package/dist/lib/frame.js.map +1 -1
  75. package/dist/lib/hardware-frames-context.d.ts +0 -1
  76. package/dist/lib/hardware-frames-context.js +2 -8
  77. package/dist/lib/hardware-frames-context.js.map +1 -1
  78. package/dist/lib/io-context.d.ts +4 -2
  79. package/dist/lib/io-context.js +4 -2
  80. package/dist/lib/io-context.js.map +1 -1
  81. package/dist/lib/native-types.d.ts +4 -4
  82. package/dist/lib/option.d.ts +26 -0
  83. package/dist/lib/option.js +42 -18
  84. package/dist/lib/option.js.map +1 -1
  85. package/dist/lib/packet.d.ts +5 -0
  86. package/dist/lib/packet.js +5 -0
  87. package/dist/lib/packet.js.map +1 -1
  88. package/dist/lib/stream.d.ts +3 -4
  89. package/dist/lib/stream.js +17 -24
  90. package/dist/lib/stream.js.map +1 -1
  91. package/install/check.js +40 -79
  92. package/package.json +43 -32
  93. package/build_mac_local.sh +0 -69
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 { type } from 'node:os';
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
- const useMingW = type() !== 'Windows_NT';
19
- if (useMingW) {
20
- try {
21
- const packageName = `@seydx/node-av-${platform}-${arch}-mingw`;
22
- // Check if the package is installed (don't check for .node file yet - it may be extracted by postinstall)
23
- const packageJsonPath = require.resolve(`${packageName}/package.json`);
24
- if (existsSync(packageJsonPath)) {
25
- log(`Using prebuilt binary from ${packageName}`);
26
- return true;
27
- }
28
- } catch {
29
- // Package not installed
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 buildFromSource = () => {
71
- log('Building from source...');
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
- require('node-gyp');
74
+ const report = process.report?.getReport?.();
75
+ return !report?.header?.glibcVersionRuntime;
84
76
  } catch {
85
- missingDeps.push('node-gyp');
77
+ return false;
86
78
  }
79
+ };
87
80
 
88
- if (missingDeps.length > 0) {
89
- log('');
90
- log(`Missing build dependencies: ${missingDeps.join(', ')}`);
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
- log('Building native bindings...');
99
-
100
- const status = spawnRebuild();
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('Build completed successfully!');
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
- if (!useGlobalFFmpeg()) {
122
- log('--build-from-source specified but no FFmpeg libraries found');
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
- // Build from source (either requested or as fallback)
135
- if (useGlobalFFmpeg()) {
136
- // Determine why we're building
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.2",
3
+ "version": "6.2.0-beta.21",
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
- "werift": "^0.23.0",
88
- "@seydx/node-av-darwin-arm64": "^6.2.0-beta.2",
89
- "@seydx/node-av-darwin-x64": "^6.2.0-beta.2",
90
- "@seydx/node-av-linux-arm64": "^6.2.0-beta.2",
91
- "@seydx/node-av-linux-x64": "^6.2.0-beta.2",
92
- "@seydx/node-av-win32-arm64-mingw": "^6.2.0-beta.2",
93
- "@seydx/node-av-win32-arm64-msvc": "^6.2.0-beta.2",
94
- "@seydx/node-av-win32-x64-mingw": "^6.2.0-beta.2",
95
- "@seydx/node-av-win32-x64-msvc": "^6.2.0-beta.2"
97
+ "@seydx/node-av-darwin-arm64": "6.2.0-beta.21",
98
+ "@seydx/node-av-darwin-x64": "6.2.0-beta.21",
99
+ "@seydx/node-av-linux-arm64": "6.2.0-beta.21",
100
+ "@seydx/node-av-linux-x64": "6.2.0-beta.21",
101
+ "@seydx/node-av-win32-arm64-msvc": "6.2.0-beta.21",
102
+ "@seydx/node-av-win32-x64-msvc": "6.2.0-beta.21"
103
+ },
104
+ "peerDependencies": {
105
+ "werift": "^0.24.3"
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.1.0",
114
+ "@types/node": "^26.4.0",
100
115
  "@types/node-abi": "^3.0.3",
101
- "@types/semver": "^7.7.1",
116
+ "@types/semver": "^7.8.0",
102
117
  "@types/unzipper": "^0.10.11",
103
118
  "@types/ws": "^8.18.1",
104
- "@typescript-eslint/parser": "^8.62.1",
105
- "concurrently": "^10.0.3",
119
+ "@typescript-eslint/parser": "^8.68.0",
120
+ "concurrently": "^10.0.5",
106
121
  "cpy-cli": "^7.0.0",
107
122
  "cross-env": "^10.1.0",
108
123
  "eslint": "9.39.2",
109
- "eslint-plugin-jsdoc": "^63.0.12",
110
- "globals": "^17.7.0",
111
- "node-addon-api": "^8.9.0",
112
- "node-gyp": "^13.0.1",
113
- "prettier": "^3.9.4",
124
+ "eslint-plugin-jsdoc": "^64.2.1",
125
+ "globals": "^17.11.0",
126
+ "node-addon-api": "^8.9.2",
127
+ "node-gyp": "^13.0.2",
128
+ "prettier": "^3.9.6",
114
129
  "rimraf": "^6.1.3",
115
- "sharp": "^0.35.3",
116
- "tsx": "^4.23.0",
130
+ "sharp": "^0.35.4",
131
+ "tsx": "^4.23.12",
117
132
  "typedoc": "^0.28.20",
118
- "typedoc-plugin-markdown": "^4.12.0",
133
+ "typedoc-plugin-markdown": "^4.13.0",
119
134
  "typedoc-vitepress-theme": "^1.1.3",
120
135
  "typescript": "5.9.3",
121
- "typescript-eslint": "^8.62.1",
122
- "updates": "^17.18.2",
123
- "vitepress": "^2.0.0-alpha.17",
124
- "werift": "^0.23.0",
125
- "ws": "^8.21.0"
136
+ "typescript-eslint": "^8.68.0",
137
+ "updates": "^18.0.7",
138
+ "vitepress": "^2.0.0-alpha.19",
139
+ "werift": "^0.24.4",
140
+ "ws": "^8.21.3"
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
  }
@@ -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