Skip to content

A nginx server with rtmp module for stream video in hls format

Notifications You must be signed in to change notification settings

alcarazolabs/nginx-rtmp-hls-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginx-rtmp-hls-server

A nginx server with rtmp module for stream video in hls format.
Docker image for an RTMP/HLS server running on nginx
NGINX Version 1.21.1
nginx-rtmp-module Version 1.2.2

Steps to run on windows or ubuntu

  • Using a ready docker image
  1. Download the docker image nginx-rmtp-hls.tar
  2. Load this docker image in docker, open a console for that:
# docker load < nginx-rmtp-hls.tar
  1. List your docker images
# docker images

You will see:

REPOSITORY                                TAG       IMAGE ID       CREATED          SIZE
alcarazolabs/nginx-rtmp-hls               latest    f7749de13327   2 minutes ago   17.3MB

3.1 IF YOU DON'T WANT TO LOAD THIS file nginx-rmtp-hls.tar AND YOU WANT RUN IT ON RASPBERRY PI or BUILD THE DOCKER IMAGE. RUN:

# chmod +x run.sh
# docker image build -t raspberrypi/nginx-rtmp-hls .

Note: In this case you should use the file Dockerfile-raspberrypi, rename this file and ignore the default Dockerfile.
4. Run the server:

docker run -p 1935:1935 -p 8080:8080 alcarazolabs/nginx-rtmp-hls
  1. Start Obs Studio and start a transmision
Streaming Service: Custom
Server: rtmp://192.168.0.16:1935/live
Play Path/Stream Key: mystream
  1. Watching the steam

In your favorite RTMP video player connect to the stream using the URL:
rtmp://192.168.0.16:8080/live/mystream
http://192.168.0.16:8080/hls/mystream.m3u8

Configurations

This image exposes port 1935 for RTMP Steams and has 2 default channels open "live" and "testing".
live (or your first stream name) is also accessable via HLS on port 8080
It also exposes 8080 so you can access http://
The configuration file is in /opt/nginx/conf/

Multiple Streams:

You can enable multiple streams on the container by setting RTMP_STREAM_NAMES when launching, This is a comma seperated list of names, E.G.

docker run      \
    -p 1935:1935        \
    -p 8080:8080        \
    -e RTMP_STREAM_NAMES=live,teststream1,teststream2   \
    alcarazolabs/nginx-rtmp-hls

Pushing streams

You can ush your main stream out to other RTMP servers, Currently this is limited to only the first stream in RTMP_STREAM_NAMES (default is live) by setting RTMP_PUSH_URLS when launching, This is a comma seperated list of URLS, EG:

docker run      \
    -p 1935:1935        \
    -p 8080:8080        \
    -e RTMP_PUSH_URLS=rtmp://live.youtube.com/myname/streamkey,rtmp://live.twitch.tv/app/streamkey
    alcarazolabs/nginx-rmtp-hls

Tested players

Creds:

https://hub.docker.com/r/jasonrivers/nginx-rtmp
https://github.com/JasonRivers/Docker-nginx-rtmp

Warning:

The ip 192.168.0.16 must be replace by your machine ip, this is an example ip.

About

A nginx server with rtmp module for stream video in hls format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published