Skip to content
CATEGORY 3

Secure Low-latency Streaming Using Srt

Introduction to SRT?

Secure Reliable Transport (SRT) is an innovative open-source video transport protocol developed by Haivision, designed to facilitate low-latency and high-quality streaming over the internet. Initially introduced in 2013, SRT has gained popularity for its ability to deliver reliable video streams even in challenging network conditions, such as fluctuating bandwidth and high packet loss.

Motivation behind SRT

One of the primary motivations behind the development of SRT was to address the inherent challenges associated with traditional streaming protocols. Many existing protocols, such as RTMP (Real-Time Messaging Protocol), rely on TCP (Transmission Control Protocol), which can introduce latency and hinder performance due to its connection-oriented nature.

In contrast, SRT leverages the speed of User Datagram Protocol (UDP) while incorporating advanced error recovery mechanisms. This combination enables SRT to maintain high performance even in environments characterized by unstable network conditions, such as fluctuating bandwidth, high packet loss, and varying latency.

As of 2024, according to the Haivision Broadcast Transformation Report, 68% of respondents
selected SRT as their top protocol of choice, followed by RTMP at 56%, and UPD
Unicast/Multicast at 45%.

Applications of SRT

SRT is ideal for a variety of use cases including:

  • Live sports broadcasting
  • Remote video production
  • IoT connectivity
  • Metadata exchange
  • Uncompressed data delivery

Key Features of SRT

  1. Low Latency: SRT is optimized for real-time applications, achieving end-to-end latency as low as 120 milliseconds. This makes it particularly suitable for live broadcasting and remote production where timing is critical.
  2. Error Recovery: Utilizing Automatic Repeat reQuest (ARQ) mechanisms, SRT effectively manages packet loss by requesting retransmissions of lost packets, ensuring a smooth viewing experience despite network issues.
  3. security: The protocol incorporates AES (Advanced Encryption Standard) encryption for end-to-end security, protecting video streams from unauthorized access and maintaining content integrity.
  4. Adaptive Bitrate Streaming: SRT dynamically adjusts the bitrate based on current network conditions, optimizing video quality without compromising latency.
  5. Open Source: Being royalty-free and open-source encourages widespread adoption and collaboration within the streaming community, allowing developers to implement and modify the protocol freely.
  6. interoperability: SRT supports a wide range of audio and video codecs, making it compatible with various streaming workflows and devices.

UDP Foundation

SRT operates on top of the User Datagram Protocol (UDP), which provides several advantages:

  • Low Latency: UDP is inherently faster than Transmission Control Protocol (TCP) because it does not require a handshake process before data transmission. This characteristic allows SRT to achieve low-latency streaming, making it ideal for real-time applications such as live broadcasts and remote productions.
  • No Connection Overhead: Since UDP is connectionless, it eliminates the overhead associated with establishing and maintaining connections, allowing for quicker data transfer rates.
  • Error Recovery Mechanisms: While UDP does not provide built-in error recovery like TCP, SRT compensates for this by implementing its own mechanisms such as Automatic Repeat reQuest (ARQ) for retransmitting lost packets. This combination allows SRT to maintain a high level of reliability while benefiting from UDP's speed.
  • Flexibility in Streaming: By leveraging UDP, SRT can adapt to varying network conditions in real time. It can dynamically adjust bitrate and employ techniques like Forward Error Correction (FEC) to recover from packet loss without significantly impacting video quality.

SRT Architecture Components

  • listener: The listener is the endpoint that waits to receive incoming streams. It listens for connections from senders (encoders) and establishes a secure communication channel. In SRT, the listener can also manage multiple incoming streams, making it suitable for applications such as live broadcasting where multiple sources may need to connect simultaneously.
  • caller: The caller is the component that initiates the connection to a listener. It sends out a request to establish a stream, allowing it to transmit audio or video data. The caller is responsible for encoding the media stream and sending it over the established connection, ensuring that data is transmitted efficiently and securely.
  • Rendezvous Mode: SRT also supports a rendezvous mode, which facilitates peer-to-peer connections without requiring a direct IP address exchange. In this mode, both endpoints can act as both caller and listener, allowing for more flexible connection setups. This is particularly useful in scenarios where firewalls or NAT devices might complicate direct connections.

Experimenting with SRT

Getting hands-on with SRT is the best way to understand its capabilities. Below, you’ll find a series of examples demonstrating how to set up SRT for various scenarios, from simple streaming to more complex configurations.

Install SRT

  • Clone the SRT Repository:
  • Build and Install SRT:
    • Navigate into the cloned directory and build the SRT library:bash
      • cd srt
      • ./configure
      • makesudo make install
  • Verify Installation:
    • After installation, verify that srt-live-transmit is available by running:bash
    • srt-live-transmit --version

Example 1: Sender as caller, Receiver as listener

In this example, we'll create a basic UDP stream and use SRT to send it.

Example 3: Sender and Receiver in rendezvous mode

In this example, we'll create a basic UDP stream and use SRT to send it.

Author

Hiran Suresh

Embedded Software Engineer