简体   繁体   中英

Proxy a rtmp stream

How could I proxy a rtmp stream?

I have two raspberry pi streaming live video from raspicams on my LAN. Each raspberry pi sends the video to ffmpeg which wraps in flv and sends to crtmpserver.

A third server using nginx, has a static html page with two instances of jwplayer, each pointing to one raspberry pi.

The setup is just like this one .

The web server uses authentication and I'd like streams not to be public too.

I'm thinking of trying nginx-rtmp-module, but I am not sure if it would help me. 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".

Then you should already be able to play your stream with jwplayer (with the address rtmp:///file) or with any other player. MonaServer support the HTTP protocol so you can host your html page without nginx if you want.

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 :

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)

Going further you could use another flash video client that support RTMFP in order to handle a large number of clients. Contact me (jammetthomas AT gmail.com) for more informations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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