Low latency with SRT and SLDP

Reliable Low Latency Delivery with SRT+SLDP

Editors note: This is a guest post from Yury Udovichenko, CEO and co-founder of Softvelum. His company was an early adopter of SRT and joined the SRT Alliance within weeks of the launch of the new streaming protocol open-source project. They’ve become great friends of Haivision’s, having tested Makito encoders in a complete end-to-end SRT workflow. Here’s how to do it!

Reliable low latency delivery is one of the most important concerns of live streaming today, whether you’re streaming sporting events, watching security cameras, making online bids or handling some other live events.

To ensure the success of these events, you need to make sure your streams are delivered without dropping frames and in real-time. If you drop too many frames during real-time video transmission, your viewers won’t see anything. If you ensure that all packets are transmitted, you will greatly increase your latency, causing a huge lag in the video.

That especially becomes crucial when the source of your video is on the opposite side of the globe. Another critical challenge of live video delivery is the interoperability of all the elements in your workflow, from your camera output to your viewer’s device.

Having said that, I’d like to describe the approach to building a low latency, high reliability delivery network using Haivision and Softvelum products. This approach is based on SRT and SLDP protocols addressing all the challenges described above. I have broken this post down into 8 sections:

  1. Architecture
  2. Technology
  3. Prerequisites
  4. Setting up the encoder to origin connection
  5. Setting up origin to edge connection
  6. Setting up edge reception
  7. Setting up edge playback
  8. Conclusion: A good combination

Let’s get started!

Architecture

With those underlying protocols, here is the workflow I’d like to describe in this article:

  1. Bring the video stream to the Haivision encoder.
  2. Deliver stream using SRT from the encoder to the origin servers powered by Softvelum’s Nimble Streamer. (Origin will be working in Listen Mode to wait for incoming stream from the encoder.)
  3. Re-publish the video using SRT to Nimble Streamer edges. (Edge will work in Pull Mode while origin will work in Listen Mode.)
  4. Use SLDP to bring the stream from Nimble Streamer edges to end user devices.

Workflow: source → encoder → origins → edges → viewer device

SRT Workflow

You can also publish your stream directly from the encoder to edges located across the globe, but I’ll demonstrate the complete workflow to show how you can set up nodes regardless of the architectural details.

We’ll review each element of the workflow but first let’s take a look at the technology and products to be used.

Technology

SRT stands for “Secure Reliable Transport” – it’s a UDP-based protocol that optimizes streaming performance across unpredictable networks.

SRT is applied to contribution and distribution endpoints as part of a video stream workflow to deliver the best quality and lowest latency video at all times.

  • SRT detects and adapts to the real-time network conditions between the two endpoints.
  • SRT helps compensate for jitter and bandwidth fluctuations due to congestion over noisy networks.
  • Error recovery mechanism minimizes the packet loss typical of internet connections.
  • AES 128/256 bit encryption is used for end-to-end security, keeping your streams safe from prying eyes.

The SRT protocol was originally developed by Haivision in 2014. In April 2017, Haivision and Wowza Media Systems partnered to create the SRT Alliance, a group dedicated to managing and supporting the open source implementation of the technology. Today, with over 85 members, this alliance is accelerating interoperability of video streaming solutions and fostering collaboration with industry leaders to achieve lower latency internet video transport.

Softvelum joined the SRT Alliance actively contributing to the community to improve the protocol and its ecosystem. Softvelum was amongst the first SRT Alliance members to release an SRT Ready solution with their own software implementation, available in Nimble Streamer, the company’s flagship product.

Nimble Streamer is a software media server with low resource usage and high performance. Available on x64, ARM and POWER8 platforms and on all major operating systems, it covers a wide range of capabilities for live streaming and video-on-demand along with a paywall and server-side ads insertion feature set.

Nimble Streamer supports all available SRT delivery modes – Caller, Listener and Rendezvous, to enable communication on both the source and receive sides. All SRT features like error detection, jitter compensation and stream encryption are supported. This allows building intercontinental large-scale delivery workflows of any size and complexity with nodes powered by Nimble Streamer.

However, we also need to cover last-mile delivery from the edge server to the viewer device. You may always use industry standards like HLS or MPEG-DASH. However, for low latency applications, those standards simply won’t work. This is where we consider using SLDP.

SLDP stands for “Softvelum Low Delay Protocol”. It was designed primarily to address the decline of Flash technology which made RTMP streaming deprecated for live streaming to end user devices. So the goal was to bring real-time delivery to modern browsers with these key capabilities:

  • Sub-second delay between origin and player;
  • Codec-agnostic: play whatever format your end user platform has, whether H.264, VP8, VP9, or H.265/HEVC;
  • ABR Support: switching channels takes just a GOP time and each channel may use its own codec;
  • HTTP and HTTPS on top of TCP: use it with any network settings.

The technology is based on Websockets, making it adhere to all the requirements above.

The playback of SLDP on end user devices is covered by a set of SLDP players, shown in the “Deliver to Viewers” section below.

Having explained these technologies, we can start composing the network.

Prerequisites

Before moving forward, you must have the following:

  • Haivision Makito X encoder hardware installed and running.
  • WMSPanel control panel account.
  • Nimble Streamer installed on sample servers for demonstration purposes. IPs are:
      • 10.0.0.1 (encoder hardware)
      • 10.0.1.1 (origin Nimble Streamer)
      • 10.0.1.2 (edge Nimble Streamer).
  • A valid stream input for the Makito X encoder.
  • Set the output of the Makito X to H.264/AAC live stream with 720p resolution.

Setting up the encoder to origin connection

Encoder outgoing stream

Let’s set up an outgoing stream from the encoder.

Once we get the stream ready for further transmission we’ll need to set up the encoder to deliver it to a Nimble Streamer origin server. SRT has various modes of carrying the stream between sender and receiver:

  • Push/call (Caller mode) from sender and set receiver to Listen mode;
  • Set sender to Listen mode and make receiver request the data;
  • Set Rendezvous mode for bypassing proxies.

We‘ll use the first option and will set our encoder to Push/Call to 10.0.1.1 server.

To set up your Makito X encoder (the SRT source device):

  1. Refer to the online Makito X User Guide:
    1. Installing the Makito X encoder (page 44-57)
    2. Add/Create a stream (page 125-131)
    3. Configuring SRT (page 133-135)
      1. Using the settings in the table below, create and start an Output Stream on the Makito X Encoder
      2. As seen in the example below, set Mode to “Caller”.
      3. Set the Address to 10.0.1.1 and the Destination Port to 1234. A Source port is not required in “Caller” mode.
      4. Click “Apply” button at the top of the screen.
      5. Click “Start” button beside the Apply button.

Set up Makito with SRTOnce the encoder has been set up to push the stream, you need to set up Nimble Streamer to receive it via Listen mode.

Receive stream in Nimble Streamer origin

Log into WMSPanel and click “Nimble Streamer” →  “Live streams settings” menu to see live streaming setup page then click on “MPEGTS In” tab. It will show empty list of setting which we’ll populate.

Nimble streamer settings

Click on “Add SRT stream” button to see the following dialog for creating a new incoming SRT channel.

Add SRT stream

In this dialog, “Receive mode” specifies the mode used for obtaining the stream. Set it to “Listen” – it sets Nimble Streamer to wait for incoming data and process it as soon as it arrives. We’ve set the source to “Push” mode as you can see from previous section.

IP Address and Port fields specify which interface will be used for connection. Alias is the name that will be used for further operations. You can see more details on SRT setup at this blog post.

Once you save the setting, it will sync-up with the server.

Set up origin to edge connection

Now that we have the SRT stream from the encoder to our origin, let’s deliver it to the edge server, which may be located in some distant data center. We’ll consider delivery to one edge but you can deliver to as many locations as you need. With Nimble Streamer it will be limited to your bandwidth rather than to origin server RAM or CPU.

Defining outgoing stream

We have an incoming SRT channel which may carry multiple streams. So in order to set up outgoing streams, describe each of them so Nimble could handle them separately.

Go to “Nimble Streamer” → “Live streams settings” menu to open live streaming setup page and open “MPEGTS Out” tab to see the list of outgoing streams.

Softvelum live stream settingsClick on “Add outgoing stream” button.

Add outgoing stream

Define the name of application and stream to be used for delivery – e.g. republishing and playback. Select video and audio sources and if they have multiple streams in a single channel, then select the required ones. Read this blog post for more details about adding outgoing streams to Nimble Streamer.

SRT and Softvelum outgoing streamsNow that we have an outgoing stream, let’s send it via SRT to the edge server.

Send the stream via SRT

Open “UDP streaming” tab on live streams setting page and click on “Add SRT setting” to see SRT setup dialog.

SRT UDT settingsThis time, let’s make it Listen/Pull mapping between origin and edge. So in Mode field select Listen. IP and Port will be set to “10.0.1.1” – this is the address of current origin server. Source application and stream fields need to contain the streams which you want to deliver. You’ve previously defined one stream in Outgoing streams section – so you can use it here now. Notice each stream will have its own PMT PID, Video PID and Audio PID. You can read this blog post for more details on SRT setup.

Now let’s set up the edge to get the SRT stream.

Setting up edge reception

Define the playback stream

You should still be on Live Streams Settings page. In left upper corner, select your edge server to see its settings.

As in section 3 above, add new MPEGTS incoming stream. Click on “MPEGTS In” tab and click on “Add SRT stream”.

MPEGTS settings

The difference now is that you will set “Mode” field to Pull value. You will also use origin IP address and port to define connection.

Having SRT stream reception, define outgoing stream parameters as you already did in section 5. SRT may deliver multiple channels so you need to split it into separate streams. Go to MPEGTS Out tab and click on Add outgoing stream button.

Outgoing stream for SRTYou will see a familiar dialog where you’ll specify application and stream names for further usage.

Once you apply this setting, go to “Global” tab. Define what protocols will be served from this edge server.

Global settingsSelect Softvelum Low Delay, HLS and MPEG-DASH to cover multiple playback capabilities.

You may also define these settings separately per application. Just click on Applications tab and add new applications – each will have its set of parameters.

Transcoding for ABR

We now have 720p stream delivered and transmuxed on your edge server, ready for further playback. Before moving to SLDP aspects, notice that you can use this edge server for transcoding your source stream into multiple low-resolution renditions to create an adaptive-bitrate (ABR) stream. This can be done with Nimble Streamer Live Transcoder available as a premium package for Nimble Streamer. You can use it to decode and encode AVC/H.264, HEVC/H.265, VP8 or VP9 streams. You may apply any set of filters on live content using drag-n-drop web UI to create any chains of transcoding.

In the meantime, we’ll use the original 720p stream.

Setting up edge playback

As described previously we’ll use SLDP for low latency end users playback. Softvelum provides a set of players for the majority of available platforms.

For web playback you can use HTML5 JavaScript player. It works in any MSE-enabled browsers on Windows, Linux, MacOS and Android. You can download a free player and embed it into your web pages. If you’d like to make custom implementation or extend the functionality, you may subscribe for player SDK.

For Android, you may also use native playback via SLDP Player free app and use SDK to create your own apps. iOS SLDP playback is only available using the native app with respective SDK for custom apps development.

Now let’s get a link to play your stream!

Go to “Nimble Streamer” top menu and click on “Live streams” menu. You’ll see a list of servers with links to their incoming, outgoing and ABR streams. Click on outgoing streams number to open a page with output streams list.

Output streams list

Click on a question mark to see sample URL dialog.

Softvelum sample URLSelect a URL for further usage. It will look like ws://10.0.1.2:8081/app/stream. Copy it for the SLDP web player.

If you’d like to use some IP that is not listed for this server, you may click on “Add more external IP …” link in this dialog to go to server details list and add more IPs to operate on this server.

In the list of URLs you will also see HLS and MPEG-DASH streams. They are generated according to your server setting. We’ve enabled them to cover devices which cannot play SLDP yet. So you can copy those links and use them in any player that supports those protocols, but doesn’t support SLDP.

For each protocol in the list, you will also be able to choose a player from a list of available ones and see the sample code in it. This will help embed the stream into your page.

SRT and SLDP are a winning combo

The combination of SRT for video transmission over unreliable networks and SLDP for last-mile delivery, provides high quality, reliable, sub-second delay video streaming experience, where you can reach your audience anywhere, anytime and on any device. Haivision products ensure the best video quality contribution while Softvelum solutions provide the best possible delivery, making this combination the right choice for any organization looking to reach global audiences with the best possible viewing experience every time.

Share this post