ffmpegwasm / ffmpegwasm/ffmpeg.wasm
Why can't ffmpeg.wasm work well on Chrome? Please answer.
- 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**

**Desktop (please complete the following information):**
- OS: Windows10
- Browser: Chrome
- Version: 125.0.06422.61
Contributor guide
Assessment
This issue has not been assessed yet.