Coder Social home page Coder Social logo

thiagoeolima / nginx-rtmps Goto Github PK

View Code? Open in Web Editor NEW
31.0 2.0 21.0 17 KB

Docker image with Nginx using the nginx-rtmp-module module for streaming and Stunnel to add TLS encryption functionality.

Dockerfile 69.06% Shell 30.94%
livestream nginx obs-studio rtmp twitch docker live nginx-rtmp rtmps server

nginx-rtmps's Introduction

nginx-rtmps

Docker image with Nginx using the nginx-rtmp-module module for streaming and Stunnel to add TLS encryption functionality.

Description

This Docker image can be used to create an RTMP server for multimedia / video streaming using Nginx, nginx-rtmp-module and Stunnel, built from the current latest sources (Nginx 1.18.0 , nginx-rtmp-module 1.2.1 and Stunnel 4).

This was inspired by other similar previous images from tiangolo, dvdgiessen, jasonrivers, aevumdecessus and by an OBS Studio post.

The main purpose (and test case) to build it was to allow streaming from OBS Studio to different clients at the same time.

GitHub repo: https://github.com/thiagoeolima/nginx-rtmps

Docker Hub image: https://hub.docker.com/r/thiagoeolima/nginx-rtmps/

Details

How to use

  • For the simplest case, just run a container with this image:
docker run -it -p 1935:1935 --name nginx-rtmps thiagoeolima/nginx-rtmps
  • Facebook and Youtube:
docker run -it -p 1935:1935 -e FACEBOOK_KEY="<key>" -e YOUTUBE_KEY=<key> thiagoeolima/nginx-rtmps
  • Cloudflare:
docker run -it -p 1935:1935 -e CLOUDFLARE_KEY="<key>" thiagoeolima/nginx-rtmps
  • Twitch:
docker run -it -p 1935:1935 -e TWITCH_URL="rtmp://<url>" -e TWITCH_KEY="<key>" thiagoeolima/nginx-rtmps
  • Kick:
docker run -it -p 1935:1935 -e KICK_KEY="<key>" thiagoeolima/nginx-rtmps
  • OBS
rtmp://localhost:1935/live
  • Instagram:
docker run -it -p 1935:1935 -e INSTAGRAM_KEY=<key> thiagoeolima/nginx-rtmps
  • OBS
rtmp://localhost:1935/instagram

How to test with OBS Studio

  • Run a container with the command above

  • Open OBS Studio

  • Click the "Settings" button

  • Go to the "Stream" section

  • In "Stream Type" select "Custom Streaming Server"

  • In the "URL" enter the rtmp://<ip_of_host>/live replacing <ip_of_host> with the IP of the host in which the container is running. For example: rtmp://192.168.0.30/live

  • In the "Stream key" use a "key" that will be used later in the client URL to display that specific stream. For example: test

  • Click the "OK" button

  • In the section "Sources" click de "Add" button (+) and select a source (for example "Screen Capture") and configure it as you need

  • Click the "Start Streaming" button

Debugging

If something is not working you can check the logs of the container with:

docker logs nginx-rtmps

Extending

If you need to modify the configurations you can create a file nginx.conf and replace the one in this image using a Dockerfile that is based on the image, for example:

FROM thiagoeolima/nginx-rtmps

COPY nginx.conf /etc/nginx/nginx.conf

The current nginx.conf contains:

worker_processes auto;
rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
events {}
rtmp {
    server {
        listen 1935;
        listen [::]:1935 ipv6only=on;
        chunk_size 4096;

        application live {
            live on;
            record off;

        #-YouTube
        #push rtmp://a.rtmp.youtube.com/live2/<key>;
        #-Facebook;
        #push rtmp://127.0.0.1:19350/rtmp/<key>;
        #-Instagram;
        #push rtmp://127.0.0.1:19351/rtmp/<key>;
        #-Cloudflare
        #push rtmp://127.0.0.1:19352/live/<key>;
        #-Kick
        #push rtmp://127.0.0.1:19353/kick/<key>;
        }
        
        application instagram {
            live on;
            record off;
            
            #-Instagram;
            #push rtmp://127.0.0.1:19351/rtmp/<key>;
        }

    }

}

nginx-rtmps's People

Contributors

biightning avatar matt-flaig avatar successtheman avatar thiagoeolima 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  avatar  avatar  avatar

Watchers

 avatar  avatar

nginx-rtmps's Issues

Multistream

Multistream possible to activate 2 Services? like Twitch and Kick?

Must the stunnel be used for nginx-rtmps?

I've noticed the following contents from the git master version of nginx-rtmp-module:

$ egrep -inR 'ssl' .
./ngx_rtmp_handshake.c:11:#include <openssl/hmac.h>
./ngx_rtmp_handshake.c:12:#include <openssl/sha.h>
./ngx_rtmp_handshake.c:111:#if OPENSSL_VERSION_NUMBER < 0x10100000L
./hls/ngx_rtmp_mpegts.h:13:#include <openssl/aes.h>
./config:132:USE_OPENSSL=YES
Binary file ./.git/objects/pack/pack-d7c34c8c57305af7f92dce3514b22136f4100ddc.pack matches
./README.md:68:Several versions of nginx (1.3.14 - 1.5.0) require http_ssl_module to be
./README.md:71:    ./configure --add-module=/path/to/nginx-rtmp-module --with-http_ssl_module
./test/www/jwplayer/jwplayer.js:9:b.isYouTube=function(a){return-1<a.indexOf("youtube.com")||-1<a.indexOf("youtu.be")};b.isRtmp=function(a,b){return 0==a.indexOf("rtmp")||"rtmp"==b};b.foreach=function(a,b){for(var e in a)a.hasOwnProperty(e)&&b(e)};b.isHTTPS=function(){return 0==g.location.href.indexOf("https")};b.repo=function(){var a="http://p.jwpcdn.com/"+d.version.split(/\W/).splice(0,2).join("/")+"/";try{b.isHTTPS()&&(a=a.replace("http://","https://ssl."))}catch(e){}return a}}(jwplayer),function(d){var a="video/",h={mp4:a+"mp4",

But I'm not sure whether the above messages can assure us of the native support for TLS without the help of Stunnel. Any hints will be highly appreciated.

Regards,
HY

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.