How to Create a Live HLS Feed With HEVC

Article Featured Image

In addition, rather than simply being able to add an audio file to the preset at this stage, you have to create an audio output using the same stream name as the video output. In our example, once we get the hybrid streams created for the fMP4 application, we must build the H.264 streams for the leg application. Whether you’re building one or two groups of streams, budget time here to make sure you get things right.

Step 4: Create the Adaptive Groups and Choose the First Stream

In the previous step, we created streams for each application. Now we have to create an adaptive group for each application. You’ll accomplish this in the Live streams Settings screen shown in Figure 6, which you’ll access by clicking Nimble Streamer > Live streams. Once you get there, you’ll have to click the Server IP button on the lower left to open the streams. From there, you can click any of the boxes in the schematic to view the streams contained therein.

Figure 6. Here are the two ABR groups. You access this screen by clicking the white “Adaptive stream” box on the upper right of the schematic. 

For example, click the white “Adaptive stream” box on the upper right to open the screen shown in Figure 6. Note that I’ve already created the two adaptive bitrate (ABR) groups, the abr_fmp4 group comprised of H.264/HEVC streams, and the abr_leg group comprised solely of H.264 files.

The Live Stream Settings screen is a busy screen where you access lots of information. Click the blue “Incoming streams” box on the upper left and you’ll see all incoming streams and their sources. Click the green, orange, or purple “Outgoing stream” boxes and you’ll see all outgoing streams and their bandwidths and codecs. Again, click the white “Adaptive stream” box to see the adaptive groups you’ve created, which is what you see on the bottom of Figure 6.

Click “Add ABR setting” to add an adaptive group, or the wrench on the right to edit an existing group, which you can see in Figure 7. Operation is simple: to add streams, click the blue text “Add source,” which opens another line where you enter the source application name and the source stream name. If you click the blue text “Advanced settings,” you see the streams sorting drop-down menu, which lets you choose which stream appears first in the master manifest file (the first file retrieved by the viewer). I chose “Manual—as defined in list” and specified the 1.5Mbps 720p file first, which is a bit lower than the 2Mbps file that Apple recommends.

Figure 7. Creating the adaptive group 

The first few seconds of video retrieved by the viewer can have a huge impact on QoE; choose a file that the client can’t easily retrieve and it can start a torrent of stream switching until the player reaches stasis. Choose too low and the viewer gets several seconds of ugly video, creating a bad first impression. This is definitely one of those areas where it pays to follow Apple’s best practice recommendation.

Once you’ve created the adaptive group, you’re done from a stream-configuration perspective. Now it’s time to configure the on-site encoder.

Step 5: Configure the Encoder and Point to Server

Figure 8 shows the configuration screen for Vitec’s MGW Ace encoder. The unit accepts HDMI and HD-SDI input, and can output HEVC and H.264. At Vitec’s recommendation, we broadcast a 4Mbps HEVC stream (see the Bit-Rate setting on the upper right), which provided sufficient 1080p quality while leaving plenty of overhead for outbound bandwidth. On the right, you can see that we’re transmitting a transport stream via UDP to the target address and port. Note that we needed to change the TTL setting to 128 to give the packets time to reach the encoder. Once accomplished, the encoder connected to Nimble without any problem.

Figure 8. The MGW Ace encoding configuration screen 

All live streaming benefits from using a secure and error-correcting protocol. Unfortunately, our encoder/transcoder combination couldn’t agree on a protocol, with Vitec supporting Zixi and Nimble supporting the open source Secure Reliable Transport (SRT) protocol. It wasn’t a problem for us because our internet connection was solid, but if you’ll be broadcasting over 4G or another less-solid connection, consider finding an encoder that supports SRT.

With all transcoding products and services, you’ll perform lots of testing and debugging to make sure the streams are operational, and you may not want to run your encoder during this process. One great tip I got from Softvelum technical folks was using FFmpeg to send a disc-based stream to the server. Specifically, with the command that follows, you’re telling FFmpeg to send the longvideo file (-i longvideo.mp4) at its native frame rate (-re) without transcoding (-codec copy) in the MPEG transport stream format (-f mpegts) to the UDP address/port of the server (udp://54.152.90.48:26500).

- ffmpeg -re -i longvideo.mp4 -codec copy -f mpegts udp://54.152.90.48:26500

I encoded a longvideo file that I used frequently during testing to HEVC at 4Mbps, saving many hours of operation on the Vitec encoder and source camera.

Once you have a stream running, either a file or live stream, it’s time to test your output.

Step 6: Check Output

Return to the Live Streams settings screen by clicking Nimble Streamer > Live streams. Click the Server button on the lower left to select it, and then the green “Outgoing stream” box. Locate a stream that’s encoded with H.264, since HEVC playback is sketchy on most browsers. Then click the question mark next to that video, which opens the Sample URL for Player window. In the middle of that box, you’ll see a text link for “Play this stream on WMSPanel stream testing page.” Click that to open the screen shown in Figure 9. Then click Play on the upper right to play the stream.

Figure 9. Previewing the 480p H.264 stream 

If everything is properly configured, you should be rewarded with crisp video and audio.

Step 7: Grab the URL for the Master M3u8 file

Now we need to return to the screen shown in Figure 6 to grab the URL for HLS distribution. To do so, click Nimble Streamer > Live streams, then click the Server button on the lower left. Then click the “Adaptive stream” box on the upper right. This will open the Sample URL for Player page shown in Figure 10.

Figure 10. I couldn’t test the stream inside the WMSPanel because none of the supported players were compatible with Apple’s newest HLS format. 

Ordinarily, this page is a great feature of the Nimble Streamer, since it lets you view the video in all of the players shown in the drop-down list on the bottom. Using the top drop-down list, currently showing the master manifest for the fragmented MP4 stream, you can also view files using any of the other formats selected in Figure 1. Unfortunately, none of the players currently supported can play the hybrid H.264/HEVC stream, which is why you’re seeing the error message in Figure 10.

The bottom line during my testing was that I couldn’t preview the hybrid stream within Nimble Streamer; I had to copy the playlist URL and paste it into an email (or create a bit.ly link) to test it on a Mac or iPhone/ iPad that was compatible the hybrid stream. That’s not a big deal because you’re going to want to do that anyway, and because by the time you read this, Nimble Streamer should add JW Player version 8 to the WMSPanel testing, which reportedly can play the newer HLS format [Note: JWP 8 was added prior to publication].

I tested playback on my iPhone 6 upgraded to the iOS 11.2.1, and the video played fine (Figure 11). When testing on a Mac Pro that was not upgraded to High Sierra, so therefore couldn’t play HEVC, the HLS presentation loaded, but froze on the first displayed frame. The stream also wouldn’t play on Microsoft Edge, which plays HLS natively. These incompatibilities were expected, but highlight the point that you'll need two sets of streams to continue to serve legacy endpoints.

Figure 11. Here’s the hybrid HEVC/HLS presentation playing on an iPhone 6 updated to iOS 11.2.1. 

With the legacy stream, I could test within Nimble Streamer, and the stream played fine on both the older Macintosh and Microsoft Edge. So Nimble Streamer was able to produce the two sets of streams, but you’ll be in charge of routing them correctly to the proper endpoints.

Step 8: Check Server CPU Use

Click Servers from the WMSPanel main menu, and then select the server, and you’ll see the screen shown in Figure 12. Obviously, this shows that we had plenty of overhead on the Amazon instance, so we could either push more streams or rent a cheaper cloud computer.

Figure 12. Encoding and creating the two adaptive groups left plenty of resources to spare. 

So that's it. Deploying HEVC via HLS should be a low-risk technique for reducing bandwidth costs and/or allowing viewers on slower connections to view higher-resolution streams. That said, this approach is still new enough that you shouldn't deploy without substantial compatibility and performance tests on all relevant Apple platforms. In addition, at least in the short term, most producers must continue to offer H.264-only streams in MPEG-2 containers to serve legacy Apple devices and other platforms that don't support either HEVC playback or fmp4 containers. 

[This article appears in the Spring 2018 issue of Streaming Media European Edition.]

Streaming Covers
Free
for qualified subscribers
Subscribe Now Current Issue Past Issues
Related Articles

How to Implement Low-Latency HLS (LL HLS)

Rather than focusing on random tasks, this tutorial will walk you through the fundamentals of encoding for low latency HLS with FFmpeg, OBS, Mux Video, and THEOplayer

HEVC, AV1, VVC: How to Make Sense of 2019's World of Codecs

The old realities that used to dictate codec adoption no longer apply. Opening up new markets now matters more than reducing operating expenses. How are HEVC, AV1, and VVC positioned for the future?

How to Live Stream to Multiple Destinations

Reaching multiple viewing platforms with a single live video stream used to be impossible, but not anymore. Here's how to do it with Switchboard Cloud.

Life After Flash: Will Producers Move to HLS, DASH, or Both?

While it's clear that Flash's time is coming to an end, it's less clear what will replace it. A survey shows DASH support, but its real-world use is around one percent.

HLS Was the Topic du Jour at IBC

Streaming protocols are getting people talking and the buzz is loudest about Apple HTTP Live Streaming.

Companies and Suppliers Mentioned