直播网站背后的技术是什么?

发布于 2024-09-15 18:06:49 字数 1436 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

仅此而已 2024-09-22 18:06:49

最近,我一直在与几家大公司就这个问题进行密切合作。首先也是最重要的,正如其他答案中已经提到的,内容分发网络用于提供最佳分发。

CDN 基本上是一个全球服务器集群,保存单个资源的多个副本。因此,当您从纽约市请求该资源时,您会得到物理上最接近纽约的版本。关于 CDN 的工作原理有很多很好的解释。

您关于带宽的问题涉及一种称为“自适应比特率流”的技术。假设您有一个直播流式传输到网络上。在进行流式传输时,有一种称为分段器的技术,可以将整个文件分成小数据包,以便稍后拼凑在一起。每个片段都被编码为不同的分辨率和功能。因此,当您(客户端)请求文件时,CDN 可以判断连接的强度。如果它较低,自适应比特率流将为您提供较低分辨率的文件。您是否注意到,当您开始在线观看视频时,视频质量较低,但随着时间的推移质量会有所改善?这是该技术的完美示例。随着您的连接缓冲进一步扩展且速度更快,您将获得更高质量的“段”。访问 Level 3 和 Akamai 等公司的网站,您可以阅读他们的大量白皮书,了解其运作方式。

这是一篇关于自适应比特率流媒体的文章。

I've been working closely with a few major companies at work lately on this very issue. First and foremost, as already mentioned in other answers, a Content Delivery Network is utilized to provide optimum distribution.

A CDN is basically a worldwide cluster of servers that holds many copies of a single resource. So, when you request that resource from, say, New York City, you get the version of it that is PHYSICALLY closest to New York. There are many great explanations of how CDN works.

Your question about bandwidth involves a technology called Adaptive Bit Rate Streaming. Let's say you have a live broadcast streaming out to the web. As it's streaming, there is a piece of technology called a segmenter that chunks up the whole file into small packets that can be pieced together later. Each segment is encoded to various resolutions and capabilities. So, as you, the client, are asking for the files, the CDN can tell how strong the connection is. If it is low, the Adaptive Bit Rate Streaming gives you a lower resolution file. Have you ever noticed how when you start watching video online, it's low quality but improves over time? This is a perfect example of this technology. As your connection buffers further out and is fast, you get higher quality "segments". Hit up the websites of companies like Level 3 and Akamai and you can read a lot of their white papers on how it all works.

Here's an article on Adaptive Bit Rate Streaming.

梦途 2024-09-22 18:06:49

内容交付系统,并减少文件大小。

第一个允许他们将文件存储在世界各地数据中心的服务器中,从而降低用户的传输和存储成本。这意味着更快的下载/流媒体。

第二种有多种形式。最值得注意的是降低分辨率、调整比特率和使用高级编解码器。如果将 640x480 分辨率的视频缩小到 320x240,则需要大约 1/4 的空间来存储它。同样,使用较低的比特率会使视频更加块状,但精度的损失也会导致文件大小的损失。最后,更先进的编解码器(如 h.264)可以在相同的视觉质量下压缩相同的视频,并且比旧的或更简单的编解码器(如 MPEG1 或 DivX)更小。

Content Delivery Systems, and reducing file size.

The first one lets them have their files stored in servers in data centers around the world, thus having a lower transit and storage cost to the user. This means faster downloads/streaming.

The second comes in many forms. Most notably reducing resolution, adjusting the bitrate, and using advanced codecs. If you reduce a 640x480 resolution video to 320x240, you need aproximately 1/4th the space to store it. Likewise, using a lower bitrate makes a video blockier, but that loss of precision is also a loss in file size. Finally, more advanced codecs like h.264 can compress the same video, at the same visual quality, smaller than older or simpler codecs, like MPEG1 or DivX.

荭秂 2024-09-22 18:06:49

过去使用过但现在可能会也​​可能不会使用的一种简单方法是使用 UDP 而不是 TCP。 UDP 的开销较低。对于像 pdf 或程序这样的东西,你需要每个字节,丢失几个或几个数据包,整个东西就没用了。对于视频和音频而言,情况并非如此,我们倾向于原谅或可能不会注意到丢帧或某些丢失的音频。 UDP没有TCP那样有保证的可靠性,但是对于还可以的流媒体来说,速度比可靠性更重要,只要它足够好。

当今能够流式传输视频的最重要原因是压缩技术。每种新技术 (h.264) 或版本 (mpeg1、mpeg2...) 都要求在相同比特率下提供更高质量的视频,或者在相同质量下提供更低比特率的视频,或者两者兼而有之,在更低比特率下提供更好的质量。该算法以带宽换取编码器和解码器上的计算能力。理想情况下,大部分工作都在编码方面,以便解码算法可以很简单。如果您曾经尝试对高质量的 mpeg2 或 h.264 或其他类型的视频进行编码,则编码视频所需的时间通常比播放视频所需的时间要长得多。

添加其他网络技巧,例如此问题的其他答案中描述的内容交付网络/系统。总而言之,这会减少您与内容系统之间的跳数,并将内容的整体传输带宽分散到许多服务器上。

One simple approach that was used in the past, but may or may not be used today would be to use UDP instead of TCP. UDP has lower overhead. For things like a pdf or a program you need every byte, lose a few or a few packets worth and the whole thing is useless. For video and audio this is not the case, we tend to forgive or perhaps not notice dropped frames or some missing audio. UDP does not have the guaranteed reliability that TCP has, but for streaming that is okay, speed is more important than reliability, so long as it is good enough.

The most important reason for the ability to stream video today is the compression technology. Each new technology (h.264) or version (mpeg1, mpeg2,...) demands better quality video at the same bitrate or lower bitrates for the same quality or both, better quality at lower bitrates. The algorithm trades bandwidth for computation power both on the encoder and decoder. Ideally the bulk of the work is on the encoding side so that the decode algorithm can be simple. If you have ever tried to encode a good quality mpeg2 or h.264 or other type video it often takes significantly longer to encode the video than it does to play the video.

Add to that other networking tricks like the Content Delivery Network/System described in other answers to this question. The long and short of that is reducing the number of hops between you and a system with the content as well as spreading the overall delivery bandwidth of the content across many servers.

绝對不後悔。 2024-09-22 18:06:49

如果涉及 Flash 流,可以使用 Adob​​e Flash Media Server、Wowza 和开源 Red5 等媒体服务器。

它们用于通过网络传输录制的或实时的流。

带宽使用取决于视频和声音编解码器。

您可以在此处查看 Adob​​e Flash 对编解码器的支持。
您还可能需要查看这篇维基百科文章

这些可能会给你一个想法。

If it's about flash streaming, there are media servers like Adobe Flash Media Server, Wowza, and open-source Red5.

These are used to stream recorded or live streams over the web.

The bandwidth usage depends on video and sound codec.

You can see the codecs support by Adobe Flash here.
Also you may want to check this Wikipedia article.

Those may give you an idea.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文