ffmpegwasm / ffmpegwasm/ffmpeg.wasm

Why can't ffmpeg.wasm work well on Chrome? Please answer.

Open
#754 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
17.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
I want to use ffmpeg.wasm in my project. It may need to run in browsers such as chrome, firefox, safari, etc. However, a problem was discovered during the integration process: the demo I wrote can run well in firefox. It runs, but there is no way to run it in chrome. It will stop running after the video information appears (it may also be other unexpected situations). I don't know how to solve it. I hope the author can help me look at it and give me some suggestion

**To Reproduce**
```

import {FFmpeg} from "@ffmpeg/ffmpeg";
import {fetchFile, toBlobURL} from "@ffmpeg/util";
import {ref} from "vue";

const videoFile = ref('')
const videoSrc = ref('')

const ffmpeg = new FFmpeg()
const init_ffmpeg = async () => {
ffmpeg.on('log', e => {
console.log(e.message)
})
ffmpeg.on('progress', e => {
console.log(e.progress)
})
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.4/dist/esm'
if (ffmpeg.loaded) {
return
}
await ffmpeg.load({
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application.wasm'),
workerURL: await toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, 'text/javascript')
})
console.log('ffmpeg 加载完成')
}

const handleFileUpload = (event) => {
videoFile.value = event.target.files[0];
}

const convert = async () => {
console.log('enter convert')
await init_ffmpeg()
await ffmpeg.writeFile("123456.mp4", await fetchFile(videoFile.value))
console.log(videoFile.value.name)
try {
const target_name = "123456.mov"
const res = await ffmpeg.exec([
'-i', "123456.mp4",
target_name
])
console.log('result:', res)
const snatshot = await ffmpeg.readFile(target_name)
videoSrc.value = URL.createObjectURL(new Blob([snatshot.buffer], {type: 'video/quicktime'}))
await ffmpeg.deleteFile("123456.mp4")
await ffmpeg.deleteFile(target_name)

} catch (e) {
console.log(e)
}
}

```

**Expected behavior**
I hope that I can convert mp4 files to mov files normally on the chrome browser without stopping working directly.

**Screenshots**
![图片](https://github.com/ffmpegwasm/ffmpeg.wasm/assets/140386566/c9dbf1a1-4206-4551-b227-03987084277c)

**Desktop (please complete the following information):**
- OS: Windows10
- Browser: Chrome
- Version: 125.0.06422.61

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.