Guides: Optimize your live streams with SRT: Mux setup guide

0:00

Phil: Hey, Phil from Mux here with a quick demo of

0:03

how you can use SRT on Mux to deliver a great live streaming

0:07

experience even when the network you're sending a video

0:10

from is less than perfect.

0:12

Okay, so on the left I've got OBS playing my

0:16

favourite movie, Big Book Bunny, and I've got my

0:18

live stream on the right.

0:20

My live stream at the moment is going out over

0:22

RTMP, it's going out at about 7 megabits a second.

0:25

It's completely stable, no dropped frames,

0:27

anything like that.

0:29

If we take a look at the live stream health.

0:31

Seems fine, completely stable, about 7 megabits,

0:34

30 frames a second.

0:36

So what I'm going to do is I'm going to use Network Link

0:39

Conditioner to introduce some problems on this network.

0:43

So I'm going to introduce 100 milliseconds of

0:46

extra latency, as well as introducing 5 percent

0:49

packet loss on both packets sent and packets received.

0:53

Let's see what that does to our RTMP stream.

0:58

So if you keep an eye on the bottom of OBS, we'll start to

1:00

see really quickly, we start dropping frames way above

1:04

like the 5 percent of packet loss that we introduced.

1:08

Um, eventually we'll probably actually see that this gets

1:10

a full RTMP disconnect as well, and then we'll start

1:13

to see reconnects kicking in.

1:15

If we take a look at the Mux dashboard, obviously

1:17

we see this big dive off in the bit rate and obviously

1:22

the frame rate as well.

1:23

So you probably wouldn't be able to watch this.

1:25

It would be a pretty easy.

1:27

Stuttery mess from playback side.

1:29

It's taking a lot longer than you want for frames

1:30

to get into the encoder.

1:32

Let's take a look at what this looks like with SRT instead.

1:36

Okay.

1:36

Now that live stream stopped, let's reconfigure

1:39

OBS to use SRT.

1:41

To do this, I need the SRT URL, stream key, passphrase,

1:45

but I'm also going to set up the latency of a connection.

1:49

So what this does is it tells SRT how much buffer.

1:52

To keep on each end of a connection.

1:55

To compensate for packet loss, reordering, jitter, latency,

1:59

all those sorts of things.

2:01

So I've set that to two seconds in this case,

2:04

which should be enough for the issues that we're

2:07

introducing on the network.

2:08

So let's start that stream again.

2:10

Okay, so our live stream's back up.

2:13

Now let's do the same again.

2:14

Let's turn on our network link conditioner.

2:17

And see what happens to our SRT stream with 5 percent

2:20

packet loss and that extra a hundred mil seconds round trip

2:23

time, if we take a look down here, it doesn't look like

2:27

we're dropping any frames.

2:29

We might see the bit rate start to spike a little

2:31

bit, and that's because, Hey, we're having to resend

2:33

a bunch of extra frames.

2:34

So sending some extra data, let's see how it looks so far.

2:39

So good.

2:40

Our live stream looks pretty stable.

2:42

We're not dropping any frames.

2:44

Uh, frame rates, consistent bit rates are consistent.

2:47

So it looks like things going well, even though

2:50

we're dropping quite a lot of packets.

2:53

This is what SRT is designed for.

2:55

It's designed to handle these imperfect network conditions

2:58

and make sure you can still live stream when this happens.

3:01

Let's take a look at how our asset looks.

3:04

Looks pretty good to me, even with all of that packet loss.

3:09

And all that extra latency.

3:11

So there you go.

3:12

That's how you can use SRT to improve reliability

3:15

of your live streams.

3:17

Even when the network isn't perfect.