如何使用node.js创建视频流服务器?
到目前为止,我只与REST-ABIS合作,但是现在我需要创建一个服务器,该服务器为客户端提供了数百个视频,并且在视频或音频流方面的经验为零。
我看过很少的教程,并且知道数据将在块中提供,我可以控制块的大小,客户需要具有范围标题和所有内容,但是所有这些教程都是用于具有单个端点和视频的简单服务器。我可以以相同的方式管理数百个视频吗?
如果您可以回答下面的问题并指导我开始开发之前需要了解的事情,那将是一个很好的帮助。
我可以通过将其存储在服务器上或使用Amazon S3 Bucket之类的服务来处理视频文件吗?
我读到WebRTC也可以用于流媒体,我应该使用它还是坚持使用简单的方法?
是否有任何有用的软件包或技术可以使开发更容易?
视频还需要在移动应用程序平台上使用会改变事物,我还需要其他东西使其与移动应用兼容吗?
如果您有一个教程,您认为可以适合我的需求,您可以分享吗?
非常感谢您的帮助和时间。请随时提及我错过或需要知道的任何事情,谢谢。
Until now I have only worked with rest-APIs but now I need to create a server which serves several hundred videos of different lengths to client and I have zero experience in video or audio streaming.
I have seen few tutorials and know data will be served in chunks and I can control chunk size and client will need to have a range header and all that stuff, but all those tutorials were for simple servers that had a single endpoint and video. Will I be able to manage hundreds of videos the same way?
It would be a great help if you can answer the questions below and guide me about things I need to know before I start development.
Can I handle video files the same way I usually handle other files by storing it on server or using services like amazon s3 bucket?
I read that webRTC can also be used for streaming should I use it or stick to the simple method?
Are there any useful packages or technologies that can make development easier?
Videos also need to be served on mobile application platforms will that change things, do I need something else to make it mobile app compatible?
If you have a tutorial you think can be suitable for my needs, Can you please share it?
I really appreciate your help and time. Feel free to mention any thing that I missed or need to know, thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。但是,您将需要支持范围标题,因为大多数媒体播放器都会要求一系列字节,而不是一次性字节。而且,媒体播放器也可以获得媒体的总长度(因此它知道如何在播放器中显示滑块,因此它知道可用的字节范围)。
在某些特定情况下,WebRTC很有用(例如对等视频),但是您没有描述任何会让我认为您应该以这种方式与HTTP交付的方式相比,如上所述。
目前尚不清楚您在这里想要什么。在这里询问图书馆参考被认为是偏离主题。 NPM上有千亿个软件包与流有关,但是没有特殊的理由“需要”其中之一。您应该进行搜索,看看是否找到了似乎完全满足您需求的东西。通用流不需要这样的软件包。
没有区别,除了您必须支持如上所述的部分下载范围标头。
这对于Stackoverflow来说是偏离的(作为对外部资源的请求)。我建议您搜索,阅读,然后问一个更具体的问题,如果您在找到的教程中找到了一些您不了解的内容。
无论您的服务器仅使用一个视频还是能够提供数千个不同视频的视频,您的服务器都不需要有所不同。显然,您将需要能够满足存在的任何扩展/负载,但是无论您提供1000份视频还是1000个不同的视频请求,您的服务视频的基本设计都不会改变。
仅供参考,有一些更高级的视频流概念可以执行以下操作:
Yes. But, you will want to support the Range header since most media players will request a range of bytes, not the entire file at once. And, there's a way that the media players gets the total length of the media too (so it knows how to show a slider in the player and so it knows that ranges of bytes are available).
There are some specific situations where webRTC is useful (like peer to peer video), but you haven't described anything that would make me think you should go that way vs just http delivery as described above.
It's not clear what you want here. Asking for library references here is considered off-topic. There are zillions of packages on NPM related to streaming, but there's no particular reason to "need" one of them. You should do a search and see if you find something that seems to uniquely fit your needs. Generic streaming does not need such a package.
No difference, except that you must support the Range header for partial downloads as described above.
This is off-topic for stackoverflow (as a request for an outside resource). I'd suggest you search, read and then ask a more specific question if you find something you don't understand in the tutorials you find.
Your server does not need to be designed any differently whether its only serving one video or capable of serving thousands of different videos. Obviously, you will need to be able to meet whatever scaling/load that is present, but the fundamental design of how you serve a video doesn't change whether you're serving 1000 copies of one video or 1000 requests for 1000 different videos.
FYI, there are more advanced concepts for video streaming that do things like: