videoffmpeghttp-live-streamingbitrate

Http Live Streaming EXT-X-STREAM-INF, Calculating BANDWITH


Initially I've tried to find possible ways to do HLS segmenting on other non-Mac platforms.

Segmenting videos for HLS involves the following steps:

1) Splitting the encoded video into segments

2) Creating playlist (.m3u8) file that simply contains list of segments for the current rendition, including duration in seconds for each segment

3) Creating a variant playlist that contains relative paths to all playlists of all renditions with the information about BANDWITH which according to HTTP Live streaming protocol is:

The value is a decimal-integer of bits per second. It MUST be an upper bound of the overall bitrate of each media segment (calculated to include container overhead) that appears or will appear in the Playlist.

Latest version of ffmpeg includes possibilities of splitting videos. However ffmpeg can’t create m3u8 files. Creating simple playlist not a problem. But creating variant playlist might be:

So variantplaylistcreator on Mac creates those, calculates somehow bitrates and puts value based on that into BANDWITH tag.

I’ve tried many different ways but yet I couldn’t get exactly the same numbers that variantplaylistcreator does, and at this point I can’t find any information how exactly it calculates those values and what algorithm it uses. My numbers are close, but still slightly different.

In theory it should not be a problem, but the point is - I don’t know that for sure. Maybe the BANDWITH information should be precise for flawless video playing, maybe it doesn’t have to.

Anyway I'm really curious how exactly variantplaylistcreator calculates them:


Solution

  • I've tried to use latest version of Http Live Streaming command line tools and compared results with version we currently use and that thing puts slightly different numbers. So, these values don't have to be exact.

    I think I'll be ok, if I just put there average bitrate value of all the segments...

    I'll be testing that theory later and I hope it will work...