Encoding for HLS Delivery-Understanding the Bitrate Rules

Home/Blogs/Encoding for HLS Delivery-Understanding the Bitrate Rules
By | 2017-04-24T15:41:10+00:00 April 24th, 2017|Blogs|Comments Off on 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.

Comments