ffmpegwasm / ffmpegwasm/ffmpeg.wasm
Support for Node.js v18
- Langage dominant
- C
- Étoiles
- 17.8k
- Forks
- 1.1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
## Describe the bug
Initialization of `ffmpeg.wasm` seems to fail on Node.js v18.
> **Note**
> * [Node.js v18 recently became the "Active LTS" version](https://nodejs.org/en/blog/release/v18.12.0/)
> * [Changing the End-of-Life Date for Node.js 16 to September 11th, 2023](https://nodejs.org/ar/blog/announcements/nodejs16-eol/)
## To Reproduce
1. Prepare a Node.js v18 runtime environment
```console
$ node -v
v18.12.0
```
2. Create a package and install `ffmpeg.wasm`
```console
$ npm init -y
$ npm i @ffmpeg/ffmpeg @ffmpeg/core
```
3. Prepare `index.mjs` (ESM) or `index.js` (CJS) as follows
ESM
```js
import { createFFmpeg } from '@ffmpeg/ffmpeg';
const ffmpeg = createFFmpeg();
await ffmpeg.load();
```
CJS
```js
const { createFFmpeg } = require('@ffmpeg/ffmpeg');
const ffmpeg = createFFmpeg();
(async () => {
await ffmpeg.load();
})();
```
4. Start execution
```console
$ node --experimental-wasm-threads index.(m)js
```
## Expected behavior
No errors should occur.
## Screenshots
ESM
```console
$ node --experimental-wasm-threads index.mjs
/path/to/pkg-dir/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:12
...
TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11118:11) {
cause: Error: unknown scheme
at makeNetworkError (node:internal/deps/undici/undici:9273:35)
at schemeFetch (node:internal/deps/undici/undici:10610:18)
at node:internal/deps/undici/undici:10483:26
at mainFetch (node:internal/deps/undici/undici:10500:11)
at fetching (node:internal/deps/undici/undici:10457:7)
at Agent.fetch2 (node:internal/deps/undici/undici:10337:20)
at Object.fetch (node:internal/deps/undici/undici:11116:28)
at fetch (node:internal/process/pre_execution:216:25)
at /path/to/pkg-dir/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:215:32
at /path/to/pkg-dir/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:215:254 {
[cause]: undefined
}
}
Node.js v18.12.0
```
CJS
```console
$ node --experimental-wasm-threads index.js
(node:12484) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
/path/to/pkg-dir/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:12
...
RuntimeError: abort(TypeError: fetch failed). Build with -s ASSERTIONS=1 for more info.
at process.u (/path/to/pkg-dir/node_modules/@ffmpeg/core/dist/ffmpeg-core.js:25:109)
at process.emit (node:events:513:28)
at emit (node:internal/process/promises:149:20)
at processPromiseRejections (node:internal/process/promises:283:27)
at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
Node.js v18.12.0
```
## Desktop (please complete the following information):
- OS: Windows 10/11
- Node.js: v18.12.0
## Additional context
On Node.js v16, no error occurs with both ESM and CJS.
-----
@jeromewu Thank you for your great work.
Not related to the Node.js version mentioned above, but estimating from the Lavf version, the FFmpeg version is probably around v4.3, which seems a little old (the latest FFmpeg is already v5.1).
Do you have any plans to support these upgrades?
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.