Dual Stream Tutorial

Introduction

This tutorial provides instructions to dual stream from Open Broadcaster Software to Twitch and Youtube. This system is different than the dual stream system built into some broadcasting software. IN this tutorial we will learn how to setup a relay which will broadcast the stream to both services.

The Diagram below should help you understand how this works.

                               ---> Twitch
        Streamer -- > Relay --> |
                               ---> Youtube        

What you will need

Installing Software

The first step is to install nginx and the nginx rtmp module.
You will need to either login as root, or have sudo access. (If you login with root, remove sudo from the directions below)

        $ curl -o nginx.tar.gz http://nginx.org/download/nginx-1.7.3.tar.gz
        $ wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
        $ tar -xvf nginx.tar.gz
        $ unzip master.zip
        $ sudo yum install gcc pcre-devel openssl-devel
        $ ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master
        $ make
        $ sudo make install
        $ sudo ln /usr/local/sbin/nginx /usr/bin
You are now ready to configure your software.

Configuration

Open /usr/local/nginx/conf/nginx.conf in your favorite text editor (you may wish to download the file, edit, and reupload).

The File should look something like this:

        #user  nobody;
        worker_processes  1;

        #error_log  logs/error.log;
        #error_log  logs/error.log  notice;
        #error_log  logs/error.log  info;

        #pid        logs/nginx.pid;


        events
        {
            worker_connections  1024;
        }


        rtmp
        {
            server
            {
                listen 1935;
                chunk_size 4096;

                application live
                {
                    live on;
                    record off;

                    push rtmp://service1/app/streamkey;
                    push rtmp://service2/app/streamkey;
                }
            }
        }

In order to find out what server you need to push to, consult the streaming service. For twitch you can find a list of servers here. You will want the Twitch server closest to your server.
An example of a proper push statement (Twitch.TV in Los Angeles):

push rtmp://live-lax.twitch.tv/app/[STREAMKEY];

Starting and Stopping The Server

To Start The Server:

$ sudo nginx

To Stop The Server:

$ sudo nginx -s stop

It is recommended you stop the server when you are finished streaming.

Configuring OBS

Configuration of OBS is rather simple. Just go to settings -> broadcast settings. Make sure mode is set to live stream and streaming service is set to custom. See the screenshot below.

Legal

I am not responsible in anyway shape or form for any damage caused by following or deviating from the above instructions or from the installed software. No warranties explicit or implied are provided. Use at your own risk.

Credits

Need A Server?

This streaming software is rather light weight and will run on a small VPS. The table below lists some providers I personally like. I provide no guarantee to the level of service you will receive, if any. Ensure that you read the providers terms of service and follow it. You are responsible for your own actions.

Name* Minimum Suggested Plan ** Transfer Included** Price (Per Month)**
BuyVM 256 MB Plan (OVZ) 1 TB $3.50 USD
Digital Ocean 512 MB Plan 1 TB $5.00 USD

* = Links Provided Are referral links and will benefit me. If you prefer regular links: BuyVM | Digital Ocean
** = This data was accurate as of writing and may have changed.