Team Blog

HLS Encoder and Video Bitrate Settings for HTTP Live Streaming [2021 Update]

By Max Wilbert

14 Min Read

banner image featured
author avatar

Max Wilbert

Max Wilbert is a passionate writer, live streaming practitioner, and has strong expertise in the video streaming industry.

Table of Contents

    Share this post

    Table of Contents

      Live streaming is easier and more accessible than ever before. In fact, successful live broadcasting requires only a few elements. You need a camera, an encoder, an internet connection, and a streaming solutions provider.

      If you’re not already aware, an HLS encoder is a piece of software or hardware that interfaces between your camera and a live streaming service provider. Essentially, the task of an encoder is to convert your video from the format created by your camera into a format suitable for live streaming.

      In this post, we’ll discuss everything you need to know about the roles for HLS in broadcasting and how it relates to RTMP. We will also discuss using an HLS encoder vs. an RTMP encoder before we take a look at specific encoder settings for HLS streaming. We will break down each encoder setting to give you a better idea of what is going on behind the scenes.

      Table of Contents:

      • What is HLS Streaming (HTTP Live Streaming)?
      • HLS Encoder for HLS Ingest
      • RTMP Ingest and HLS Streaming
      • RTMP Encoder Settings for HLS Streaming
      • Dacast Encoder Settings
      • RTMP Ingest / HLS Streaming Settings Explained
      • How to Connect Your Encoder to Your OVP
      • Conclusion

      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)?

      HTTP Live Streaming
      HLS is the streaming protocol that fosters compatibility with all devices for live streaming.

      In the past, Flash was the de-facto standard for delivering internet video. However, due to security and power consumption issues, Flash is dead

      HTTP Live Streaming (HLS) has been a major tool that has facilitated the move away from this technology. 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.

      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.

      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 Encoder for HLS Ingest

      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.

      HLS streaming, as we’ve covered, is delivering content to the 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. At this point, HLS is not yet the standard protocol for ingest, the reason being that HLS ingest is not preferred is that there are some latency issues. Since it 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, 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.

      RTMP Encoder Settings for HLS Streaming

      As we mentioned above, most live streams move from the encoder to the online video platform in RTMP format. The streaming platform then transcodes this video into HLS. In this article, we’ll look at settings for your RTMP-capable encoder.

      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 is free encoding software 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, the following encoder settings will work to get your HLS streaming up and running.

      With that context in mind, let’s dive into the nitty-gritty.

      Dacast Encoder Settings

      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.

      RTMP Ingest / HLS Streaming Settings Explained

      Although we’ve laid out the encoder settings above, understanding them 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. Video and Audio Codec

      Codec is the shorthand for “coder-decoder,” and it is the technology that makes encoding possible. 

      The video codec that you should use is H.264. You may also see an X.264 option; this is simply another implementation of the same protocol. 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. Video Resolution

      video resolution
      Resolution refers to the size of your video in pixels.

      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:

        ULD LD SD HD FHD
      Name Ultra-Low Definition Low Definition Standard Definition High Definition Full High Definition
      Video Bitrate (kbps) 350 350 – 800 800 – 1200 1200 – 1900 1900 – 4500
      Resolution Width (px) 426 640 854 1280 1920
      Resolution Height (px) 240 360 480 720 1080
      H.264 Profile Main Main High High High

      Most of the time, you’ll want to broadcast in the highest available resolution. However, higher-resolution video requires more bandwidth to deliver. HD streaming also requires more bandwidth for the viewer to access.

      As a result, most broadcasters choose to broadcast in multiple resolutions and multiple bitrates. Multi-bitrate streaming allows viewers to be served as the best possible quality video. 

      Check out our tutorial on how to set up multi-bitrate streaming for more information.

      3. Video and Audio Bitrates

      We’ve already introduced the word bitrate, but what does it mean?

      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 – 800 kbps
      • 480p: 800 – 1200 kbps
      • 720p: 1200 – 1900 kbps
      • 1080p: 1900 – 4500 kbps

      Audio bitrates are simpler. We recommend always using at least 128 kbps and an audio sample rate of 48 kHz (48,000 Hz).

      4. Internet Speed and Bandwidth Requirements

      video bandwidth requirements
      Reliable internet is a must for online video streaming.

      When selecting resolution and bandwidth for your live stream, your internet speed is an important consideration. 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.

      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, although it’s not a make or break issue.

      6. Frames Per Second (FPS)

      frames per second fps
      “Frames per second” is exactly what it sounds like: it is how many frames are streamed each second.

      “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.

      7. Keyframe Interval

      Keyframe interval, which is 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).

      How to Connect Your Encoder to Your OVP

      With this information in mind, it is time to connect your encoder to your OVP. 

      Generally, this requires gathering a few pieces of information. With Dacast, this necessary information includes:

      • Stream name
      • Stream URL
      • Log in code (unique for each stream)
      • Password

      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.

      Conclusion

      hls encoder
      It is important to properly configure your encoder for HLS stream and RTMP ingest.

      Configuring 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 a Dacast client but interested in giving our platform a try? You can take advantage of our 30-day free trial by signing up below. No credit card required.


      GET STARTED FOR FREE

      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 tips on live streaming, as well as exclusive offers, we also invite you to join our LinkedIn group.

      author avatar

      Max Wilbert

      Max Wilbert is a passionate writer, live streaming practitioner, and has strong expertise in the video streaming industry.

      Sign up for a 30-Day trial.

      Read Next

      article featured
      article featured
      article featured

      Team Blog

      Mobile Live Streaming: How to Broadcast from a Smartphone

      author avatar

      Emily Krings

      15 Min Read