Streaming video has become a major source of entertainment in the past few years and it has become a major consumer of internet usage across the world. With so many people tuning into their favourite movies and TV shows worldwide, streamers & content providers should know how to avoid common mistakes when using the popular HLS (HTTP Live Streaming) protocol for streaming their videos.
HLS, short for HTTP Live Streaming, is a popular video streaming protocol due to its versatility and broad compatibility. It segments videos into small chunks that can be easily downloaded and played back on various devices and platforms, providing a seamless streaming experience. Additionally, HLS adapts to varying network conditions, adjusting the quality of the video in real-time to ensure smooth playback and minimize buffering issues for viewers (also known as ABR streaming).
In this post, we will explore a few mistakes that you can avoid when streaming video with the HLS or HTTP Live Streaming protocol.
Table of Contents
Mistake 1: Choosing the wrong HLS Segment Size
In ABR video streaming protocols like HLS, videos are divided into segments or chunks of equal length for smooth playback. During this packaging process, you have the option to determine the segment duration. While some companies opt for shorter durations like 2 seconds, others prefer 4, 6, or 10 seconds. However, the right choice depends on your specific requirements.
Opting for shorter 2-second segments may lead to more frequent requests from the player to the CDN, potentially inefficiently using caching capabilities.
On the other hand, selecting a very long segment size, such as 10 seconds, means the player will require more time to download each segment due to its larger size. This can introduce fluctuations during segment download, leading to buffer underflow and interrupted playback (what is buffering?).
To ensure optimal video delivery, it is essential to choose the appropriate value for the segment size parameter. Careful consideration is key to avoid adverse effects on your streaming experience. So, choose wisely! 🙂
Mistake 2: Failing to Verify Server HTTPS Certificate Before Streaming
Verifying your server’s certificate before publishing a live stream is crucial to maintaining secure communication between the server and clients. Without proper verification, external users may gain access to unencrypted content by intercepting traffic during the connection or along its path.
To avoid this common mistake, follow these steps:
- Download your server’s certificate from the website of the issuing Certificate Authority (CA).
- Verify that all the fields on the certificate match what you remember seeing during the server configuration and installation process. If any discrepancies arise, contact the server certificate provider promptly.
By verifying your server’s HTTPS certificate, you safeguard the integrity and security of your content exchange. Don’t overlook this important step!
Mistake 3: using a non-compliant HLS Video Player
The choice of an HLS-compliant video player significantly impacts your streaming experience. HLS is designed to establish regular connections with servers at specific intervals (determined by the segment size) to download new content. However, intermittent network connections can hinder this connection.
Most browsers do not provide alerts when such issues occur, resulting in a poor user experience characterized by a black screen. In contrast, HLS-compatible browsers like Safari will alert users when there are problems connecting to the server.
To ensure seamless playback across devices and browsers, thoroughly test your streams in various environments, including older versions of browsers. By using an HLS-compliant video player, you enhance compatibility and improve the overall user experience.
Go here for a list of HLS-compliant test players to test with.
Mistake 4: Neglecting Fairplay Streaming DRM for HLS
Fairplay Streaming (how does Fairplay Streaming work?) is the most common Digital Rights Management (what is DRM) system used for HLS streams. Implementing Fairplay DRM is essential to maintain the security of content exchanged between the server and clients.
Without appropriate measures, external users may gain access to unencrypted content by intercepting traffic during the connection or along its path. You can implement it yourself or choose a vendor. If you don’t know how to evaluate a vendor, check our our Buyer’s Guide to DRM for tips.
Mistake 5: Streaming at Low Resolutions
Resolution plays a vital role in video quality. Pixels are the smallest individual units on a screen, and higher resolutions offer more pixels, resulting in a clearer picture, especially on HD or higher-quality monitors.
HLS streams can be generated in various resolutions, such as 1080p, 720p, and 640p. However, streaming low-resolution variants, like 640p, on an HD monitor will lead to a blurry video. So, its vital to deliver the right quality stream to the right device.
To provide viewers with a high-quality viewing experience, ensure you produce high-resolution variants compatible with the display capabilities of your target audience.
Avoid compromising on resolution and prioritize delivering clear and crisp videos.
Read about the differences between bitrate and resolution here.
Mistake 6: Not using a CDN to serve content.
A CDN is crucial for HLS streaming because it can offload the load on your origin server and serve content to viewers from a location close to their current geographical position. CDNs crucially prevent the famous “Thundering Herd” problem in video and content delivery.
Using a CDN typically results in faster loading times, fewer interruptions or buffering during playback, and access to a video that may not be available locally.
Being an HTTP-based protocol, it is easy to set up a CDN and HLS streaming with any CDN service provider.
Mistake 7: Neglecting a large video startup time
If your video player takes too long to load the first segment of video or connect with the server, it may time out and stop loading content. Such delays (also know as video startup time or startup delay) can happen if there’s a problem in fetching the content from the origin server or if too much data being used and the device has reached its maximum bandwidth.
A few ways to avoid this or arrive at the root cause are –
- fetching a low resolution to start off the playback
- inspecting your CDN logs to see if there have been any excessive cache misses or a low hit-ratio.
- pre-warm your caches if its an important event or movie release.
For more information, check out this detailed article on video startup time and how to reduce it.
There are several things that can go wrong while streaming with HLS, but, careful preparation and groundwork can help you avoid these. If you have more tips, feel free to message us and we’ll add them to this list.
Until next time, happy streaming!
Krishna Rao Vijayanagar
Krishna Rao Vijayanagar, Ph.D., is the Editor-in-Chief of OTTVerse, a news portal covering tech and business news in the OTT industry.
With extensive experience in video encoding, streaming, analytics, monetization, end-to-end streaming, and more, Krishna has held multiple leadership roles in R&D, Engineering, and Product at companies such as Harmonic Inc., MediaMelon, and Airtel Digital. Krishna has published numerous articles and research papers and speaks at industry events to share his insights and perspectives on the fundamentals and the future of OTT streaming.