Streaming engines can be expensive, create a simple solution that fits basic test usage!

Streaming engines can be expensive to run so in order to manage costs and retain flexibility I decided to create a simple solution that fits basic test usage while the remaining highly available as well as scalable.

The following solution streams from OBS and uses the NGINX server hosted on Amazon’s EC2 service under an Ubuntu AMI. AWS gave me the possibility accommodate billing to my usage needs. Most vendors for these types of solutions rarely offer On-Demand pricing.

Start by:
 Launching an EC2 Instance then setup Nginx RTMP server. Make sure to set your Security groups to allow outbound traffic for the specific audience to the default RTMP port: TCP port 1935.

Initiate the EC2 instance and update it with the following command: $ apt-get update

Install NGINX with RTMP module:

$ sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

$ wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

$ wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

$ tar -zxvf nginx-1.13.1.tar.gz

$ unzip master.zip

$ cd nginx-1.13.1

Build NGINX:


$ ./configure --with-httpsslmodule --add-module=../nginx-rtmp-module-master

$ make

$ sudo make install

Go to NGINX configuration

$ sudo /usr/local/nginx/sbin/nginx

Append the following snippet at the end of the server configuration file, in this instance we’ll use the nano command to edit the file:


$ nano /usr/local/nginx/conf/nginx.conf

Snippet:

rtmp {                
        server {
                listen 1935;
                chunk_size 4096;
                application live {
                        live on;
                        record off;
                }
        }
}

Then, restart the server withe the following command:

$ sudo /usr/local/nginx/sbin/nginx -s stop

$ sudo /usr/local/nginx/sbin/nginx

Using OBS, input the following in order to generate the test stream(insert link)

  • Streaming Service: Custom
  • Server: rtmp://[EC2 Server ip]/live
  • Stream Key: test


You can use any source media in OBS. In this instance I decided to use a demo video(insert link) encoded in standard x264.


While the main reason for this solution is to retain creative license, the RTMP stream can feed to multiple services such as Youtube or Facebook live-streaming portals. Beware of cost by having in mind that the more bandwidth the stream requires between the upstream(source) and downstream(audience) the higher the incurred costs will amount.