Get RTMP Server Setup in 3 Minutes

You are wondering how you can setup Free RTMP Server using Nginx in 3 minutes or less. Yes, docker can help you to setup free Nginx RTMP Server with FFMPEG, SSL and HLS.

NGINX, nginx-rtmp-module and FFmpeg from source with default settings for HLS live streaming

NAME=”Alpine Linux”
ID=alpine
VERSION_ID=3.11.6
PRETTY_NAME=”Alpine Linux v3.11″
HOME_URL=”https://alpinelinux.org/”
BUG_REPORT_URL=”https://bugs.alpinelinux.org/”

You can use this Free Nginx RTMP Server in Live Streaming needs like …

Church Live Stream with Timer
– Re-streaming Existing Live Stream using RTMP & FFMPEG
– Zoom Live Stream Share on custom RTMP Server
– CCTV Cam RTSP Stream to HLS using RTMP middleware
– IPTV Setup for setting up Live TV Channels
– Screen Share to online RTMP Server
– WebRTC to RTMP and HLS
– Record Live Stream (Audio/Video/Radio)

==> I am using Ubuntu 18.04 VPS Server for it

Install Docker


# apt update
# apt install apt-transport-https ca-certificates curl software-properties-common
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
# apt update
# apt-cache policy docker-ce
# apt install docker-ce
# systemctl status docker

Pull & Run Docker


# docker pull alfg/nginx-rtmp

Detached mode


# docker run -d -it -p 1935:1935 -p 8080:80 --rm alfg/nginx-rtmp

OR

Run in Background


# docker run -it -p 1935:1935 -p 8080:80 --rm alfg/nginx-rtmp &

SSH into Docker

First check CONTAINER ID and CONTAINER NAME


# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e439e9327954 alfg/nginx-rtmp "/bin/sh -c 'envsubs…" 12 hours ago Up 12 hours 0.0.0.0:1935->1935/tcp, 0.0.0.0:8080->80/tcp gracious_blackwell

CONTAINER ID: e439e9327954
CONTAINER NAME: gracious_blackwell


# docker exec -i -t e439e9327954 /bin/sh

OR


# docker exec –it gracious_blackwell /bin/sh

Re-Stream MP4 video to RTMP Live Server and get HLS m3u8 stream

RTMP Link: rtmp://server-ip:1935/stream/$STREAM_NAME
HLS Link: http://server-ip:8080/live/$STREAM_NAME.m3u8


# ffmpeg -re -i '/root/Christmas_2020.mp4' -vcodec copy -c:a aac -strict experimental -f flv 'rtmp://localhost:1935/stream/$STREAM_NAME'

Replace $STREAM_NAME with your Stream-Key 😉

Test HLS Stream in any Player
https://hlsplayer.stream/hls-m3u8-video-player/