简体   繁体   English

编码来自webCam h264的流

[英]encode stream from webCam h264

I'm building a P2P video application in browser with javascript, but i'm new to this.I thought of webRTC but its available video encoding is VP8 which eats all the proccessor of tablets and phones.I want to get the video from webCam and encode it with h264 because tablets and smartphones support it natively.How can I encode the video after get it from getUserMedia. 我正在使用javascript在浏览器中构建P2P视频应用程序,但我对此并不陌生。我想到了webRTC,但它可用的视频编码是VP8,它吞噬了平板电脑和手机的所有处理器。我想从webCam中获取视频并使用h264对其进行编码,因为平板电脑和智能手机本身就支持它。从getUserMedia获取视频后,如何对视频进行编码。

Thanks! 谢谢!

As WebRTC is built in the browser, and it's the browser internals that creates the tunnel and encodes the stream in VP8, you don't have access to the raw stream to encode it using other Codec neither to the raw connection to send the packets after your custom encoding. 由于WebRTC内置在浏览器中,并且浏览器内部会创建隧道并在VP8中对流进行编码,因此您无权使用其他Codec来对原始流进行编码,也无法访问原始连接以在发送完数据包之后您的自定义编码。

To allow WebRTC to use H264, the browsers need to have support for it (native or plugin-based), and actually Chrome and Firefox don't support it. 为了允许WebRTC使用H264,浏览器需要对其进行支持(本机或基于插件),而实际上Chrome和Firefox不支持它。 H264 vs VP8 in WebRTC is a subject with a lot of discussion, because of the availability of hardware encoders for H264 and not for VP8, but on the other hand the existence of royalties that need to be paid to use H264. WebRTC中的H264与VP8是一个需要大量讨论的主题,因为H264而非VP8都有可用的硬件编码器,但是另一方面,使用H264需要支付使用费。

If you want to control the codec and the stream, namely on smartphones and tablets, you can build apps using the WebRTC native API's . 如果要控制编解码器和流,即在智能手机和平板电脑上,则可以使用WebRTC本机API构建应用程序。

Doubango seem to be providing a Java Script based API for H264 codec. Doubango似乎正在为H264编解码器提供基于Java脚本的API。 I have not used it . 我没有用过。 You can have a look at it. 您可以看一下。

http://doubango.org/index.html http://doubango.org/index.html

http://code.google.com/p/webrtc4all/ http://code.google.com/p/webrtc4all/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM