Custom RTMP server for simulcasting (Dummies Version)

Categories: aws, Cloud, unix

This is the second of a multipart series on creating a custom RTMP server on the cloud to help you Simulcast to multiple platforms. You can read the previous post here.

Now with lockdown is in place, live streams are on the rise, be it on Youtube, Facebook, Twitch, or the multitude of other social media video platforms. This is true especially for churches world over where services have been stopped due to social distancing.

Even when the lockdown gets lifted, there is a high chance that Live streams will remain for the near future as there would be restrictions on the number of people that are allowed to congregate.

The simplest way to do live stream would be to open the app on your mobile, click on go live, and be on air! That’s how we started in our church.

But, if you need to use professional video cameras, custom graphics, scripture overlays, and other post-processing, you would need to use a video switcher and processing equipments, either a hardware one or one in software.

You then will update the URL for the live stream as well as a Stream Key, and will start to push video data to the platform.

All of this is great, but would help you get on to ONE of those platforms. What if you need to Simultaneously stream to more than one?

The easiest solution will be to choose one of the commercial providers of this service like or

But these cost money, not a lot, but when you’re spending Church money, that’s the widow’s mite!

So a cheaper solution would be to host one of your own. This can be either done on something you have at home or church like a desktop computer or a raspberry pi. But you need to be sure of the bandwidth available on your internet connection. Remember, as you increase the number of platforms, so does your bandwidth requirements, double the providers, double the bandwidth. And what would happen if that hardware breaks down? Do you have a spare computer on standby?

So the easiest and safest choice would be to move that to the cloud. And that wouldn’t cost much. Follow my previous post on how to install and configure a barebones Ubuntu server on Amazon Lightsail.

All you will need then is to configure a streaming server. Though this sounds complex, its not so. There are multiple options available, but the easiest is to install Nginx!

Step 1

Update and upgrade the distro

sudo apt-get update
sudo apt-get upgrade 

Step 2

Install Nginx and the module to add rtmp support. Real time Messaging Protocol (RTMP), is a protocol developed by Adobe, for real time streaming of video. This was originally used in the flash player, and though adobe has dropped support for flash, RTMP is the defacto protocol for streaming.

sudo apt-get install nginx -y
sudo apt-get install libnginx-mod-rtmp -y 

Step 3

Configure Nginx

In unix, configuration is done by editing text files, so to configure nginx, you need to edit the nginx conf file.

sudo nano /etc/nginx/nginx.conf 

We will first configure our cloud server, to take the input from our streaming software and push that to Youtube. Once we test this, we would configure Facebook, which needs some additional steps.

Go to Youtube studio, and grab the rtmp streaming URL and the stream key.

You will then need to combine them into the format

push URL/Key;

So in our case it will be

push rtmp://

replace xxxx-zzzz-yyyy-xxxx  with your stream key.

scroll down to the bottom of the file, and add the following code.configure our cl

rtmp {
        server {
                listen 1935;
                chunk_size 4096;
                application live {
                        live on;
                        record off;
                        push rtmp://;

Hit CTRL+X and press Y to save and exit the file.

For the settings to take effect, restart nginx

sudo systemctl restart nginx 

Step 4

Test Youtube streaming

Though we have configured the server to listen on port 1935, as the firewall rules by default do not permit this port, we need to add a specific rule to allow that.

Click on the networking tab in Amazon, and click on the “add another” option.

So now our cloud server is listening on port 1935, for any rtmp traffic. Once it sees anything, all it would do is to grab that and send it over to the Youtube server, at the URL that we provided along with the stream key.

You can test if this step is working by configuring your Streaming hardware or Software with the following settings

Giving an example of OBS

Here replace the IP address with that of your Ubuntu server that you created on AWS. The stream key in the above setting does not matter, you can put in any junk value.

Once you start the streaming, go to Youtube control panel, and you should ideally see the video stream.

Configuring for Facebook Live.

Facebook dropped support for RTMP some time back, and now uses RTMPS.

This will need a different setup than what we have done above for Youtube, and we will look at that in the next post.

    Leave a Reply

    Your email address will not be published. Required fields are marked *