ffmpegwasm / ffmpegwasm/ffmpeg.wasm
Unable to convert gif to video format (mp4/webm etc.)
- 主要语言
- C
- 星标
- 17.8k
- 派生
- 1.1k
- PR 合并指标
- 30 天内没有已合并 PR
描述
I've been trying for a while to convert gifs to video formats, but the output is always a blank video player (nothing plays).
This is my code:
```
if (!ffmpeg.isLoaded()) {
await ffmpeg.load();
}
ffmpeg.FS('writeFile', name, await fetchFile(originalImage)); //originalImage is the uploaded gif
await ffmpeg.run('-i', name, '-movflags', 'faststart', '-pix_fmt', 'yuv420p', '-vf', 'scale=trunc(iw/2)*2:trunc(ih/2)*2', 'output.mp4');
const data = ffmpeg.FS('readFile', 'output.mp4');
const file = new File(data, 'output.mp4');
```
Once I upload the file and insert it into a video player, the player is blank and nothing happens. I even tried to download and play it on my machine, but it says some codecs are missing and the file cannot be played. I assume this is due to some other underlying issue.
**Expected behavior**
Be able to convert gif to video format successfully.
**Desktop (please complete the following information):**
- OS: Ubuntu 20.04.3 LTS
- Browser: Chrome
- Version 94.0.4606.61
贡献指南
评估
这个 Issue 还没有评估数据。