Sign inSign up

longridgehighschool/nginx-rtmp-ssl

By longridgehighschool

•Updated over 2 years ago

Docker image for an RTMP/HLS/MPEG-DASH server running on nginx with SSL support.

Image
1

1.8K

longridgehighschool/nginx-rtmp-ssl repository overview

⁠Nginx RTMP SSL

A docker container based on the original by mvgorcum⁠ for ingesting RTMP streams and providing streams to clients. Improved config generation and support for SSL for the stream urls.

⁠Usage

Run the container specifying the SERVER_NAME and providing the certificates.

⁠Certificates

Mount a folder to /var/ssl that contains cert.crt the PEM certificate, cert.key the private key for the cert and pass.txt the PEM passphrase (can be an empty file if no passphase is needed).

⁠Ports

  • 1935 - Used for RTMP ingest.
  • 443 - Used for serving the dash and HLS content.

⁠Environment Variables

VariableDefaultAbout
SERVER_NAMEnone, requiredSets the server_name of the http server in nginx for example rtmp.exmaple.com.
DASH_PLAYLIST_LENGTH30sSets the playlist length for dash, a lower value reduces delay but requires a faster client connection.
WORKER_PROCESSES1Sets the number of nginx worker processes.
RTMP_STREAM_NAMESlive,testingA comma seperated list of stream names.
RTMP_CONNECT_URLS``A comma seperated list of connect URLS.
RTMP_PLAY_URLS``A comma seperated list of play URLS.
RTMP_PUBLISH_URLS``A comma seperated list of publish URLS.
RTMP_DONE_URLS``A comma seperated list of done URLS.

⁠Docker Compose

Create a docker-compose.yml with this content:

version: '3.9'
services:
  db:
    image: longridgehighschool/nginx-rtmp-ssl:latest
    restart: always
    environment:
      SERVER_NAME: rtmp.example.com
    volumes:
      - /path/to/certs:/var/ssl
    ports:
      - '1935:1935'
      - '8443:443'

⁠OBS

Set your stream to custom with a server of rtmp://rtmp.example.com/live where rtmp.example.com is your SERVER_NAME and live is one of your RTMP_STREAM_NAMES. The Stream Key can be anything you want, clients just need to know what it is.

⁠Veiwing the stream

You can then use any streaming player to view the streams using these URLs:

  • rtmp://<your hostname>/<your stream name>/<your stream key>
  • https://<your hostname>/dash/<your stream name>/<your stream key>.mpd
  • https://<your hostname>/hls/<your stream name>/<your stream key>.m3u8

Tag summary

Content type

Image

Digest

sha256:5cd8db5f3…

Size

13 MB

Last updated

over 2 years ago

docker pull longridgehighschool/nginx-rtmp-ssl