我想将 HTML5 画布中的动画转换为可以上传到 YouTube 的视频文件.是否有任何类型的屏幕捕获 API 或可以让我以编程方式执行此操作的东西?
I'd like to convert an animation in HTML5 canvas to a video file that could be uploaded to YouTube. Is there any sort of screen capture API or something that could allow me to do this programatically?
有一个 whammy 库声称可以使用 JavaScript 从静止图像中生成 webm 视频:
http://antimatter15.com/wp/2012/08/whammy-a-real-time-javascript-webm-encoder/
There exist the whammy library which claims to produce webm videos from stills using JavaScript:
http://antimatter15.com/wp/2012/08/whammy-a-real-time-javascript-webm-encoder/
请注意,存在一些限制(正如预期的那样).这个编码器基于 webp 图像格式,目前只在 Chrome 中支持(也许新的 Opera 也是,但我没有检查).这意味着您不能在其他浏览器中进行编码,除非您首先找到一种方法来编码您想要用作 webp 图像的图像(请参阅 此链接 了解可能的解决方案.
Note that there are limitations (as to be expected). This encoder bases itself on the webp image format which is currently only supported in Chrome (perhaps the new Opera too but I haven't checked). This means you can't encode in other browsers unless you find a way to encode the image you want to use as a webp image first (see this link for possible solution for that).
除此之外,无法使用 JavaScript 从图像创建视频文件,也无法使用原生浏览器 API 从画布创建视频文件.
Beyond that there is no way to create a video file from images using JavaScript and canvas using native browser APIs.
这篇关于将 HTML5 画布序列转换为视频文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!