HLS Encoder and Video Bitrate Settings for HTTP Live Streaming [2022 Update]
Live streaming is easier and more accessible than ever. Successful live broadcasting requires only a few elements. You need a camera, an encoder, an internet connection, and a video streaming solution. This makes it easier than ever for businesses to start live streaming.
If you’re unfamiliar, an encoder is a software or hardware that interfaces between your camera and a live streaming service provider. An HLS encoder is a tool that uses the HLS streaming protocol to ingest the stream to the video streaming platform. This is one of the more technical components you will need to live stream.
This post will discuss everything you need to know about HLS encoding. We will discuss both HLS encoders and RTMP encoders for HLS streaming. We’ll also take a look at specific encoder settings for HLS streaming.
We will break down each HLS encoder setting to give you a better idea of what is happening behind the scenes. This will allow you to know how to use an HLS encoder, which will allow you to start broadcasting live content.
Table of Contents:
- What is HLS Streaming (HTTP Live Streaming)?
- HLS Encoding with HLS Ingest
- How HLS Works
- Adaptive Bitrate Streaming in HLS
- 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
Let’s dive in and learn more about HLS encoder and video bitrate settings for HTTP live streaming.
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
An HLS stream originates from a server where your media file is stored if you use on-demand streaming or where the stream was created for a live stream. Any ordinary web server can originate the stream.
There are four different processes that take on the server itself where your content is hosted:
- 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: Next, HLS creates an index file. The index file records the order all the small segments created in step two go in.
- Duplicate Segments: Finally, HLS will create duplicate segments at different quality levels, such as 420p, 720p, 1080p, etc. so that viewers can access the video at different quality levels. This is necessary if you are offering adaptive bitrate streaming in HLS.
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 are 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.
Finally, that streaming content reaches your viewers via the 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 actually 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:
|Full High Definition
|Video Bitrate (kbps)
|350 – 800
|800 – 1200
|1200 – 1900
|1900 – 4500
|Resolution Width (px)
|Resolution Height (px)
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 vidoe 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 completely.
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:
|H.264 (x264 may work)
|25 or 30
|2 secs (or 2x frame rate)
|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)
This information will automatically generate 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.
Configuring HLS encoder settings can seem impossible to a beginner. However, it’s quite easy with a little practice. You can follow our recommendations exactly, or just use them as a starting point.
Whichever encoder settings you choose, we do recommend conducting a test stream before your event.
Not yet streaming with Dacast but interested in giving our platform a try? You can take advantage of our 14-day free trial by signing up below. No credit card is required.
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.