Publishing an HTTP Live Stream
What is HTTP Live Streaming?
HTTP Live Streaming, also known as HLS, is a technology used for streaming live and on demand content using the HTTP protocol. HLS is adaptive in that it determines the optimal playlist to deliver to a client based on their available bandwidth. This means that a client who is accessing content over a cellular network will receive a lower quality version of that content while a client accessing the same content over a high speed network will receive a higher quality version. This allows for clients with varying bandwidths to access the same media without having to wait for it to buffer. See our article HTTP Live Streaming for a more detailed explanation of HLS.
This article however will step through the process of publishing an HTTP live stream and how you can deliver it through KeyCDN for an even faster live streaming experience.
Creating an HLS with media broadcasting software
Specialized media broadcasting software exists for streaming live or on demand content. Three popular companies that provide these services are Zencoder, Wowza, and Azure Media Services.
Zencoder
Zencoder is a cloud-based video and audio encoding solution. It can be used for on demand and/or live video encoding and has the ability to scale very easily. They aim to deliver the fastest encoding speeds and also support HLS. Visit their documentation on how to get started using Zencoder with S3. The stream URL will be needed to accelerate the stream via KeyCDN as outlined in the "Delivering HLS content with KeyCDN" section below.
Wowza
Wowza streaming engine, developed by Wowza Media Systems is a media streaming software that is used for the streaming of live and on demand video, audio, and rich Internet applications. With options to deploy on-premise or in the cloud and with key features such as HQ streaming, unlimited transcoding, any media to any device, etc. it allows for flexibility and customization. Wowza supports many standard streaming protocols including HLS, RTMP, HDS, MPEG, etc.
Azure Media Services
Azure Media Services provides an integrated HTTP-based media platform that allows users to stream live and on demand events similar to Wowza. Azure Media Services also supports the delivery of HLS streaming. They have written a detailed article about how to use Apple HTTP Live Streaming with their media services. The article walks through the configuration of their IIS Live Smooth Streaming extension that will "transmux" (repackage) the incoming MP4 fragments and ultimately generate a .m3u8
file for HLS delivery.
These software providers are an integral part in enabling you to deliver an HLS stream. For example, if you are producing a live RTMP streaming and want to deliver it through HLS, the stream must first be transmuxed by software such as Zencoder, Wowza, or Azure Media Services.
Delivering HLS content with KeyCDN
You can use KeyCDN's video CDN to help supercharge your HLS live stream by creating a Pull Zone and enabling Optimize for HLS. In order to set up an HLS live stream and begin delivering it through KeyCDN you must follow these steps.
- Create an HLS live stream. This will consists of an index file (
.m3u8
) and the video sequences files (.ts
). A URL will be created that is pointing to the HLS stream. To complete this step, you may need to use media broadcasting software as mentioned above. - Create a Pull Zone in the KeyCDN dashboard. Take the URL created in step 1 and insert it as the Origin URL for the Pull Zone.
- Go to the Zone settings and update the Optimize for HLS setting to
enabled
.
Your HLS live stream is now optimized and will be delivered through the KeyCDN edge servers allowing for an even faster live streaming experience.
What to do when the live stream is not caching?
Each POP consists of several servers and each server is building up its own cache. It's possible to have several responses as a MISS before having a HIT, this is normal.
Depending on the Wowza configuration, Wowza might generate a different file name for each request. In this case, the Wowza setup needs to be changed. Below is an example of a Wowza configuration generating different file names:
first:
#EXT-X-MEDIA-SEQUENCE:3756
#EXTINF:9.239,
media_w1319856166_3756.ts
#EXTINF:12.12,
media_w1319856166_3757.ts
#EXTINF:7.919,
media_w1319856166_3758.ts
second:
#EXT-X-MEDIA-SEQUENCE:3758
#EXTINF:7.919,
media_w1531339654_3758.ts
#EXTINF:12.119,
media_w1531339654_3759.ts
#EXTINF:7.477,
media_w1531339654_3760.ts