linux - 如何将 gif 转换为 webm 并保留 alpha channel ?

标签 linux gif alpha phaser-framework webm

首先,我从 Google 图片中获得了这张 gif,它具有透明的 Alpha channel 。

这是原始 gif(在新选项卡中打开它以查看透明度):

enter image description here

这是在我的屏幕上播放的录音,以防它无法在浏览器中正确显示:

enter image description here

然后我运行以下脚本将其转换为 webm,这是我正在使用的游戏框架所需要的。

avconv -f gif img.gif img.webm

但是它并不能保持透明度。这是一个适当透明的 webm 的覆盖层(水,取自 https://phaser.io/examples/v2/video/alpha-webm )

enter image description here

白色方框不应出现在 gem 周围。

最佳答案

首先将gif转换为png帧:

convert img.gif img%03d.png

然后使用此命令将它们组合成一个 webm(我必须获得外部帮助):

ffmpeg -framerate 25 -f image2 -i ./img%03d.png -c:v libvpx -pix_fmt yuva420p img.webm

enter image description here

关于linux - 如何将 gif 转换为 webm 并保留 alpha channel ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43214818/

相关文章:

Android 并为(图像) View alpha 设置 alpha

html - 为什么半透明背景会在不同的 div 中发光

linux - 安装媒体信息

linux - 谷歌浏览器 Linux 的永久标志

linux - 如何在 Linux 服务器上正确创建集中式 Git 存储库?为什么我在学习本教程后会出现此错误?

html - Imgur gifv 文件未使用视频标签按预期加载

linux - 如何在我的 bash 脚本中显示正在分析的文件的名称?

go - 如何在 gif.Encode() 中使用 golang palette.WebSafe?

image - 有没有办法使用 ffmpeg 将 GIF 的所有帧保存到 PNG 中?

file - 如何将32位BMP转换为包含Alpha channel ?