ffmpegwasm / ffmpegwasm/ffmpeg.wasm

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

Aperta
#754 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C
Stelle
17.8k
Fork
1.1k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.