Skip to content

switch from ST to MT #911

@drzraf

Description

@drzraf

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

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions