HLS Encoder and Video Bitrate Settings for HTTP Live Streaming [2024 Update]
Live streaming is more prominent and accessible than ever. With ever-increasing popularity, live-streaming video content can prove a lucrative strategic move for businesses. However, live-streaming video content requires the right set-up to do it properly so viewers tune in.
Fortunately, starting a successful live stream requires only a few important elements. For live video streams, you need a camera, an encoder, an internet connection and a high-quality video streaming solution. If you’re unfamiliar, an encoder is software or hardware that interfaces between your camera and a live streaming service provider. Furthermore, an HSL encoder is a tool that uses the HLS streaming protocol to ingest the video files and stream them to the live video streaming platform. This is a particularly technical component which requires sound knowledge and guidance.
This post will help enlighten this process. In this article, we cover everything you need to know about HLS encoding. We’ll discuss HLS encoders and RTMP encoders in the context of HLS streaming. Also, we’ll look at specific encoder settings for HLS streaming. We’ll then break down each HLS encoder setting so you can get a better understanding of all the inner workings. By the end, you’ll be well-equipped to begin turning mere video and audio data into winning live streams.
Let’s dive in and learn more about the HLS encoder and video bitrate settings for HTTP live streaming.
Table of Contents:
- What is HLS Streaming (HTTP Live Streaming)?
- How HLS Works
- Retain Backlinks with M3U8 Files
- Adaptive Bitrate Streaming in HLS
- HLS Encoding with HLS Ingest
- RTMP Ingest and HLS Streaming
- 7 HLS Encoder Setting Configurations to Consider
- RTMP Encoder Settings for HLS Streaming
- How to Connect Your Encoder to Your OVP
- Conclusion
What is HLS Streaming (HTTP Live Streaming)?
In the past, Flash was the de-facto standard for delivering internet video. However, due to security and power consumption issues, Flash has been phased out. The reason that Flash is now obsolete is that it was not compatible with the operating systems of many mobile devices.
HTML5 video players have since replaced it. Access to an HTML5 video player via HLS streaming makes it possible to stream to iOS, Android, desktop browsers, and a variety of other internet-connected devices. HLS streaming is possible due to HLS encoders.
HTTP Live Streaming (HLS) has played a major role in the move away from Flash. HLS was developed by Apple to deliver content to an HTML5 video player. This protocol is an adaptive bitrate streaming protocol that makes it possible to transport videos over the internet. Adaptive bitrate means that it can deliver content at different quality levels, such as 480p, 720p, or 1080p, depending on the content quality of the original video and the end user’s internet connection.
HTTP live streaming (HLS) is used for both on-demand and live streaming, despite the term “live” in the name. HLS takes large video files and breaks them into smaller downloadable HTTP files, which then allows them to be delivered using the HTTP protocol.
Due to its ultra-compatibility, the HLS streaming protocol dominates the market today. It is the safest bet to deliver your stream to any viewer on any device. That’s why Dacast and most other major online video platforms deliver online streams in HLS format. HLS streaming is the standard method for sharing videos online.
How HLS Works
HTTP Live Streaming (HLS) is a widely used protocol for delivering video content over the internet, offering both on-demand and live streaming capabilities. The HLS streaming process involves several key steps:
- Encoding: HLS uses H.264 or H.265 encoding. The video data is reformatted using one of these two encoding methods so that other devices can recognize and interpret the data.
- Segmenting: The video is split into small segments. The average length of each segment is 6 seconds, although it can vary. This makes the content easier and quicker to transmit.
Index File Creation: An index file, known as a playlist or M3U8 file, is generated. This file lists the sequence of video segments and provides the necessary information for playback.
- Duplicate Segments: To accommodate varying network conditions and device capabilities, duplicate segments are created at different quality levels (e.g., 480p, 720p, 1080p). This allows the streaming client to switch between quality levels dynamically, ensuring an optimal viewing experience, especially if you are offering adaptive bitrate streaming in HLS.
Retain Backlinks with M3U8 Files
The M3U8 playlist file plays a crucial role in HLS streaming. It organizes and sequences the multimedia files for playback, guiding the video player to locate and retrieve the appropriate video segments. Additionally, M3U8 files can incorporate security tokens, which are essential for enforcing access controls such as password protection and viewing restrictions. These tokens regularly communicate with the streaming server to verify permissions, thereby safeguarding your content and supporting monetization efforts.
By implementing HLS with M3U8 playlists and security tokens, you can deliver high-quality, adaptive streaming experiences while maintaining robust content protection measures.
Adaptive Bitrate Streaming in HLS
One of the most significant advantages of working with HLS over other streaming protocols is adaptive bitrate streaming. With adaptive bitrate streaming, the video quality will adjust automatically, without the end-viewer doing anything, if the viewer’s network quality changes.
For example, if the user’s network slows down, the video player will detect this, and the adaptive bitrate streaming technology will lower the quality of the stream. The video will not stop playing or experience buffering; the video quality will drop to a lower tier to ensure the viewer can continue to watch your content.
Or, if more bandwidth opens up on the user’s network, the video stream quality will increase. This also happens automatically, without the user having to do anything. With adaptive bitrate streaming, the quality of the video will automatically increase.
Adaptive bitrate streaming works because HLS creates duplicate segments, as explained in step four agave, of the stream at different quality levels when it segments. This allows the video player to automatically switch between the different quality segments without the end-user having to do anything.
This allows you to provide the viewer with a better overall viewing experience.
HLS Encoding with HLS Ingest
HLS streaming is used to deliver video content to an HTML5 video player. HLS ingest, however, refers to ingesting content to the encoder from the camera or other media source.
If you are using HLS for ingesting, you must use an HLS encoder. An HLS encoder is a tool that is used for encoding with HLS ingest. HLS ingest and HLS streaming is two different functions and should not be confused.
At this point, HLS is not yet the standard protocol for ingesting. That is because HLS ingest has some latency issues. Since HLS is not the primary protocol for this role, HLS encoders are a bit difficult to come by.
RTMP Ingest and HLS Streaming
RTMP ingest paired with HLS streaming is currently the most optimal streaming setup for a few reasons. This duo gives you access to the compatibility and security of HLS and the low latency and accessibility of RTMP.
The Dacast online video platform, for example, uses the RTMP for ingesting live streams. From there, our platform converts that live video content into the HLS streaming protocol
Finally, streaming content reaches your viewers via top-tier CDNs such as Akamai and Limelight. Unlike RTMP, HLS is compatible with most browsers and devices with no need for the Flash plugin.
Since RTMP is the standard, RTMP encoders are affordable and readily accessible.
7 HLS Encoder Setting Configurations to Consider
The way you configure your settings will affect the outcome of your stream. That said, understanding HLS encoder configurations on a more technical level gives you better insight as a broadcaster.
Let’s take a look at what each of these terms means and how they relate to streaming.
1. Best HLS Codec Options
Codec is the shorthand for “coder-decoder,” and it is the technology that makes encoding possible. In live streaming, you’ll use both audio and video codecs
The H.264 video codec is currently the most efficient for HLS streaming. The X.264 codec is another implementation of the same protocol, so it is also a viable option. You can use either one. In some cases, X.264 may use less processing power, but the difference is rarely significant.
There is one additional detail to keep in mind. The H.264 standard is a family of standards, which are called “profiles.” There are a lot of these profiles, but you only need to worry about two.
If you’re streaming in 720p resolution or lower, with a video bitrate of 350-800 kbps, use the “Main” protocol. If you’re streaming in 1080p full HD, with a video bitrate of 800-4500 kbps, use the “High” protocol.
As for the best audio codec, you should select AAC or AAC-LC.
For more details on codecs, check out our comprehensive guide to video transcoding
2. HLS Resolution Settings and Video Quality
Video resolution is simply the size of your video, measured in pixels. You can choose from the ultra-low definition, low definition, standard definition, high definition, and full high definition.
The most common video frame sizes today are:
ULDLDSDHDFHDNameUltra-Low DefinitionLow DefinitionStandard DefinitionHigh DefinitionFull High DefinitionVideo Bitrate (kbps)350350 – 800800 – 12001200 – 19001900 – 4500Resolution Width (px)42664085412801920Resolution Height (px)2403604807201080H.264 ProfileMainMainHighHighHigh
High-resolution streaming requires a fast internet connection. When the conditions are right, higher resolution typically equates to higher quality.
That’s why, most of the time, you’ll want to broadcast in the highest available resolution. Since streaming in high resolution requires faster internet, most broadcasters choose to broadcast in multiple resolutions and multiple bitrates to accommodate viewers with all different internet speeds. That way, every viewer will have the best possible resolution for their situation.
That is where HLS bitrate settings and multi-bitrate streaming come into play. Check out our tutorial on how to set up multi-bitrate streaming for more information.
3. HLS Bitrate Settings
Bitrate refers to the amount of data in your video/audio streams per unit of time. This is measured in Kilobits per second (kbps) or Megabits per second (Mbps). One Mbps is equal to 1000 kbps.
Higher video resolution requires more data. To give you a rough sense of the numbers, a low-quality 240p live stream might require around 400 kbps. A full HD 1080p live stream usually requires 4-8 Mbps. Here are some recommended video bitrates at various resolutions:
- 240p: 350 kbps
- 360p: 350 to 800 kbps
- 480p: 800 to 1200 kbps
- 720p: 1200 to 1900 kbps
- 1080p: 1900 to 4500 kbps
The requirements for bitrate for 720p are less than they are for higher resolutions. The amount of bitrate required increases as the resolution of the video increases
Audio bitrates are simpler. We recommend always using at least 128 kbps and an audio sample rate of 48 kHz (48,000 Hz).
Multi-bitrate streaming allows viewers to be served as the best possible quality video for their situation. Check out our tutorial on how to set up multi-bitrate streaming for more information.
4. Internet Speed and Bandwidth Requirements
In general, we recommend that your upload speed be roughly double the total combined bandwidth of your video and audio. If you’re streaming in multiple bitrates, you should consider the total bandwidth of all combined streams. Multiple bitrate streaming requires a stronger internet connection on your end.
Attempting to stream too much data on an internet connection that isn’t fast enough can cause your live stream to fail.
To select the correct bit rate, divide the sustained upload speed of your internet connection by two. This is the amount of bandwidth you have to play with. For example, a 10 Mbps upload speed would give you 5 Mbps of bandwidth.
In this case, we recommend sending out a multi-bitrate stream with the following settings:
- 720p stream at 2.5 Mbps
- 480p stream at 1 Mbps
- 360p stream at 500 kbps
- 240p stream at 300 kbps
This would ensure that a reliable stream will be available to both people with a fast internet connection and a slow one.
5. CBR vs. VBR
CBR refers to “Constant Bitrate,” and VBR means “Variable Bitrate.” Encoder settings will often include a toggle for CBR to VBR for both audio and video.
Constant bitrate is simple. With this setting, streams use the same amount of data regardless of the contents of the stream at any given time.
In contrast, VBR takes into account the contents of your stream. If, for example, a segment of the video contains a lot of fast-moving action, the bitrate will temporarily increase. This increases perceived quality. However, in some situations, it can also cause excess load on your internet bandwidth.
In general, we recommend using VBR for the best results. However, CBR will suffice.
6. Frames Per Second (FPS)
“Frames per second” is another aspect to consider as you configure your encoder settings. Simply put, most users should generally set frames per second (fps) at 30. For people in certain regions of the world, however, 25 frames per second are standard.
However, 30 fps will work anywhere. If you are broadcasting sports or another fast-action video, 60 fps may be preferable. Be aware that it may take a higher bit rate to make these videos look high-quality. 1080p60 bitrate will be higher than needed for a 1080p stream.
7. Keyframe Interval
Keyframe interval, which is also referred to as “keyframe frequency” by some encoders, is the frequency that the full image on the screen changes.
When broadcasting over the Dacast OVP, users should always set the keyframe interval to 2 seconds (or 2x frame rate).
RTMP Encoder Settings for HLS Streaming
At this time, RTMP encoders are still the most common type of encoder for HLS streaming due to their widespread compatibility with other components of the streaming process.
RTMP encoders come in a wide variety of types. The simplest is software encoders, which users can install on a smartphone, tablet, or computer just like any other app. There are free live-stream encoders available, as well as highly complex and expensive suites.
Additionally, there are hardware encoders for use with live streaming. These are well suited for mobile streaming, studio use, and professional-grade settings. On the other hand, hardware encoders do require more know-how than simple encoder settings for encoding software
Regardless, RTMP encoders are all configured in the same basic manner. Whether you are using a hardware encoder or a software encoder, it is important to follow the required settings for your online video platform.
Required Encoder Settings for Dacast
Dacast requires specific encoder setting configurations to ensure that the platform works properly and produces the highest quality of content.
The following settings are required for live streaming with Dacast, regardless of your selected resolution and bitrate:
- VIDEO CODEC: H.264 (x264 may work)
- FRAME RATE: 25 or 30
- KEYFRAME INTERVAL: 2 secs (or 2x frame rate)
- SCANNING: Progressive
- RATE CONTROL: Constant (CBR)
- AUDIO CODEC: AAC-LC
- AUDIO BITRATE: 128 kbps
- AUDIO CHANNELS: 2 (Stereo)
- AUDIO SAMPLE RATE: 48 kHz (48,000 Hz)
For more information on Dacast’s preferred and required encoder settings, please check out our dedicated Knowledgebase article
How to Connect Your Encoder to Your OVP
Now that you are familiar with the most common HLS encoding settings, it is time to connect your encoder to your streaming solution.
The exact encoder configuration process varies depending on which encoder you’ve chosen and the streaming solution you’re using. However, the process typically requires gathering a few credentials to connect the two tools.
For example, with Dacast, the required credentials include
- Stream name
- Stream URL
- Log-in code (unique for each stream)
- Password
This information will automatically be generated when you create a new channel within your Dacast account. To access this info, navigate to the “encoder settings” portion of a live channel, and select the requisite RTMP encoder from the list.
For a detailed walkthrough on how to set up your encoder with Dacast, please check out our dedicated encoder setup tutorial
Conclusion
Properly configuring HLS encoder settings can be incredibly daunting at first. The language can seem too technical and abstract. However, with clear instructions and expert guidance, as we’ve provided, you too can get up and running in no time.
We recommend conducting a live-streaming test to ensure your live-streaming tools work correctly. Your video codec, video quality, bitrate settings and everything else must be aligned and in-check. If you follow our technical and live-streaming guidance, you can quickly set up a successful livestream.
Finally, you should know about Dacast. Dacast is a professional-grade live-streaming platform that will get you up and running, fast. Using Dacast you can set up the perfect live stream that your audience will appreciate. It’s flexible and works seamlessly with HLS, ensuring the highest quality live streaming.
You can try Dacast completely free with our 14-day free trial.
Start streaming now
Any questions? Let us know in the comment section below! We love to hear from our readers and will respond as soon as we can.
For regular live-streaming tips and exclusive offers, you can join our LinkedIn group