FFmpeg-wasm/FFmpeg.wasm

FFmpeg core importing troubles

Closed this issue · 1 comments

Describe the bug
FFmpeg core is having troubles being imported?

To Reproduce
Steps to reproduce the behavior:

import { FFmpeg } from "@ffmpeg.wasm/main";
import core from "@ffmpeg.wasm/core-mt";
() => {
    const ffmpeg = await FFmpeg.create({ core: core });
    ffmpeg.fs.writeFile("audio.mp4", buffer);
    await ffmpeg.run("-i", "audio.mp4", "audio.mp3");
    buffer = Buffer.from(ffmpeg.fs.readFile("test.mp4"));
}

When running this code, this error comes:

[debug]  FFmpeg core constructor detected, use it directly
TypeError: Cannot destructure property 'configurable' of 'Object.getOwnPropertyDescriptor(...)' as it is undefined.

Expected behavior
FFmpeg.create() to use core

Desktop:

  • OS: Windows Server 2022 Standard Evaluation
  • Browser: Chromium (Google Chrome)
  • Version:
    • "@ffmpeg.wasm/core-mt": "^0.13.2"
    • "@ffmpeg.wasm/main": "^0.13.1"

Additional context
This error was coming when I imported core like this (like the documentation):

const ffmpeg = await FFmpeg.create({ core: "@ffmpeg.wasm/core-mt" });
[debug]  Import '@ffmpeg.wasm/core-mt' with cjs require()
TypeError: Cannot destructure property 'configurable' of 'Object.getOwnPropertyDescriptor(...)' as it is undefined.

I tried to use require to import "@ffmpeg.wasm/core-mt" but require isn't defined.
could my package.json { "type": "module" } be causing the problem?

I notice in both versions of the error, the error was the same:

TypeError: Cannot destructure property 'configurable' of 'Object.getOwnPropertyDescriptor(...)' as it is undefined.

I'm A STUPID DUMB AHH

import { FFmpeg } from "@ffmpeg.wasm/main";
import core from "@ffmpeg.wasm/core-mt";
() => {
    const ffmpeg = await FFmpeg.create({ core: core });
    ffmpeg.fs.writeFile("audio.mp4", buffer);
    await ffmpeg.run("-i", "audio.mp4", "audio.mp3");
    buffer = Buffer.from(ffmpeg.fs.readFile("test.mp4")); /* "test.mp4" doesn't exist 💀
    I should have wrote audio.mp3
    This is where the "same" error was coming from */
}