如何构建一个简单的视频流服务器? [英] How to build a simple video streaming server?

查看:61
本文介绍了如何构建一个简单的视频流服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是视频流媒体的新手,我只是建立了一个示例网站来播放视频.在这里,我只是将视频文件的位置提供给html5中的视频标签.我刚刚注意到,在youtube中,视频标签包含Blob网址,并对此进行了调查.我发现视频数据是分段的,并且遇到了一个称为伪流的术语.而好像我建立的网站会下载整个文件并播放视频.我没有尝试进行任何实时流式传输,只是尝试流式传输本地视频.我想也许视频数据分段接收的方式是由视频流服务器完成的.我遇到了RED5开源流服务器,但是给出的大多数示例都是针对实时流的,而我并未对其进行实验.已经过了几天,我不确定我走的路是否正确

I am a newbie in video streaming and I just build a sample website which plays videos. Here i just give the video file location to the video tag in html5. I just noticed that in youtube the video tag contains the blob url and had a look into this. I found that the video data comes in segments and came across a term called pseudo streaming. Whereas it seems likes the website that i build downloads the whole file and plays the video. I am not trying to do any live streaming, just trying to stream local videos. I thought maybe the way video data is received in segments is done by a video streaming server. I came across RED5 open source streaming server, but most of the examples that is given is for live streaming which I am not experimenting on. Its been few days and I am not sure whether i am on the right track

推荐答案

您所指的分段方法是支持自适应比特率流媒体-ABR.

The segmented approach you refer to is to support Adaptive Bit Rate streaming - ABR.

ABR允许客户端设备或播放器按块(例如10秒)下载视频,并从最适合当前网络条件的比特率中选择下一个块.参见此处的示例:

ABR allows the client device or player download the video in chunks, e.g 10 second chunks, and select the next chunk from the bit rate most appropriate to the current network conditions. See here for an example:

对于您现有的网站,只要您的服务器支持范围请求,那么您实际上可能并没有下载整个视频.使用范围请求",浏览器或播放器将一次仅请求文件的一部分,因此它可以在下载整个文件之前开始播放.

For your existing site, so long as your server supports range requests then you probably are not actually downloading the whole video. With Range Requests, the browser or player will request just part of the file at a time so it can start playback before the whole file is downloaded.

对于MP4文件,值得注意的是,您需要在文件的开头而不是结尾处包含标头信息,该信息包含在称为MOOV原子的块"或原子"中.常规MP4文件的结尾.有许多工具可让您将其从头开始-例如:

For MP4 files, it is worth noting that you need to have the header information, which is contained in a 'block' or 'atom' called MOOV atom, at the start of the file rather than the end - it is at the end for regular MP4 files. There are a number of tools which will allow you move it to the start - e.g.:

您的调查工作绝对是正确的-视频托管和流媒体是一个专业领域,因此通常可以更轻松地利用现有流媒体技术和服务,而不是自己构建自己的服务.可以找到一些不错的地方来感受开源解决方案:

You are definitely on the right track with your investigations - video hosting and streaming is a specialist area so it is generally easier to leverage existing streaming technologies and services rather than to build them your self. Some good places to look to get a feel for open source solutions:

这篇关于如何构建一个简单的视频流服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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