通过 HTTP 以 RTMP 流发布尽可能简单

通过 HTTP 以 RTMP 流发布尽可能简单

我正在寻找简单的免费/开源服务器软件,可以让我这样做:通过 RTMP 从 NAT 后面的本地计算机向服务器 (Linux) 发布视频流。服务器应通过 http 和/或 rtmp 提供该流。目前不需要为多个客户端提供服务。

我尝试过crtmpserverrtmpd,但没有相关文档,我不知道如何设置此特定配置。但是我尝试过,但没有成功。我已设法使用 OBS 发布流(或至少看起来如此),但找不到播放它的方法。如果您能帮助我配置它,那就没问题了。

我试过了rtmplite,但是没有用。我发布流失败了。

我尝试过ant media server(基于 red5)并成功了,但它似乎很慢,50mbps 的上传和下载速度以及低质量的视频总是出现故障。而且我不喜欢 http 流版本首先提供 m3u8 列表。如果您对如何解决这些问题有建议,那将是不错的解决方案。

我查看了nginx with rtmp module,但找不到配置通过 RTMP 发布流的 HTTP 下载的方法。如果你能告诉我怎么做,那就太好了。

还有其他服务器吗?

谢谢!

编辑:

我已成功使用 nginx 和 BLSS (rtmp) 模块接受已发布的流并将其进一步传输到 VLC。VLC 接受 RTMP 流并使用 HTTP 将其进一步提供给客户端。这正是我想要的,然而,VLC 引入了 6 秒的延迟,这比使用单个软件执行此操作更复杂。nginx 完全不会引入延迟,如果我可以将 VLC 的延迟至少减少到 3 秒,我会很高兴。我使用的 VLC 命令:

cvlc "rtmp://address:port/stream" --sout "#standard{access=http,mux=ts,dst=address:port}"

延迟是比复杂性更大的问题。我尝试过使用 nginx 和 HLS,但它引入了超过 15 秒的延迟,并且提供 .m3u8,出于某些原因,我试图避免这种情况。

谢谢。

答案1

为什么要用http播放?VLC可以读取RTMP原生流。

我使用 nginx 从 OBS 流式传输到我的 linux 服务器,并将我的全高清实时桌面屏幕分享给运行 VLC 的其他用户...

HTTP and RTMP are two different things. There is no way to transfer RTMP package through HTTP, because if a client sends an HTTP request, the server will return an HTTP response and then the client would consume HTTP package. In theory, the client can then unpack the HTTP package, but there would require extra work.

A much better solution is using HTTP Live Streaming (HLS). nginx-vod-module supports HLS. It can be easily configured in the config file. When a video is put in the server, the client can use a URL like http://127.0.0.1/vod/sample.mp4/index.m3u8. The Nginx server automatically partitions the video to HTTP package and provide a playlist. So the client can play it. HLS is widely supported by many open source players (for browsers) and mobile devices (both ios and android). And it can be easily configured with HTTPS for secure transformation.

来源

相关内容