Life Hack : Set up SRT backup stream in case of main stream interruption
In this lifehack/tutorial, we’re going to demonstrate how you can set up a backup for your stream in Callaba.
For example, if you are streaming from a venue where the internet connection is not the best, you might want to add a backup/fallback stream or video file to switch to in case the network with the main stream goes down.
Here we’re going to demonstrate how you can set up a backup “stream” from a video file. But you can apply the same logic for an actual live stream backup too.
✅ Before you begin
For this tutorial, you'll need Callaba Software.
You have two options for using Callaba: You can either launch it on AWS or install the self-hosted version on any hosting provider of your choice.
• 1 • Callaba Cloud on AWS
Subscribing to Callaba Cloud will take no more than 5 minutes.
📚 How to launch Callaba on AWS
• 2 • Callaba Cloud Self-Hosted
📚 How to install Callaba Self-Hosted
Let’s go!
First, we’re going to add our main input. In our case, it is a video stream via SRT.
01. Add your main stream input
Go to SRT Servers > click Add New
Name your SRT server, change ports if you want to, then save it.
In our example we have named our SRT server “First-input”.
To send your stream to the server, click “info” (i) and use one of the options — streaming via Host and Port, or streaming via Stream ID.
For now, we’ll leave this SRT server alone — we’ll get back to it soon.
02. Set up the backup/fallback input
In this part, we’re going to upload our video file and set it up as a strem coming to a separate SRT server.
Upload fallback/backup video file to Callaba
Open File manager > click "Add New"
Name your video file and upload it.
Tip :
You can click “Save” and your file will finish uploading in the background.
Now we need to turn our file into an actual stream.
Add SRT server for the backup stream
For starters, create a new SRT Server.
Go to SRT Servers > click "Add New"
Name your SRT server, change ports, save it.
In our example, we named it “Fallback-input” .
Re-stream video file to the SRT server
Go to Re-streaming section > click "Add New"
Name your restream
Input type : File
File : select the file you’ve uploaded
Stream destination : SRT URL
We want to send this stream to our Fallback SRT Server.
You can do it by typing your server’s IP address and the Publisher port of your Fallback SRT Server.
In our case, the port is 1955.
💡Alternatively, you can copy and paste the Publisher URL from your Fallback SRT Server.
To do that, click “info” (i) icon on your Fallback SRT Server and copy the Publisher URL.
Click “Save” and wait for the bitrate to appear. Now the video file is being streamed to the Fallback SRT Server.
Turn the Re-stream off for now. We’ll turn it on when we get to the actual testing.
03. Set up SRT Bonding
Now we’re going to use the main/backup SRT bonding mechanism to allow for automatic switching between our inputs in case the active input goes down for any reason.
To achieve that, we’re going to add a third SRT Server, that will then pull video streams from the previous two servers.
Go to SRT Servers > click "Add New"
Name your SRT server, change ports.
In our example, we named it “Bonding” .
Set up routing
Unfold Routing settings, then change settings
SRT Routing : SRT master-slave cluster
Routing mode : Pull
Then click “+ Add SRT Host”
Here we will have to add our previous SRT Servers (one for main stream and the other one for the fallback) as sources from where this new server will “pull” the streams.
Routing Host : Specify IP address of your server
Routing SRT Port : Specify Receiver (IMPORTANT) port
Destination SRT Server name : Specify the name of your server
Once you’ve added your first SRT Sever, click “+ Add SRT Host” again and add the second one.
Allow “pulling”
Unfold “Allowed streams”. Click “+ Allowed stream”.
In the new stream that appears, set up
Role : Puller
Click “Save”. Now our bonding is all set up.
Next, we’re going to use this last SRT Server, the Bonding server, to stream to Youtube to demonstrate how main/backup bonding works.
04. Set up Re-stream to Youtube
Go to Re-streaming section > click “Add New”
Name your restream
Input type : SRT Server
Server : select the Bonding SRT Server
Stream destination : Youtube
RTMP Stream Key : Copy your stream key from the Youtube creator studio
Save your re-stream.
05. Test the setup in action
Time to see how this works in real-time. We’re going to send our stream to Youtube and then simulate what will happen if our main stream breaks off.
Activate your inputs
1.1 — Send your main livestream to your main SRT Server.
To send your stream to the server, click “info” (i) and use one of the options — streaming via Host and Port, or streaming via Stream ID.
Wait until you see incoming bitrate.
1.2— Turn on your fallback re-stream.
On your Youtube live stream page, you should see your main stream coming.
In Callaba, you can see that the Bonding SRT Server is taking the stream from the Main Stream SRT Server.
Make it switch
To see the switching in action, turn off Main Stream SRT Server (“First-input”).
The switch will not happen immediately, cached video chunks have to play out first. After that you’ll see your stream switching to the backup/fallback video file stream.
In Callaba, you can see that the Bonding SRT Server is taking the stream from the Fallback SRT Server.
Make it switch back
Once you resolve any issues with the main stream, you can switch it back. When you see your main stream bitrate coming to Callaba, turn off the Fallback SRT Server.
The stream will switch back to the main one.
Then you can turn on the fallback server again so that it’ll continue to stay on standby in case any other issues arise with the main stream.
This is the end our our lifehack.
Follow us on social media
LinkedIn • Reddit • Instagram • Facebook • Youtube • Twitter