How can I export CSS animation as animated PNG, gif, or WEBP *with transparency*?

别等时光非礼了梦想. 提交于 2019-12-01 22:48:58

I used OBS to capture a video of my browser as mp4.

Then I used ffmpeg like this to replace the green chroma key color with transparency and save as an animated gif file:

ffmpeg -t 9 -i screenCapture.mp4 -filter_complex "[0:v]colorkey=0x2dd103:0.3:0.5,format=yuva420p,crop=500:500:6:427,split[v0][v1];[v0]palettegen[p];[v1][p]paletteuse,setpts=0.1*PTS" -r 100 final.gif

Note that I think -t 9 and setpts=0.1*PTS and -r 100 should combine in a way that affects whether an animation is captured precisely from start to end, but I haven't mastered it.

So the remaining problems are to make sure that the gif loops seamlessly (which I think will be possible by removing superfluous frames via RealWorld Paint) and to make sure that the animation speed is appropriate in PowerPoint 2013.

(I'd still prefer to accept a cleaner, more convenient answer, as this approach is time-consuming and error-prone.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!