Note: Note: There are tags for each build date. If you need to "pin" the Docker image version you use, you can select one of those tags. E.g. tiangolo/nginx-rtmp:latest-2020-08-16
.
Docker image with Nginx using the nginx-rtmp-module module for live multimedia (video) streaming.
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.15.0 and nginx-rtmp-module 1.2.1).
This was inspired by other similar previous images from dvdgiessen, jasonrivers, aevumdecessus and by an OBS Studio post.
The main purpose (and test case) to build it was to allow streaming from OBS Studio to different clients at the same time.
GitHub repo: https://github.com/tiangolo/nginx-rtmp-docker
Docker Hub image: https://hub.docker.com/r/tiangolo/nginx-rtmp/
- For the simplest case, just run a container with this image:
docker run -d -p 1935:1935 --name nginx-rtmp tiangolo/nginx-rtmp
-
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 a "key" that will be used later in the client URL to display that specific stream. For example:
test
-
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 (it also works in Raspberry Pi using
omxplayer
) -
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/test
-
Click "Play"
-
Now VLC should start playing whatever you are transmitting from OBS Studio
If something is not working you can check the logs of the container with:
docker logs nginx-rtmp
If you need to modify the configurations you can create a file nginx.conf
and replace the one in this image using a Dockerfile
that is based on the image, for example:
FROM tiangolo/nginx-rtmp
COPY nginx.conf /etc/nginx/nginx.conf
The current nginx.conf
contains:
worker_processes auto;
rtmp_auto_push on;
events {}
rtmp {
server {
listen 1935;
listen [::]:1935 ipv6only=on;
application live {
live on;
record off;
}
}
}
You can start from it and modify it as you need. Here's the documentation related to nginx-rtmp-module
.
-
This image is built from the same base official images that most of the other official images, as Python, Node, Postgres, Nginx itself, etc. Specifically, buildpack-deps which is in turn based on debian. So, if you have any other image locally you probably have the base image layers already downloaded.
-
It is built from the official sources of Nginx and nginx-rtmp-module without adding anything else. (Surprisingly, most of the available images that include nginx-rtmp-module are made from different sources, old versions or add several other components).
-
It has a simple default configuration that should allow you to send one or more streams to it and have several clients receiving multiple copies of those streams simultaneously. (It includes
rtmp_auto_push
and an automatic number of worker processes).
- β¬ Bump tiangolo/issue-manager from 0.5.0 to 0.5.1. PR #96 by @dependabot[bot].
- π· Update
issue-manager.yml
. PR #95 by @tiangolo. - β¬ Bump docker/build-push-action from 5 to 6. PR #92 by @dependabot[bot].
- π· Update
latest-changes
GitHub Action. PR #93 by @tiangolo. - β¬ Bump docker/build-push-action from 2 to 5. PR #68 by @dependabot[bot].
- β¬ Bump docker/setup-buildx-action from 1 to 3. PR #67 by @dependabot[bot].
- β¬ Bump docker/login-action from 1 to 3. PR #69 by @dependabot[bot].
- π· Update issue-manager.yml GitHub Action permissions. PR #76 by @tiangolo.
- π· Update issue-manager.yml GitHub Action permissions. PR #75 by @tiangolo.
- π§ Add GitHub templates for discussions and issues, and security policy. PR #72 by @alejsdev.
- π§ Update
latest-changes.yml
. PR #70 by @alejsdev.
- β¨ Allow using debug directives, enable
--with-debug
compile option. PR #16 by @agconti. - β¨ Add support for multiarch builds, including ARM (e.g. Mac M1). PR #65 by @tiangolo.
- βοΈ Fix a typo in README. PR #20 by @Irishsmurf.
- β¬οΈ Upgrade Nginx to 1.23.2 and OS to bullseye. PR #40 by @tiangolo.
- β¬ Upgrade to nginx-1.19.7. PR #26 by @cesarandreslopez.
- β¬ Update RTMP module version to 1.2.2. PR #28 by @louis70109.
- Upgrade Nginx to version 1.18.0. PR #13 by @Nathanael-Mtd.
- π· Update token for latest changes. PR #50 by @tiangolo.
- π· Add GitHub Action for Docker Hub description. PR #45 by @tiangolo.
- Bump tiangolo/issue-manager from 0.3.0 to 0.4.0. PR #42 by @dependabot[bot].
- Bump actions/checkout from 2 to 3. PR #43 by @dependabot[bot].
- π¨ Format CI config. PR #44 by @tiangolo.
- π· Add Dependabot and funding configs. PR #41 by @tiangolo.
- π· Add scheduled CI. PR #39 by @tiangolo.
- π· Add alls-green GitHub Action. PR #38 by @tiangolo.
- π· Build to test on CI for PRs, update GitHub Actions. PR #37 by @tiangolo.
- π· Add Latest Changes GitHub Action. PR #29 by @tiangolo.
- Add CI with GitHub actions. PR #15.
- β¬ Bump peter-evans/dockerhub-description from 3 to 4. PR #63 by @dependabot[bot].
- β¬ Bump tiangolo/issue-manager from 0.4.1 to 0.5.0. PR #64 by @dependabot[bot].
- Bump actions/checkout from 3 to 4. PR #52 by @dependabot[bot].
- β¬ Bump tiangolo/issue-manager from 0.4.0 to 0.4.1. PR #61 by @dependabot[bot].
- π· Update dependabot. PR #55 by @tiangolo.
- π· Update latest-changes. PR #54 by @tiangolo.
This project is licensed under the terms of the MIT License.