/ Live

Create a Livestream Engine in the Cloud.

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 NGINX hosted on Amazon’s EC2 service under Ubuntu. AWS gave me the possibility accommodate billing to my usage needs. Most vendors for these types of solutions rarely offer On-Demand pricing.

Steps:

  1. Launch 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.

Bash commands:

  • Initiate the EC2 instance:
    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-http_ssl_module --add-module=../nginx-rtmp-module-master
    $ make
    $ sudo make install

Go to NginX's configuration
$ sudo /usr/local/nginx/sbin/nginx

  • Append the following snippet at the end of the server configuration File:
    $ nano /usr/local/nginx/conf/nginx.conf
rtmp {                
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}
  • Restart Server
    $ sudo /usr/local/nginx/sbin/nginx -s stop
    $ sudo /usr/local/nginx/sbin/nginx

  • OBS 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.

Octavio Cano

Octavio Cano

Blowleaf is a Media Production studio that specializes in online video publishing, event streaming, shorts, and promo spots.

Read More
Create a Livestream Engine in the Cloud.
Share this

Subscribe to Blowleaf