Search code examples
nginxvideovideo-streaminghttp-live-streamingrtmp

Dynamic configuration of multiple streams with nginx-rtmp-server


I need to build an application that has a many-to-many correspondence between users and cameras. The server needs to pull the RTMP streams from the cameras and stream them to the users (web and mobile applications) as HLS.

I considered using nginx-rtmp-server but the problems I faced were:

  • I'm having to configure each camera stream manually (I would prefer to add/remove streams programmatically)
  • User requests to streams need to be authorized by my application

Is there a way to achieve the above with nginx-rtmp-server or any other library? I think that a library that can be integrated with my application and configured dynamically will do the job. Any suggestions there?


Solution

  • Question 2 : I have no idea about authorization.

    Question 1 : For nginx-rtmp-server you can use in nginx

    rtmp {
            server {
                    listen 1935;
                    chunk_size 4096;
                    application live {
                            live on;
                            record off;
                    }
            }
    }
    

    Here you register an application called live.

    Now you can use it for multiple camera like :

    rtmp://{ip address}:1935/live/{camera_id}