ffmpegwasm / ffmpegwasm/ffmpeg.wasm

switch from ST to MT

Open
#911 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
17.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
When reloading from ST to MT, I can't reuse the (detached) ArrayBuffer which has been assigned as input data in the ST instance of FFmpeg

**To Reproduce**
```js
async function makeConfig(mt) {
return ({
coreURL: await window.ffmpegUtil.toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
wasmURL: await window.ffmpegUtil.toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm'),
workerURL = mt ? await window.ffmpegUtil.toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, 'text/javascript') : null
});
}

new FFmpeg();
await ffmpeg.load(await makeConfig(false));
await ffmpeg.writeFile("foo", new Uint8Array(data));
await ffmpeg.exec(['-i', "foo"]);

await ffmpeg.load(await makeConfig(true));
await ffmpeg.writeFile("foo", new Uint8Array(data)); // <-- TypeError: Cannot perform Construct on a detached ArrayBuffer
await ffmpeg.exec(['-i', "foo"]);
```

**Expected behavior**
I should be able to switch from ST to MT and reuse the data.

**Desktop (please complete the following information):**
- OS: Ubuntu
- Browser: Firefox 141 / Chromium 142

**Additional context**
After using `ffprobe` I know which codec the video is using. Only then can I choose whether MT is suitable. (For some codecs, like HEVC, it fails and thus must be avoided, but for all others it gives significant performances boost and is desirable)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.