not logged in | [Login]

Server-Setup

Page is in progress

This will work on any Linux server, I'm currently running this on a $3.50/month Vultr instance, but I've also used DigitalOcean and Linode which worked well.

Installation

This assumes you have Docker and docker-compose installed.

Create a directory containing docker-compose.yml, nginx.conf, and config.json

docker-compose.yml

version: '3.5'
services:
    rtmp:
        image: irlwiki/nginx-rtmp
        restart: always
        ports:
            - "1935:1935"
        volumes:
            - ./nginx.conf:/etc/nginx/nginx.conf
        networks:
            - rtmp-net

    noalbs:
        image: irlwiki/noalbs
        restart: always
        volumes:
            - ./config.json:/app/config.json
        networks:
            - rtmp-net

networks:
    rtmp-net:
        driver: bridge

nginx.conf

load_module /usr/lib/nginx/modules/ngx_rtmp_module.so;

worker_processes 1;

events {
        worker_connections 4096;
}

http {
    include mime.types;
    default_type application/octet-stream;
    ignore_invalid_headers on;

    server {
        listen      80;
        server_name localhost;

        # Disable access log, it spams the docker logs, and this isn't externally accessible
        access_log off;

        # This URL provides RTMP statistics in XML
        location /stat {
            if ($request_method = "GET") {
                add_header "Access-Control-Allow-Origin"  *;
            }

            rtmp_stat all;

            # Use this stylesheet to view XML as web page
            # in browser
            rtmp_stat_stylesheet /stat.xsl;
        }

        location /stat.xsl {
            # XML stylesheet to view RTMP stats.
            # Copy stat.xsl wherever you want
            # and put the full directory path here
            # root /path/to/stat.xsl/;
            root "../";

        }

        location /control {
            rtmp_control all;
        }
    }
}

rtmp {
    server {
        listen 1935;
        ping 30s;
        notify_method get;
        chunk_size 8192;
        ack_window 8192;

        # Stream to "rtmp://IPHERE/publish/live".
        application publish {
            live on;
            wait_video on;
            wait_key on;
            exec_options on;
            publish_notify on;
            play_restart on;
            drop_idle_publisher 6s;
            idle_streams off;
        }
    }
}

config.json (check GitHub for the latest version of this)

The hostname in the RTMP server URL must match the service name configured in docker-compose.yml (rtmp)

{
    "obs": {
        "ip": "YOUR_OBS_IP:4444",
        "password": "password",
        "normalScene": "Screen",
        "offlineScene": "BRB",
        "lowBitrateScene": "lowbitratedetected",
        "refreshScene": "REFRESH",
        "lowBitrateTrigger": 1000,
        "refreshSceneInterval": 10000,
        "requestMs": 2000,
        "onlySwitchWhenStreaming": true
    },
    "nginx": {
        "rtmp": "rtmp://rtmp/publish/live"
    },
    "twitchChat": {
        "channel": "YOUR_CHANNEL",
        "botUsername": "YOUR_BOT_USER",
        "oauth": "oauth:YOUR_OAUTH_HERE",
        "enable": true,
        "prefix": "!",
        "enablePublicCommands": false,
        "publicCommands": ["bitrate"],
        "enableModCommands": false,
        "modCommands": ["refresh", "fix", "trigger", "sourceinfo", "obsinfo"],
        "enableAutoSwitchNotification": true,
        "enableAutoStopStreamOnHostOrRaid": true,
        "adminUsers": ["715209", "b3ck"],
        "alias": [["r", "refresh"], ["f", "fix"], ["b", "bitrate"]]
    },
    "language": "en"
}

Running

To start, run docker-compose up -d
To stop, run docker-compose down

Verify that it's running by running docker-compose logs, you should see something like this:

Attaching to nginxrtmp_rtmp_1, nginxrtmp_noalbs_1
noalbs_1  |
noalbs_1  | > [email protected] start /app
noalbs_1  | > node ./lib/app
noalbs_1  |
noalbs_1  |
noalbs_1  |     ███╗   ██╗ ██████╗  █████╗ ██╗     ██████╗ ███████╗
noalbs_1  |     ████╗  ██║██╔═══██╗██╔══██╗██║     ██╔══██╗██╔════╝
noalbs_1  |     ██╔██╗ ██║██║   ██║███████║██║     ██████╔╝███████╗
noalbs_1  |     ██║╚██╗██║██║   ██║██╔══██║██║     ██╔══██╗╚════██║
noalbs_1  |     ██║ ╚████║╚██████╔╝██║  ██║███████╗██████╔╝███████║
noalbs_1  |     ╚═╝  ╚═══╝ ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝ ╚══════╝ v1.6.0
noalbs_1  |
noalbs_1  | [9/22/2019] [8:15:27 AM] [OBS] › ℹ  info                         Connecting & authenticating
noalbs_1  | [9/22/2019] [8:15:27 AM] [CHT] › ℹ  info                         Connecting to twitch
noalbs_1  | [9/22/2019] [8:15:28 AM] [OBS] › ✔  success                      Successfully connected
noalbs_1  | [9/22/2019] [8:15:28 AM] [CHT] › ✔  success                      Successfully Connected
noalbs_1  | [9/22/2019] [8:15:28 AM] [CHT] › ✔  success                      Authenticating and joining channel #oozebrood