简体   繁体   English

代理rtmp流

[英]Proxy a rtmp stream

How could I proxy a rtmp stream? 如何代理rtmp流?

I have two raspberry pi streaming live video from raspicams on my LAN. 我在局域网上有两个来自raspicams的树莓派流媒体实时视频。 Each raspberry pi sends the video to ffmpeg which wraps in flv and sends to crtmpserver. 每个树莓派将视频发送到ffmpeg,后者将其包装为flv,然后发送至crtmpserver。

A third server using nginx, has a static html page with two instances of jwplayer, each pointing to one raspberry pi. 使用nginx的第三台服务器具有一个静态html页面,其中包含两个jwplayer实例,每个实例都指向一个树莓派。

The setup is just like this one . 设置就像这一个

The web server uses authentication and I'd like streams not to be public too. Web服务器使用身份验证,我希望流也不要公开。

I'm thinking of trying nginx-rtmp-module, but I am not sure if it would help me. 我正在考虑尝试使用nginx-rtmp-module,但不确定是否会帮助我。 Also, it seems dormant and has many open issues. 此外,它似乎处于休眠状态,并且存在许多未解决的问题。

I'm open to suggestions, thanks in advance! 我愿意接受建议,在此先感谢!

You can use MonaServer with this client (copy it into the www/ directory of MonaServer) which listen on the udp port 6666 and wait for an flv file to publish it with the name "file". 您可以将此MonaServer该客户端一起使用(将其复制到MonaServer的www /目录中), 该客户端侦听udp端口6666,然后等待flv文件以名称“ file”发布它。

Then you should already be able to play your stream with jwplayer (with the address rtmp:///file) or with any other player. 然后,您应该已经可以使用jwplayer(地址为rtmp:/// file)或任何其他播放器播放流。 MonaServer support the HTTP protocol so you can host your html page without nginx if you want. MonaServer支持HTTP协议,因此,如果需要,您可以在没有nginx的情况下托管HTML页面。

Now if you want to filter the subscription to "file" you need to write a client:onSubscribe function in your main.lua script, just like this : 现在,如果要过滤对“文件”的订阅,则需要在main.lua脚本中编写一个client:onSubscribe函数,如下所示:

function onConnection(client)
    INFO("Connection from ",client.address)

    function client:onSubscribe(listener)
       INFO("Subscribing to ", listener.publication.name, "...")

       if not client.right then
          error("no rights to play it")
       end
    end
end

(Here you need to change the "not client.right" and implement your authentication function for your purpose) (这里您需要更改“ not client.right”并实现您的身份验证功能)

Going further you could use another flash video client that support RTMFP in order to handle a large number of clients. 更进一步,您可以使用另一个支持RTMFP的Flash视频客户端来处理大量客户端。 Contact me (jammetthomas AT gmail.com) for more informations. 与我联系(jammetthomas AT gmail.com)了解更多信息。

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

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