ffmpegwasm / ffmpegwasm/ffmpeg.wasm
Crashes with pthread error: f.asm is undefined
- Dominant language
- C
- Stars
- 17.8k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I am using ffmpeg-wasm to transcode multiple mp2 files to mp3 in the browser. Sometimes, it works flawlessly on multiple files, but then logs an error to the console and the ffmpeg.run promise doesn't even resolve nor reject
```
fferr pthread sent an error! blob:http://localhost:3000/2b82eddd-2ff1-4fd6-8c5c-4b9def392732:219: TypeError: f.asm is undefined
```
**To Reproduce**
I cannot successfully reproduce this, so I'll describe my setup:
* I am using svelte-kit for my website
* I am using `async-mutex` to stop concurrent transcoding, the plan is to transcode one after another
* my code was inspired by the `transcode.html` example in this repo
* I only create a single instance
* I only call load if `isLoaded` returns false
```ts
const { createFFmpeg, fetchFile } = window.FFmpeg
if (!ffmpeg) {
ffmpeg = createFFmpeg({
corePath: "/ffmpeg/ffmpeg-core.js"
})
}
ffmpeg.setLogger(({ type, message }) => {
//...
})
ffmpeg.setProgress(({ ratio }) => {
//...
})
if (!ffmpeg.isLoaded()) {
await ffmpeg.load()
}
ffmpeg.FS("writeFile", file.name, await fetchFile(file))
const mp3 = replaceSuffix(file.name, "mp3")
// sometimes this crashes but doesn't reject, so it never returns
await ffmpeg.run('-i', file.name, "-vn", "-acodec", "libmp3lame", "-b:a", "320k", mp3)
const outfile = ffmpeg.FS('readFile', mp3)
ffmpeg.FS("unlink", mp3)
```
**Expected behavior**
should not crash, and if it crashes, it should at least reject the promise
**Screenshots**
here is a screenshot of my console, I hope that this can help

**Desktop:**
System:
OS: Linux 5.10 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
Memory: 15.14 GB / 31.22 GB
Container: Yes
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.2.0 - ~/.nvm/versions/node/v16.2.0/bin/node
Yarn: 1.22.11 - /usr/bin/yarn
npm: 7.13.0 - ~/.nvm/versions/node/v16.2.0/bin/npm
Browsers:
Chromium: 92.0.4515.107
Firefox: 90.0.2
Contributor guide
Assessment
This issue has not been assessed yet.