If you’ve tried to set up an RTMP relay you know that it can be a giant pain in the ass. But if you don’t want to compile from source, there’s another option. Here’s the easy way.
- Spin up an instance of Debian Stretch as a Virtual Machine somewhere.
- Edit /etc/apt/sources.list and comment out the existing repositories.
- Add Stretch-backports: “deb http://ftp.de.debian.org/debian stretch-backports main”
- sudo apt-get update
- sudo apt-get install nginx-full
- Edit /etc/apt/sources.list and put the existing repositories back
Now add your RTMP relay config. Here are examples for something that pushes an inbound stream to twitch, pulls a published stream and republishes it, or just re-publishes incoming RTMP streams.
rtmp {
server {
listen 1935;
chunk_size 4096;
application thisisarelay {
live on;
record off;
}
application pullfrompublisher {
live on;
record off;
pull rtmp://10.2.4.5:2935/ocpush/cnoc live=1;
}
application pushtotwitch {
live on;
record off;
push rtmp://live.twitch.tv/live/streamkey;
# duplicate the push line for multiple outputs / dual streaming to YT/Twitch etc}
}
}
Now sudo /etc/init.d/nginx reload
and you’re done!
If you’re stuck on step 1 of getting a virtual machine up, here’s some instructions for that too, with more noob-friendly explanations.
- Create an aws account – http://aws.amazon.com
- Create an EC2 instance
- Select the Community AMIs and select Debian
- Scroll down until you find Stretch from June 2018
- Select that and go with it
- Don’t use a dynamic IP
- Edit the security group policy to allow port 80 and 1935 inbound.
- Let it create SSH keys
- Download the SSH key .pem file
- Download and install Putty if you haven’t already.
- Open PuttyGen and export .ppk and public key files from the .PEM
- Enter Auto-login username ‘admin’ under Connection->Data
- Load the .ppk file into PuTTY under Connection->SSH->Auth->Private key file for authentication
- Create an Elastic IP
- Associate Elastic IP with the instance
- Launch the instance
- SSH to the instance with putty
- Now start with step 2 of the top list. If you need this, you probably need to know to edit the file by typing ‘sudo nano /etc/apt/sources.list’
- Save the file by hitting Ctrl+O then quit by hitting Ctrl+X