Encoding for HLS Delivery-Understanding the Bitrate Rules

Apple could make all of this easier to remember if they changed the name of the BANDWIDTH tag to PEAK BANDWIDTH, which is really what it means. Since that’s unlikely to happen, if you just remember that BANDWIDTH means peak bandwidth, you should be able to keep it straight. 

In this article, I take a quick look at the VOD and Live bitrate requirements in Apple’s HLS Authoring Specification for Apple Devices.

VOD

A quick glance reveals the following three requirements for VOD data rates:

  1. The average segment bit rate MUST be within 10% of the AVERAGE-BANDWIDTH attribute. (See also Appendix.)
  2. The measured peak bit rate MUST be within 10% of the BANDWIDTH attribute.
  3. The peak bit rate SHOULD be no more than 200% of the average bit rate.

Working through the first requirement is simple. Basically, it means that the average bitrate for each segment must be within 10% of the AVERAGE-BANDWIDTH attribute, which, according to 4.3.4.2 of the Pantos spec, measures the “average segment bitrate of the variant stream.” Basically, it’s an accuracy requirement, that your actual average MUST be within 10% of the stated attribute in the M3U8 file.

The second and third requirements are a potential cause for confusion, because it looks like the second requirement demands a peak within 10% of file bandwidth, while the third requires a peak no more than 200% of the average bitrate. Once you check the Pantos spec, however, you see that the BANDWIDTH tag represents the “peak segment bit rate of the Variant stream.” It’s not the average bandwidth, it’s the peak. So again, number two is an accuracy requirement in that the peak bit rate should be within 10% of the peak bitrate represented in the BANDWIDTH tag.

In contrast, number 3 is an encoding requirement and an accuracy requirement. That is, the peak bitrate SHOULD be no more than 200% of the average bit rate, which means that 200% constrained VBR is an acceptable technique. I’m more conservative, and recommend 110% constrained VBR because of what I learned in an article entitled Bitrate Control and QoE-CBR is Better. That said, you can encode at up to 200% constrained VBR and meet the Apple spec.

Live Video

Here are the requirements for live video, which are much simpler.

  1. The average segment bit rate over a long (~1 hour) period of time MUST be less than 110% of the AVERAGE-BANDWIDTH attribute.
  2. The measured peak bit rate MUST be within 25% of the BANDWIDTH attribute.

The first one, again, is an accuracy requirement; if you say the stream is 4 Mbps, it should be between 3.9 and 4.1 Mbps.

The second is an encoding requirement and an accuracy requirement that means that the peak bit rate MUST be within 25% of the peak bit rate represented within the bandwidth tag. Since the only encoding technique you can use for live is CBR, this shouldn’t be a problem.

Apple could make all of this easier to remember if they changed the name of the BANDWIDTH tag to PEAK BANDWIDTH, which is really what it means. Since that’s unlikely to happen, if you just remember that BANDWIDTH means peak bandwidth, you should be able to keep it straight.

About Jan Ozer

Avatar photo
I help companies train new technical hires in streaming media-related positions; I also help companies optimize their codec selections and encoding stacks and evaluate new encoders and codecs. I am a contributing editor to Streaming Media Magazine, writing about codecs and encoding tools. I have written multiple authoritative books on video encoding, including Video Encoding by the Numbers: Eliminate the Guesswork from your Streaming Video (https://amzn.to/3kV6R1j) and Learn to Produce Video with FFmpeg: In Thirty Minutes or Less (https://amzn.to/3ZJih7e). I have multiple courses relating to streaming media production, all available at https://bit.ly/slc_courses. I currently work as www.netint.com as a Senior Director in Marketing.

Check Also

Take the Bitmovin Video Developer Survey

Contribute to the one of the most valuable sources of industry data by completing the …

Speech-to-text In Premiere Pro – Fast, Easy, Accurate, and Free

This video tutorial teaches you how to convert speech-to-text in Premiere Pro. I’ve been using …

Streaming Media 101: Training for App & Player Development/Testing Professionals

Leave a Reply

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