[FFmpeg-devel] hls BANDWIDTH field in master playlist

Jeyapal, Karthick kjeyapal at akamai.com
Thu Feb 1 12:28:01 EET 2018

On 2/1/18 3:12 PM, Amit Kale wrote:
> Hi All,
> When emitting a master playlist, BANDWIDTH field is computed in
> libavformat/hlsenc.c by adding video and audio stream bitrates and then
> adding 10% to account for container overhead. However HLS specification
> (RFC8216) says that BANDWIDTH represents the peak segment bit rate.
> AVERAGE-BANDWIDTH on the other hand represents the average segment bit
> rate. If this is correct, I would like to send a patch to fix it.
Yes, you are right. Ofcourse, you are welcome to send a patch to fix it.
But please keep the following in mind, while sending the patch
- BANDWIDTH is mandatory parameter and AVERAGE-BANDWIDTH is optional parameter.
- Master playlist gets created at the beginning of encode during which time we neither know the peak bitrate or the average bitrate of the stream. Right now, we are just using the codec’s bitrate parameter which could be way different from the actual bitrate of the stream.  So the master playlist should get created initially with BANDWIDTH as codec bitrate(to handle live encode). At the end of encoding, master playlist should be updated again with the true peak bitrate and true average bitrate(for AVERAGE-BANDWIDTH).
- The definition for BANDWIDTH changed to peak bitrate only in v7 of the HLS spec. Earlier BANDWIDTH was mentioned as overall bitrate. So, there should be an option to turn on or turn off peak bitrate calculation.
> Thanks.
> -Amit

More information about the ffmpeg-devel mailing list