2017-04-04 95 views
0

首先,我從Google Images獲得這個具有透明alpha通道的gif。如何將gif轉換爲保存alpha通道的webm?

原來這裏是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

白框不應該被周圍出現的寶石。

回答

1

首先轉換成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

相關問題