Self-host your own streaming server without relying on any external and expensive services (like Amazon IVS).
See a demo here - https://demo.streamplanet.tv/
Clone this repository:
git clone https://github.com/Athlon1600/nginx-rtmp-server.git
Next, you need Docker.
Windows
If you are testing this from your local Windows computer, download Docker from here:
https://docs.docker.com/docker-for-windows/install/
Linux
Install Docker with just this one command:
bash <(wget -O - https://raw.githubusercontent.com/Athlon1600/nginx-rtmp-server/master/install.sh)
Once Docker is installed, run:
docker-compose up --build -d
and that is it! This will launch two services:
- HTTP Nginx Server on http://localhost:8090
- RTMP Ingest Server on
rtmp://localhost:1935
Once the two services are up and running, you can now start streaming to your newly launched RTMP server at this endpoint:
rtmp://localhost:1935/live/{stream_key}
{stream_key}
can be anything you want. In all the examples below we just use test
.
If you are using OBS, point your streaming settings to:
rtmp://localhost:1935/live/test
otherwise, you can just stream any mp4-like video file using ffmpeg
:
ffmpeg -stream_loop -1 -nostdin -re -i "video.mp4" -copy -f flv rtmp://localhost/live/test
Your stream is now ready to be consumed via HTTP as .m3u8
playlist by any supporting client such as VLC Media Player:
Media -> Open Network Stream -> Network
- Paste the link there:
http://localhost:8090/hls/test/master.m3u8
or you can embed that video stream on your website by using hls.js
Javascript library:
Powered by RTMP module for nginx.
https://www.nginx.com/products/nginx/modules/rtmp-media-streaming/
The original codebase stopped receiving updates years ago:
https://github.com/arut/nginx-rtmp-module
so we will be using this fork instead:
https://github.com/sergey-dryabzhinsky/nginx-rtmp-module