H.264视频编码器在javascript [英] H.264 video encoder in javascript
问题描述
我明白编码内容现在不受支持,但我想知道这是否可能完全在Javascript(或Flash Bridge)中吗? p>
谢谢。
可以使用emscripten将视频编码器编译成javascript。例如,这是一个emscripten编译的google的VP9 libvpx库:
https://bitbucket.org/desmaj/libvpx.js/overview
不幸的是,这是非常慢的 - 在本地图书馆的速度的十分之一。我相信这是因为内存访问量很大,这在emscripten中是非常慢的(参见 https://bugzilla.mozilla.org/show_bug.cgi?id=771106 )。另外,编码通常依赖于GPU或SIMD并行性,目前在javascript中并不可用。
我认为视频编码目前在javascript中是不可行的。最好的解决方案是W3C向HTML5添加视频编码/解码API,也许是WebRTC / getUserMedia的一部分。
另外,看到这篇博客文章描述了情况:
https://brendaneich.com/2013/05/today-i-saw-the-future/
I am looking to make a video encoder entirely in Javascript. The idea is that the user will be able to specify an existing video (easy enough) or a range of images and then be able to encode it to H.264 for publishing.
I understand that encoding content is not supported right now but I was wondering if this is something that is possible entirely in Javascript (or a Flash bridge) or not?
Thanks.
It is possible to compile a video encoder to javascript using emscripten. For example, here is an emscripten-compiled version of google's VP9 libvpx library:
https://bitbucket.org/desmaj/libvpx.js/overview
Unfortunately it is incredibly slow - on the order of one tenth of the speed of the native library. I believe this is due to the fact that there is a lot of memory access going on, and that is incredibly slow in emscripten (see https://bugzilla.mozilla.org/show_bug.cgi?id=771106). Also, encoding generally relies on GPU or SIMD parallelism, which isn't currently available in javascript.
I think video encoding is just not feasible in javascript at present. The best solution would be for W3C to add a video encoding/decoding API to HTML5, perhaps as part of WebRTC/getUserMedia.
Also, see this blog post which describes the situation:
https://brendaneich.com/2013/05/today-i-saw-the-future/
这篇关于H.264视频编码器在javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!