简体   繁体   English

实时视频

[英]Real time video

There is a lot of information scattered over the internet, but it is hard to find something concrete互联网上散布着很多信息,但很难找到具体的信息

The question is what is the best modern way to create a live, low latency solution for video streaming问题是为视频流创建实时、低延迟解决方案的最佳现代方式是什么

What solutions are being used for products like Wyze cams, Ring video doorbells, etc. Wyze 摄像头、Ring 视频门铃等产品正在使用哪些解决方案?

What are the best solutions for Android/ios clients and for web clients Android/ios 客户端和 web 客户端的最佳解决方案是什么

When you build a WebRTC conference, you can choose between different architectures:在构建 WebRTC 会议时,可以选择不同的架构:

Mesh based architectures are simple, but scale badly, since every user must send its stream to n-1 other clients.基于网格的架构很简单,但扩展性很差,因为每个用户都必须将其 stream 发送给 n-1 个其他客户端。 So you send the same stream multiple times.因此,您多次发送相同的 stream。 In my experience, it works well for up to 5 users, but it may be to much for bad internet connections or smartphones.以我的经验,它最多适用于 5 个用户,但对于糟糕的互联网连接或智能手机来说可能就太多了。 For larger converences, a media server is adviced.对于较大的会议,建议使用媒体服务器。

If you want to broadcast something (1 sender, many receivers or many senders, many receivers), you may want to use a Single Forwarding Unit (SFU).如果您想广播某些内容(1 个发送者、多个接收者或多个发送者、多个接收者),您可能需要使用单个转发单元 (SFU)。 This media server receives the stream of a peer connection and broadcasts it to everyone else.此媒体服务器接收对等连接的 stream 并将其广播给其他所有人。 So you send your outgoing stream once and it gets distributed, while you may receive the n-1 other streams.因此,您发送一次传出的 stream 并分发它,而您可能会收到 n-1 个其他流。 It may also transcribe your video stream (change it to supported video codecs or scale it down).它还可以转录您的视频 stream(将其更改为支持的视频编解码器或按比例缩小)。 Common SFUs are jitsi and there was also a node-sfu module, if I remember it correctly.常见的 SFU 是 jitsi,如果我没记错的话,还有一个 node-sfu 模块。

For really big converences, you may just want to use a Multiconferencing Unit (MCU).对于真正的大型会议,您可能只想使用多会议单元 (MCU)。 It mixes the video and audio tracks.它混合了视频和音频轨道。 So for 1 outgoing connection, your stream, you receive 1 stream that mixed everything from everyone else and you together.因此,对于 1 个传出连接,您的 stream,您会收到 1 个 stream,它将其他所有人和您的所有内容混合在一起。 This has the least amount of network and CPU load for the peers, since you only have 1 sending and receiving connection and you do not need to display multiple videos or mix them at the client.这对于对等点来说具有最少的网络和 CPU 负载,因为您只有 1 个发送和接收连接,并且您不需要在客户端显示多个视频或混合它们。 The de facto standard media server is Kurento.事实上的标准媒体服务器是 Kurento。

On the other hand, as soon as you remove load from the client, you put it on your media server.另一方面,一旦您从客户端移除负载,您就将其放在您的媒体服务器上。 The MCU has to decode, mix, and re-encode the video streams, the sfu has to do less (since mostly forwarding) and the full mesh approach has no media server, so it may be the cheapest one. MCU 必须对视频流进行解码、混合和重新编码,sfu 必须做的更少(因为主要是转发),并且全网状方法没有媒体服务器,因此它可能是最便宜的一种。

The "low latency" requirement, and a "security cam to a few viewers" requirement really narrows down your options to WebRTC Media Server. “低延迟”要求和“少数观众的安全摄像头”要求确实将您的选择范围缩小到 WebRTC 媒体服务器。

Check out Kurento, Unreal Media Server, Ant Media Server.查看 Kurento、虚幻媒体服务器、Ant 媒体服务器。

  • Typically, the camera will stream video to the Media Server via RTSP.通常,摄像头会将 stream 视频通过 RTSP 传送到媒体服务器。 This is especially good since Opus is supported by RTSP/RTP;这特别好,因为 Opus 受 RTSP/RTP 支持; some IP cameras already support Opus audio (Axis brands).一些 IP 相机已经支持 Opus 音频(安讯士品牌)。
  • Note that some media servers will transcode your video in order to stream to WebRTC viewers in web browsers, and this process takes a lot of CPU, thus, doesn't scale well.请注意,某些媒体服务器会在 web 浏览器中将您的视频转码为 stream 到 WebRTC 查看器,并且此过程需要大量 CPU,因此不会很好地扩展。 Try to choose a media server that uses original camera-encoded content, instead of transcoding.尝试选择使用原始相机编码内容的媒体服务器,而不是转码。

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

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