Sign inSign up

polinux/rtmp-hls

By polinux

Updated over 5 years ago

Image
1

10K+

polinux/rtmp-hls repository overview

RTMP HLS Streaming server in a Docker (Alpine)

Discord
CircleCI Build Status GitHub Open Issues GitHub Stars GitHub Forks
Stars on Docker Hub Pulls on Docker Hub

Docker image for video streaming server that supports RTMP, HLS, and DASH streams.

Description

This Docker image can be used to create a video streaming server that supports RTMP, HLS, DASH out of the box. It also allows adaptive streaming and custom transcoding of video streams. All modules are built from source on Alpine Linux and it's using Supervisor to start Nginx.

Features

  • The backend is Nginx with nginx-rtmp-module.
  • FFmpeg for transcoding and adaptive streaming.
  • Default settings:
    • RTMP is ON
    • HLS is ON (adaptive, 5 variants)
    • DASH is ON
    • Other Nginx configuration files are also provided to allow for RTMP-only streams or no-FFmpeg transcoding.
  • Statistic page of RTMP streams at http://<server ip>:<server port>/stats.
  • Available web video players (based on video.js and hls.js) at /usr/local/nginx/html/players.

Current Image is built using:

  • Nginx 1.19.4 (compiled from source)
  • Nginx-rtmp-module 1.2.1 (compiled from source)
  • FFmpeg 4.3.1 (compiled from source)

Usage

To run the server
docker run -d -p 1935:1935 -p 8080:8080 polinux/rtmp-hsl
To stream to the server
  • Stream live RTMP content to:

    rtmp://<server ip>:1935/live/<stream_key>
    

    where <stream_key> is any stream key you specify.

  • Configure OBS to stream content:
    Go to Settings > Stream, choose the following settings:

    • Service: Custom Streaming Server.
    • Server: rtmp://<server ip>:1935/live.
    • Stream key: anything you want
To view the stream
  • Using VLC:

    • Go to Media > Open Network Stream.
    • Enter the streaming URL: rtmp://<server ip>:1935/live/<stream-key> Replace <server ip> with the IP of where the server is running, and <stream-key> with the stream key you used when setting up the stream.
    • For HLS and DASH, the URLs are of the forms: http://<server ip>:8080/hls/<stream-key>.m3u8 and http://<server ip>:8080/dash/<stream-key>_src.mpd respectively.
    • Click Play.
  • Using provided web player:
    The provided demo player can access any stream key that was set before.

    • To play RTMP content (requires Flash): http://<server ip>:8080/player/?<stream-key>
Example
  1. Send live stream to rtmp://<server_address>:1935/live/myStreamID
  2. Play stream in a web player at http://<server_address>:8080/player/?myStreamID

Docker troubleshooting

Use docker command to see if all required containers are up and running:

$ docker ps

Check logs of docker container:

$ docker logs rtmp

Sometimes you might just want to review how things are deployed inside a running container, you can do this by executing a bash shell through docker's exec command:

docker exec -ti rtmp /bin/bash

History of an image and size of layers:

docker history --no-trunc=true polinux/rtmp-hls | tr -s ' ' | tail -n+2 | awk -F " ago " '{print $2}'

Author

Author: Przemyslaw Ozgo
This work is also inspired by TareqAlqutami's work. Many thanks!

Tag summary

Content type

Image

Digest

Size

76.4 MB

Last updated

over 5 years ago

docker pull polinux/rtmp-hls