How to Live Stream with Apple Low-Latency HLSOctober 28, 2020
Now you can deliver streams in under two seconds using only Wowza Streaming Engine, so users can experience the quality, scalability, and flexibility of traditional HLS — but faster. Watch this video for a step-by-step walkthrough.
Full Video Transcript
Apple Low-Latency HLS allows you to stream live with a sub-three-second latency. I’m going to walk you through the process of setting this up using Wowza Streaming Engine. The first thing you’re going to need is to go to wowza.com and make sure you have the most recent version of Wowza Streaming Engine. Using the downloads link at the top, you can get the most recent version for Windows, Mac, or Linux, and you’re going to want to have version 4.8.5.05 or above for this to work.
Once you have it, and I have a vanilla instance of this running right now on a Windows operating system. You’re going to need to reference this documentation here, deliver Low-Latency HLS live streams using Wowza Streaming Engine. One of the first things it suggests you do, is get an SSL/TLS certificate from the Wowza Streaming Engine StreamLock service. You can open up the link there to walk through the process for this as well.
I’m going to show you how to set this up right now. The main part that I need directly from this documentation is the configuration of the host port. This is the information right here on how to configure it. I’ll need the name being StreamLock, the streaming type, the IP address in asterisks port 443. I’ll need to enable SSL/ StreamLock and I will need this key store pass. I’m just going to grab it right here, right now. Now to get your StreamLock certificate, you’ll want to go back to wowza.com and as long as you’re logged in, from the top you can go straight to my account. And under my account, go to the StreamLock tab. From the StreamLock tab, you can just simply put in your license key for Wowza Streaming Engine, as well as enter the IP address you’ll be referencing and then apply for the certificate.
It does take about an hour or two for it to get set up, but you’ll have the certificate and it’ll appear at the bottom, like so. What you’ll need to do next once you have the certificate, is download the certificate and in the process, you’ll also need to create a password and we’re going to be referencing this when we create the port. So now I’ve done that, and you can see at the bottom, I have the file. I’m going to take the file here and I’m going to move this file into Wowza Media Systems under that Wowza Streaming Engine in the version and within that, the config directory. I’m just going to drag this directly to the config directory and as you can see, there it is. The next thing I need to do is go into my Wowza Streaming Engine installation and under server, we’re going to go to virtual host setup, and we’re going to edit the setup to add a host port.
I’m going to name this, as you recall, before Stream lock type is streaming. IP address is in asterisks. Port is 443 and we’re going to enable SSL/Stream lock and my key store path is that a long URL that they gave me. One thing I’m going to need to change however, in this URL is where it asks for the SSL certificate domain name. For this, I’ll go back to my Stream lock information and I will grab it right there. The host name is exactly what I need. I can now go and paste that in and add the password, which was the password I just created when I downloaded the JKS file and I will add it. Once I’ve done this, I will need to save and then restart the virtual host.
Now that the stream lock certificates setup, I can start the next steps. I’m going to close this for now. The next thing I need to do, is enable Low-Latency HLS in Wowza Streaming Engine XML. And this means I need to go back to that config directory and within it, access the live folder where the application that XML file is, and I’m going to go into the streams tags there and locate LiveStream Packetizers and add that CMAF streaming packetizer. So, let me minimize this and here is the config directory and the folder within it, where the application that XML file is, and I’m going to open this in a text editor and right away I can see the streams tags, and then there’s liveStream packetizers and I’m just going to put this right at the front with the comment after it.
I’ll save that change and if we continue to scroll down, the next thing I need to do is between the liveStream packetizers tags. I need to add these properties for CMAF Low-Latency enable Low-Latency. I’m going to copy that and let’s see if I can find that. It’s not the one that I just made changes to and I need to find it outside of the streams tags, and there it is, liveStream packetizer so there I’m going to replace these properties right here. I’m going to replace that with my new properties and just so I can see where I am and saving that.
I also need to make sure that HTTPStreamer’s has cupertino streaming, which by default it should, but I can just go in and find that, and there it is right there. One other thing I need to do is open up the VHost.xml file and add this between the SSL config. I’m going to add this allow HTTP2. I will go back and locate in the config directory. The VHost opened that up. I’m going to find my SSL config and in there, I’m just going to paste it right in. I’ll save that change.
There are a few optional Low-Latency HLS properties that they state can be changed, but you’re going to actually want to change these specifically the chunk duration, target audio, and chunk duration target video. We’re going to go back to the application .XML file and if you recall under LiveStream packetizer I added in the CMAF low-latency enable Low-Latency property. We’re going to add these properties in the same location. I’m just going to copy what I have there and just repeat it three times. Now I’m going to go in and I am going to add the property names in, and these are going to be integers, as it says, and the values are going to be set to 400. The default is a thousand, but we’re going to want to make it a little lower for lower latency.
As you may notice as well, I have one more property I haven’t set up and that is because we also need to change the advanced Low-Latency HLS property reference. We’re going to grab the name there and as you can see, the type is double, and the value is going to be .8. And those are the changes I am saving right now. Now to make sure these changes get applied we are going to go back into Wowza Streaming Engine and to the live application, we’ll restart the live application and then under server, we’ll go to virtual host setup and we’ll restart the virtual host. Now we can connect the encoder. I’m going to be using OBS Studio here. Hi, and for some of the settings, the most important thing is that we use in output a mode of advanced. The reason I do this is because I want to make sure the key frame interval is set to either one or two, and that we are tuned for low-latency.
Those are the main settings that I care about here. Now I can go up to stream and I can change the service to custom. And I am going to stream to our RTMP://the URL of my wireless streaming engine instance, : the port, which is 1935/live, which is the application instance. And now for the stream key, I’m going to put in my favorite drink. And then for authentication, I’m going to use it, but I didn’t actually set it up yet, which is important to do. I’m going to go over here, open it up, go to server. And I need to set up my source authentication. We have noticed I named it Denver, and that’s exactly what I’m going to name it over here. Now I am going to start my stream, we can see here at the bottom of the stream is active.
If we go back to Wowza Streaming Engine, there is one thing that I realized I’ve forgotten to do, which I need to go to my live application and I need to change things to be low-latency. I’m going to make that change right now, just going to edit it, check low-latency stream and save that information, which does require me to restart. Because I’m restarting, the OBS connection will probably disconnect and then reconnect and that does take a few seconds, but once it’s worked, I should be able to go under incoming streams and see the incoming stream. I’m going to refresh, and there it is. Now that we have everything running with an incoming stream, the next thing I need to do is show the playback using a Low-Latency HLS player. That would be THEOplayer. THEOplayer has this test page, this Low-Latency HLS test page, where you can go in and even test it with a Wowza right here, showing that it’s working.
But what we’re going to do is we’re going to instead insert our own right over here and enter that in. Let’s just verify what we need to enter in and I’m going to go back to the documentation for this. Just so you know, there is this part here to tune for latency. We had just done that because I had forgotten too. We just put that in and that basically was this setup right here, but we did it through Wowza Streaming Engine Manager, as opposed to within the application, that XML file. So now we need to test that playback and its sort of showing the information here. The one thing you should note is when we added that CMAF streaming packetizer, we didn’t remove the cupertino streaming packetizer. So they’re both in there, which means that at the end of the URL we need to create, we need it to have playlist underscore smf4s.m3u8.
Normally it’s just playlist.m3u8, but we need that underscore smf4s so I’m just going to copy that over, but what that’s going to convert is going to be HTTP://the stream lock URL that we got in the beginning /live, which is the application name /mountaindew, which is the stream name /playlist underscore sfm4s.m3u8. So, let’s see that run and I’m going to show both me through the encoder “hello”, as well as a hear through the Low-Latency HLS test page. I’m going to load the stream and play it, probably turn the audio down, rather put it on mute, but there you can see. I’m just going to do a quick freeze frame here, so you can see the sub three-second latency, and that’s pretty much it. If you have any questions, please feel free to contact us at Wowza.