Product updates · 4 min read

SRT protocol for Live Streaming

Live stream better with the Secure, Reliable, Transport (SRT) protocol

Explore a better, more reliable way to live stream with api.video – introducing the Secure, Reliable, Transport (SRT) protocol.

Jean-Baptiste  - Video Lead

Jean-Baptiste,

Arushi Gupta

April 19, 2024

The common challenge with live streaming lies in its real-time nature - it's live, and there are no second chances. A single misstep, and your audience could miss out on witnessing the thrilling winning goal or a pivotal moment in a football match, much like when Lionel Messi scored an incredible free-kick during the Champions League final.

 

In an attempt to make live streaming better for you, api.video now offers SRT (Secure Reliable Transport) support for your live streams. This means that you can choose to push video to any existing or new live stream to api.video over Real-Time Messaging Protocol (RTMP) or SRT.

Why SRT?

SRT is a modern protocol used in live streaming to send video over the internet in a secure and reliable way.

 

Think of it as a super safe highway for your video data to travel on. It helps ensure that even if there are bumps or traffic jams on the internet, your live stream still reaches its destination smoothly with decent video quality.

 

As opposed to RTMP, SRT can accommodate to changes in internet conditions, like fluctuations in speed or packet loss, ensuring a decent viewing quality experience for users.

 

Let’s get a bit into the technical details.

 

[Skip this if you don’t want to know the technical aspect and head straight to the next subject]

 

When you stream audio and video using RTMP, the data you send might not reach the server in order, and some of it could even get lost due to the unpredictable nature of networks. The Transmission Control Protocol (TCP), which manages this data transfer, is very cautious and insists on getting every piece of data in order. This can slow things down because if it doesn't receive a packet, it waits for it, blocking other packets in the meantime. This works well for exchanging files where every bit of data matters, but for real-time streaming, it can cause delays because there's no guarantee of when data will arrive. This may lead to buffering.

 

SRT takes a different approach. It relies on User Datagram Protocol (UDP) which does not enforce packet re-ordering and does not manage packet losses. However, when data is not in order or has some losses, SRT handles it. It does this by letting the streamer choose the maximum latency they're okay with when streaming. The SRT server then holds back data for that amount of time. During this time, it organizes the packets and asks for any missing ones to be sent again. But if a packet isn't received by the end of this delay, it's considered lost, and it's up to the server to deal with that.

 

By doing so, SRT makes it possible to stream data with a stable latency to the server which limits buffering to a certain extent.

 

In a nutshell, SRT gives you the flexibility to choose between latency and quality of stream under fluctuating network conditions.

How will SRT benefit you?

SRT becomes relevant especially in unreliable network conditions.

 

  • It safeguards against jitter, packet loss, and fluctuations in bandwidth, guaranteeing an optimal viewing experience.
  • SRT is an excellent choice if you want to stream videos over unreliable networks, such as the public internet.
  • SRT improves playback reliability ensuring that your video does not buffer. However, the audio/video quality may differ as you can see in the table below.
SRT vs RTMP comparison table

Overall, remember that when you choose SRT, you choose to sacrifice a portion of visual and audio quality in exchange for maintaining a stable latency, thereby ensuring better playback reliability. This trade-off is fundamental to the SRT protocol's approach, prioritizing the consistent delivery of content over maximizing quality.

Getting started with SRT

  • If you want to continue live streaming using the same protocol as before (RTMP), you do not need to change anything.

 

  • If you want to try streaming through the SRT protocol, you only need to update the server URL for your streams. Note that you cannot switch protocols mid-stream - you will have to stop, update, and restart your live stream.

 

The documentation here will give you more details.

 

Live streaming through SRT is now available. Please reach out if you have any questions or encounter any issues as you implement it.

 

If you haven’t live streamed with api.video yet and would like to start your journey with us, sign-up for a free sandbox account NOW!

Try out more than 80 features for free

Access all the features for as long as you need.
No commitment or credit card required

Video API, simplified

Fully customizable API to manage everything video. From encoding to delivery, in minutes.

Built for Speed

The fastest video encoding platform. Serve your users globally with 140+ points of presence. 

Let end-users upload videos

Finally, an API that allows your end-users to upload videos and start live streams in a few clicks.

Affordable

Volume discounts and usage-based pricing to ensure you don’t exceed your budget.