如何将视频从我的 WebRTC 直接流式传输到 Facebook RTMP 服务器? [英] How to stream video from my WebRTC to Facebook RTMP server directly?

查看:73
本文介绍了如何将视频从我的 WebRTC 直接流式传输到 Facebook RTMP 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 WebRTC 开发一个网络应用程序,我正在通过 WebRTC 从我的网络摄像头获取视频,我想使用我的浏览器在 Facebook 和 YouTube 上进行直播我已经搜索了 python 和 node js 库,但我没有找不到任何图书馆.我想构建一个像 streamyard.com 这样的应用程序.我看过ffmpeg

I'm trying to develop a web application with WebRTC and I'm getting video from my webcam through WebRTC and I want to do live streaming on Facebook and YouTube with my browser I have searched python and node js libraries but I haven't find any library for that. I want to build an application like streamyard.com. I have watched ffmpeg

推荐答案

您可以使用 Pion WebRTC 和 ffmpeg 来做到这一点!

You can do this using Pion WebRTC and ffmpeg!

我在此处创建了一个演示.如果你安装了 ffmpeg 和 Go 编译器,这应该就可以工作了!

I have created a demo here. If you have ffmpeg installed and the Go compiler this should just work!

这从浏览器中获取音频/视频,然后在内存中构建一个 webm.然后它通过标准输入管道将此 WebM 传递给 ffmpeg,然后将其转码并发送到 Twitch!

This takes audio/video from the browser, and then constructs a webm in memory. It then passes this WebM to ffmpeg via a stdin pipe, which then is transcode and sent to Twitch!

我们可以在此处进行很多优化(例如直接从浏览器获取 H264),但并非所有地方都支持 H264,因此这只是使示例更易于推理.

There are a lot of optimizations we could make here (like taking H264 from the browser directly) but H264 isn't supported everywhere, so this just makes the sample easier to reason with.

这篇关于如何将视频从我的 WebRTC 直接流式传输到 Facebook RTMP 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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