gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:07:45 26 4
gpt4 key购买 nike

首先,我有这张从 Google Images 获得的 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 转换为保留 alpha channel 的 webm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43214818/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com