Code Monkey home page Code Monkey logo

rtmps-hls-server's Introduction

RTMPS-HLS-Server Docker

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

Description

This Docker image can be used to create a video streaming server that supports RTMP & RTMPS* Ingest, RTMP & RTMPS (via Stunnel) Pushing, and RTMP, HLS & DASH playback out of the box. It also allows adaptive streaming and custom transcoding of video streams. All modules are built from source on Debian and Alpine Linux base images.

Features

  • The backend is Nginx with nginx-rtmp-module.
  • FFmpeg for transcoding and adaptive streaming
  • Stunnel for RTMPS support (primarily for Facebook Live)
  • Default settings:
    • RTMP is ON
    • HLS is ON
    • DASH is ON
    • Other Nginx configuration files are also provided to allow for RTMP-only streams or FFmpeg transcoding and adaptive streaming.
  • 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.23.0 (compiled from source)
  • Nginx-rtmp-module 1.2.2 (compiled from source)
  • FFmpeg 5.1 (compiled from source)

This image was inspired by similar docker images from tiangolo and alfg. It has small build size, adds support for HTTP-based streams and adaptive streaming using FFmpeg.

Usage

To run the server

docker run -d -p 1935:1935 -p 1936:1936 -p 8080:8080 -e PUID=$UID -e PGID=0 -e SSL_DOMAIN='rtmp.domain.loc' -v /your/local/assets/:/assets jamiephonic/rtmps-hls-server:latest

When you start the container, the default players and configuration files will be copied into /your/local/assets/ to allow you to easily access and edit them. This will only be done once when you first start the container. If you want to restore the default configs, delete /your/local/assets/.initialized and restart the container.

For more examples, see the Wiki


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, however provided video players assume stream key is test

See the Wiki for how to stream to the server with RTMPS


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 players:
    The provided demo players assume the stream-key is called test and the player is opened from localhost.

    • To play RTMP content (requires Flash): http://<server ip>:8080/players/rtmp.html
    • To play HLS content: http://<server ip>:8080/players/hls_basic.html
    • To play HLS content using hls.js library: http://<server ip>:8080/players/hls.html
    • To play DASH content: http://<server ip>:8080/players/dash.html

    Notes:

    • These web players are hardcoded to play stream key "test" at localhost.
    • To change the stream source for these players, Modify the src attribute in the video tag in the html file and then reload the page.

Copyright

Released under MIT license.

More info

rtmps-hls-server's People

Contributors

dunn avatar jamiephonic avatar tareqalqutami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rtmps-hls-server's Issues

how to stop a stream from server

Hello
If someone is sending a stream to the server
How can it be stopped from the server?
For example, we only know that the stream key is "test12345"

SSL in cluster

Hi there,

I have deployed this on a kubernetes cluster.

I have a working SSL wildcard certificate on the cluster.

I have deployed this service on a subdomain and I am receiving an SSL error for this subdomain. http only is working

curl -iv subdomain.domain.io

url -iv --tlsv1.2 https://subdomain.domain.io             35 ↵
*   Trying xxx.xx.xxx.xx:443...
* Connected to subdomain.domain.io (xxx.xx.xxx.xx) port 443 (#0)
* ALPN: offers h2
* ALPN: offers http/1.1
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version
* Closing connection 0
curl: (35) error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version

Could this be a conflict with the SSL that is provided out of the box?

Have you set this up before?

Problem when trying to enable more resolutions on a signal

Best regards.

I set up the service in docker, currently the server I added the https to have the HLS signal with valid SSL certificate, everything works fine until I enable :

exec_push /usr/local/bin/ffmpeg -i rtmp://localhost:1935/$app/$name -async 1 -vsync -1
-c:v libx264 -c:a aac -b:v 256k -b:a 64k -vf "scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_low
-c:v libx264 -c:a aac -b:v 768k -b:a 128k -vf "scale=720:trunc(ow/a/2)*2" -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_mid
-c:v libx264 -c:a aac -b:v 1024k -b:a 128k -vf "scale=960:trunc(ow/a/2)*2" -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_high
-c:v libx264 -c:a aac -b:v 1920k -b:a 128k -vf "scale=1280:trunc(ow/a/2)*2" -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_hd720
-c copy -f flv rtmp://localhost:1935/show/$name_src;

I send 4 signals and only in 1 I get the audio and video from the signal, in the others I only get the audio, I thought that maybe it was server, so with this test signal:

rtmp://stream.mediaserver.com.co:8083/live/buenisimatv

when trying to broadcast from my local pc each signal, I realize that the rtmp link sometimes connects well and sometimes stays idle as in a timeout style, I pass my current configuration file, which did not add the options but only left the part of the bandwidth, but I would like everything to work from the s
nginx.txt
erver or if done from outside the connection to the rtmp is agile and without timeout

minimal config issue

Hello,

Initially when I had tried the container. It just crashed when I'd start it.

I was trying to use the minimal config. If I commented out the following nginx works as expected.

#listen [::]:1935;

Is it something I'm doing wrong or forgetting? Or something that was left in the minimal config by accident?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.