Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) RuntimeError: memory access out of bounds when trying to convert to Opus with -c:a libopus #591

Open
CrypticSignal opened this issue Sep 24, 2023 · 11 comments · May be fixed by #824

Comments

@CrypticSignal
Copy link
Contributor

CrypticSignal commented Sep 24, 2023

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
@Sean-Der
Copy link

@CrypticSignal Did you try to bisect this yet? Do you know if it worked with old versions?

@Sean-Der
Copy link

If not I am going to do that now

@CrypticSignal
Copy link
Contributor Author

@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).

@doubledare704
Copy link

On v0.12.4 is the same problem

@AX9999AX
Copy link

AX9999AX commented Apr 7, 2024

@CrypticSignal, @doubledare704:
You can try to use this:
ffmpeg.exec(['-i','input.mp3','-strict','-2','-c:a','opus','output.ogg',])

@AX9999AX
Copy link

AX9999AX commented Apr 7, 2024

@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.

@teropa
Copy link

teropa commented Apr 10, 2024

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.

@nsitu
Copy link

nsitu commented May 7, 2024

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.

@teropa
Copy link

teropa commented May 7, 2024

@nsitu this was in build/ffmpeg-wasm.sh in the CONF_FLAGS variable

Screenshot 2024-05-07 at 18 02 15

@nsitu
Copy link

nsitu commented May 7, 2024

Thanks @teropa , I will give this a try.

@dabarrell
Copy link

@teropa – I'm struggling to get the build working locally. If that flag fixes the issue, would you be able to submit a PR?

Funzinator pushed a commit to Funzinator/ffmpeg.wasm that referenced this issue Jan 17, 2025
Funzinator pushed a commit to Funzinator/ffmpeg.wasm that referenced this issue Jan 17, 2025
@Funzinator Funzinator linked a pull request Jan 17, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants