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

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

问题描述

我希望完全使用 Javascript 制作视频编码器.这个想法是,用户将能够指定现有视频(足够简单)或一系列图像,然后能够将其编码为 H.264 以进行发布.

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.

我知道目前不支持编码内容,但我想知道这是否完全可以在 Javascript(或 Flash 桥接器)中实现?

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?

谢谢.

推荐答案

可以使用 emscripten 将视频编码器编译为 javascript.例如,这里是谷歌的 VP9 libvpx 库的 emscripten 编译版本:

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

不幸的是,它非常慢 - 大约是本机库速度的十分之一.我相信这是因为有大量内存访问正在进行,而这在 emscripten 中非常慢(参见 https://bugzilla.mozilla.org/show_bug.cgi?id=771106).此外,编码通常依赖于 GPU 或 SIMD 并行性,而目前在 javascript 中不可用.

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.

我认为目前在 javascript 中视频编码是不可行的.最好的解决方案是让 W3C 将视频编码/解码 API 添加到 HTML5,也许作为 WebRTC/getUserMedia 的一部分.

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/

这篇关于javascript 中的 H.264 视频编码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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