Configure OBS and Wowza Video to Reduce HLS Latency

 

Did you know that in most standard live streaming workflows, video playback is delayed more than thirty seconds from the get-go?

There’s good reason for this, too. In order to deliver a high-quality viewing experience, many protocols like Apple’s HTTP Live Streaming (HLS) transport segments of video data that must be downloaded before playback can begin. These segments default to up to ten seconds in size, and three of them must be loaded before a stream is actually viewable. This factor leaves broadcasters with the thirty-second delay mentioned above — and that’s without accounting for latency injected at other stages of the workflow.

Luckily, there’s a way to configure Wowza Video to deliver shorter packets of data, thereby minimizing the delay. The cherry on top? It’s as simple as checking a box.

In the video above, Justin walks through configuring low latency in Wowza Video and OBS Studio when using an RTMP to HLS workflow. If you need to reach your viewers faster, he also demonstrates how to set up an RTMP to WebRTC workflow for less than two seconds of delay.

What are you waiting for? Get started delivering reduced-latency HLS streams today. Hit play to find out how or read the transcript below.

 

Justin Miller:

HLS streams often have a high built-in latency. To some degree, this is due to the buffer size and segment duration. A player needs three segments before it starts streaming, so with the buffer size of four seconds and a segment duration of 10 seconds, you’ll have a latency of at least 34 seconds.

With Wowza Video, this can be reduced. When adding a live stream, we’ll first need to name the stream, and then choose a location closest to where we’re streaming from. Next, we’ll choose our type of ingest while many will select Other RTMP, we do have the option of Other SRT with a similar reduced latency. In either case, we’ll check Prioritize Latency to reduce the buffer size to zero and the segment duration to two seconds. While in theory, this could bring the latency to a minimum of six seconds, the results are usually between nine to 12 seconds.

You may have noticed I also changed the resolutions at 1080p, which generally needs a bitrate of 4,000 for talking heads or 6,000 for sports. If you want to make these changes manually to a live stream that’s already available, go under Transcoders and select a stream that didn’t prioritize latency. Under Transcoder Setup, you can edit the settings and then select a buffer size between zero to eight seconds. Don’t forget to save the change! For the segment duration, you’ll need to go under Stream Targets and again, select the same stream that didn’t prioritize latency. Under Properties, you can once again, edit the settings by first enabling the HLS segment duration, then selecting a duration between two and 10. Again, don’t forget to save.

 
Configure OBS and Wowza Video to Reduce HLS Latency
 

To see this working, we’ll use the live stream we’ve just created. To do so, we’ll need the source connection information to be entered into the encoder along with a number of configurations. Now for this, we’ll be using OBS Studio. Under Settings, we’ll want to be sure the audio is set to a 48 kilohertz sample rate, and the video is set to use a resolution of 1920 by 1080. Now under Output, we’ll choose the output mode Advanced. For audio, we need a bit rate at 128. Then back under streaming, we’ll choose a rate control of constant bitrate, or CBR. Since my video has little motion, we’ll make the bit rate 4,000 kilobits per second with the segment duration of two seconds, we’re going to set that key frame interval to be the same. We’ll also make the CPU usage be “veryfast,” the Profile “high” for 1080p, and most importantly, Tune for “zerolatency.”

Last of all, we want B frame set to zero and scene cut set to zero. Tuning for zero latency may do this on its own depending on the encoder, but we’ll add it in just to be safe. B frames can cause issues transcoding and scene cut can cause issues if there are many quick scene changes in succession. Now under Stream, we still need to go to Service and choose Custom. Then we’ll add in our source connection information. Remember the stream name is entered as the stream key. Once everything is entered and you’re ready to go, just start streaming to Wowza video.

We know the stream is working when in Wowza Video, we see a thumbnail and statistical information. We can view the stream via HLS by using the hosted page URL. If you look at the clock now, you can see what the latency is, down to about nine seconds. I’ve also configured a prioritized latency stream with SRT ingest and to see it, we’ll need to go to Available Streams and locate the stream so we can get the source connection information. We’ll need the primary server in the hosted port to add in OBS studio. Now, when adding this into OBS Studio, you’re going to need to append the primary server information with a colon, and then the host port. That’s all you need.

 
apple hls graphic
 

Once we’ve started the stream up, we can then go back to Wowza Video and verify the stream is running by viewing the thumbnail and statistical information. Once again, we’ll view the stream via HLS by using the hosted page URL. Again, you can expect between a nine to 12 second latency. Now, if you need a stream that is near real time, you have the option with Wowza Video of creating an alternate WebRTC output. Doing this will still leave the reduced-latency HLS output, but will also allow a WebRTC viewing option, albeit for a much reduced audience. You’ll need your own WebRTC playback for this option to work, we’ll be using wowza.com/webRTC/play.

In Wowza Video, go under transcoders and select the stream. Then, go to the Outputs and Targets tab here. We’re going to copy the passthrough output and make a few changes to this copy. We’ll change the video codec to H.264 and the audio codec to opus. The video bitrate and audio bitrate need to be the same as we put in the encoder, which is at 4,000 and 128, respectively. Once this has been saved, we’ll need to first scroll down and verify that it was, in fact, created. Then we can go to the direct playback URLs tab. Here, we’ll find the direct URLs for all the WebRTC playback options, including the one we’ve just created at 1080p. Copy the information as we’ll be using it in the player. Now, all we need to do is go back to Available Streams, locate the stream, and start the live stream.

Now back in the player, we can add our URL information. There are three areas for it to be added, so be sure to add it properly and remove the spaces and commas in the process. All right, well, once it’s been added, we’ll need to confirm the live stream is actually up and running with all the new configurations. And once we see the thumbnails and statistics, we can then go back to the WebRTC player and start it up. Now, if we look at the clock, we’ll see we’re getting about a two second latency.

To stream near real time at a large scale, contact our sales department here at Wowza and ask about our additional services. Thanks for watching, everybody, and happy streaming.

 

Search Wowza Resources

Categories

Subscribe

Follow Us

Categories

About Justin Miller

Justin K. Miller is the video and webinar producer at Wowza Media Systems. He’s responsible for both the live and recorded productions made to educate, train, and inform customers and live video streaming enthusiasts. When not focused on the many facets of video production, Justin spends his free time watching media, modifying 3D printers, designing terrarium topography, breeding poison dart frogs, and raising his two children Jonathan and Alexis.