H.264视频编码器在javascript [英] H.264 video encoder in javascript

查看:184
本文介绍了H.264视频编码器在javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个完全在Javascript中的视频编码器。这个想法是,用户将能够指定现有的视频(足够容易)或一系列图像,然后能够将其编码为H.264进行发布。



我明白编码内容现在不受支持,但我想知道这是否可能完全在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆