Docker image with Nginx using the nginx-rtmp-module module for live video streaming with hls player
This Docker image can be used to create an RTMP server for multimedia / video streaming using Nginx and nginx-rtmp-module, built from the current latest sources (Nginx 1.24.0 and nginx-rtmp-module 1.2.2).
This was inspired by other similar previous images from tiangolo The main purpose (and test case) to build it was to allow streaming from OBS Studio to different clients at the same time.
Docker Hub image: https://hub.docker.com/r/minerbigwhale/nginx-rtmp-hls
- For the simplest case, just run a container with this image:
docker run -d -p 1935:1935 -p 8080:8080 minerbigwhale/nginx-rtmp-hls
-
Run a container with the command above
-
Open OBS Studio
-
Click the "Settings" button
-
Go to the "Stream" section
-
In "Stream Type" select "Custom Streaming Server"
-
In the "URL" enter the
rtmp://<ip_of_host>/live
replacing<ip_of_host>
with the IP of the host in which the container is running. For example:rtmp://192.168.0.30/live
-
In the "Stream key" use
stream
-
Click the "OK" button
-
In the section "Sources" click the "Add" button (
+
) and select a source (for example "Screen Capture") and configure it as you need -
Click the "Start Streaming" button
-
Open a VLC player
-
Click in the "Media" menu
-
Click in "Open Network Stream"
-
Enter the URL from above as
rtmp://<ip_of_host>/live/<key>
replacing<ip_of_host>
with the IP of the host in which the container is running and<key>
with the key you created in OBS Studio. For example:rtmp://192.168.0.30/live/stream
-
Click "Play"
-
Now VLC should start playing whatever you are transmitting from OBS Studio
-
Open an internet Browser
-
in the address bar, enter
http://<ip_of_host>:8080/index.html
-
the hls player should start playing the stream
-
Note that by default, index.html try to open stream.m3u8 for the key
stream
-
to enable more stream keys, duplicate /srv/www/index.html and modify line 16 to match your key
This project is licensed under the terms of the MIT License.