Encoder Settings for HLS Live Streaming

encoder settings

In 2019, 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. In this article, we’ll focus choosing the right encoder settings, especially for HLS streaming.

If you’re not already aware, an 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 transform your video from the format created by your camera into a format suitable for live streaming.

The most common format for this stream ingestion: RTMP. The DaCast OVP uses RTMP protocol for ingesting live streams. From there, our platform transcodes that live video content into the HLS streaming protocol. Finally, that streaming content reaches your viewers via the top-tier Akamai CDN. Unlike RTMP, HLS is compatible with most browsers and devices with no need for the Flash plugin.

Now, let’s dive in and learn more about HLS and encoder settings.

About HLS streaming (HTTP Live Streaming)

In decades past, Flash was the de-facto standard for delivering internet video. However, due to security and power consumption issues, Flash is being discontinued. Today, HTTP Live Streaming (HLS) can deliver streams for iOS, Android, some desktop browsers, and a variety of other internet connected devices.

In short, HLS streaming protocol dominates the market today. It is the safest bet to effectively deliver your stream to any viewer on all devices. And that’s why DaCast delivers all our broadcasters’ live streams in HLS format.

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

encoder settingsRTMP encoders come in a wide variety of types. The simplest are 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.

Video and audio codec

We’ll start with codecs, since this is foundational and relatively simple. 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.

encoder settingsThere 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, use the “Main” protocol. If you’re streaming in 1080p full HD, use the “High” protocol.

For the audio codec, you should select AAC or AAC-LC.

For more details on codecs, check out our comprehensive essay on video compression/exporting here.

Video resolution

Resolution is simply the size of your video, measured in pixels. The most common video frame sizes today are:

  • 426 pixels wide x 240 pixels high (240p)
  • 640 x 360 (360p, Low Definition)
  • 854 x 480 (480p, Standard Definition, or SD)
  • 1280 x 720 (720p High Definition, or HD)
  • 1920 x 1080 (1080p, or Full HD)

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 the best possible quality video. For a tutorial on how to set up multi-bitrate streaming, click here.

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.

encoder settingsHigher 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: 300 – 500 kbps
  • 360p: 500 – 800 kbps
  • 480p: 800 kbps – 2 Mbps
  • 720p: 1.5 – 4 Mbps
  • 1080p: 3 – 6 Mbps

Audio bitrates are simpler. We recommend always using at least 128 kbps and an audio sample rate of 48 Khz.

Internet speed and bandwidth requirements

When selecting resolution and bandwidth for your live stream, don’t neglect to think about your internet speed. 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 bandwidths, 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, I’d 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.

CBR vs. VBR

CBR refers to “Constant Bit Rate,” while VBR in turn means “Variable Bit Rate.” Encoder settings will often include a toggle for CBR vs. VBR for both audio and video.

encoder settingsConstant Bit Rate 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 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.

Frames Per Second

Here’s another easy aspect to consider before deciding on 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 is standard. However, 30 fps will work anywhere. If you are broadcasting sports or other 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.

Keyframe interval

When broadcasting over the DaCast OVP, users should always set the keyframe interval to two seconds.

Connecting encoder settings to your OVP

The final element in encoder settings is to connect to your online video platform.

encoder settingsGenerally, this requires gathering a few pieces of information. With DaCast, this necessary information includes:

  • Stream name
  • Stream URL
  • Login code (unique for each stream)
  • Login 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.

Conclusion

That’s all there is to it! Configuring encoder settings can seem impossible to a beginner. However, it’s quite easy with a little practice. Whenever you need a refresher, just skim this article for key take-aways. 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.

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.

Not yet a DaCast client but interested to give our platform a try? You can take advantage of our 30-day free trial (no credit card required) by clicking the button below!

YES, SIGN ME UP

Leave a Reply

Your email address will not be published. Required fields are marked *