ffmpeg.wasm
ffmpeg.wasm copied to clipboard
`Uncaught (in promise) RuntimeError: memory access out of bounds` when trying to convert to Opus with `-c:a libopus`
Describe the bug:
I get a Uncaught (in promise) RuntimeError: memory access out of bounds
when trying to transcode to Opus with -c:a libopus
. I don't get this error if I choose to transcode to another format such as MP3, so I doubt there's anything wrong with the code.
To Reproduce:
Go to https://av-converter.vercel.app, it's a web app I made which is essentially a frontend for ffmpeg.wasm
. Open the console and use the dropdown menu on my web app to select Opus as the output format. You will see the aforementioned error in the console.
Expected behavior: The file should start transcoding like it does when choosing another format to convert to.
Additional Information:
- OS: Windows 11 Pro
- Browser: Chrome version 117.0.5938.92 (Official Build) (64-bit)
- @ffmpeg/core v0.12.3
- @ffmpeg/ffmpeg v0.12.6
- @ffmpeg/util v0.12.1
@CrypticSignal Did you try to bisect this yet? Do you know if it worked with old versions?
If not I am going to do that now
@Sean-Der Unfortunately I don't have any pointers e.g. at which core version this issue started. I presume this hasn't been an issue in all versions of ffmpeg.wasm, because someone probably would have mentioned this by now.
Keep me updated on your findings (if any).
On v0.12.4 is the same problem
@CrypticSignal, @doubledare704:
You can try to use this:
ffmpeg.exec(['-i','input.mp3','-strict','-2','-c:a','opus','output.ogg',])
@CrypticSignal Did you try to bisect this yet? Do you know if it worked with old versions?
This doesn't work for versions 12 and above. As for versions 11 and below, I haven't tested it yet.
FWIW rebuilding the current main with -sSTACK_OVERFLOW_CHECK=2
passed to emcc
revealed a more informative error message than the memory out of bounds:
Aborted(stack overflow (Attempt to set SP to 0x002d8320, with stack limits [0x002d91e0 - 0x002e91e0]). If you require more stack space build with -sSTACK_SIZE=<bytes>)
And adding -sSTACK_SIZE=5MB
fixed the issue for me.
And adding
-sSTACK_SIZE=5MB
fixed the issue for me.
@teropa could you clarify where you added this exactly? I'm trying out the build process for the first time and would like to explore this.
@nsitu this was in build/ffmpeg-wasm.sh
in the CONF_FLAGS
variable
Thanks @teropa , I will give this a try.