How to calculate HLS BANDWIDTH when a variant offers alternate audio

Work through an HLS BANDWIDTH calculation for stereo and surround audio, then use the multivariant playlist and player logs to test a bitrate mismatch.

Amira Labs2 min read

Share

Share on LinkedIn
A television remote rests diagonally across a black set-top device

The English stereo mix plays cleanly. Switch to surround on the same television and playback starts to stall. Before opening a CDN ticket, save the multivariant playlist the television actually requested. If the packager copied the video encoder’s target bitrate into the BANDWIDTH field, the player may be choosing a combination that costs more to deliver than the playlist advertises.

Read the combinations the player can choose

Start with one EXT-X-STREAM-INF entry. Follow its AUDIO group to the eligible renditions. Identify which audio streams are separate downloads and whether the video already carries audio. This distinction matters when a packager advertises the same video playlist in several entries, each paired with a different audio group.

For Apple devices, the authoring specification defines BANDWIDTH using the largest sum of peak segment bitrates from any playable combination for that entry. It also requires AVERAGE-BANDWIDTH. Keep both values and their calculations with the playlist. A player choosing a variant needs a description of what it may have to fetch, including eligible audio. Apple HLS authoring specification, section 9

Work one entry by hand

Consider an illustrative on-demand package. A video-only rendition measures 4,800,000 bits per second at peak. The associated group offers two mutually exclusive audio tracks. Stereo peaks at 160,000 and surround at 640,000. Assume there are no other downloadable renditions in this example.

The stereo combination peaks at 4,960,000 bits per second under the playlist calculation. The surround combination comes to 5,440,000. Advertise 5,440,000 for this entry. Adding both audio tracks would assume the viewer downloads both at once. Copying 4,800,000 from the video would omit audio entirely. If the two tracks belong to separate groups on separate entries, calculate each entry against its own group.

Where does the peak come from? For RFC 8216, take qualifying contiguous segments whose combined duration falls between half and one-and-a-half times the target duration. Divide their total transmitted media bits by their total duration, then take the highest result. Keep the segment byte counts and durations so a colleague can reproduce it. For live streams where future segments do not yet exist, RFC 8216 describes using a representative period of similar content. A quiet studio open is a poor stand-in for the match that follows. RFC 8216, sections 4.1 and 4.3.4.2

Find out whether the declaration caused the stall

Replay the same passage under the same network limit on the same device. Capture the selected variant, audio rendition, segment download times and buffer events. Repeat with a corrected playlist pointing to the identical media. If the player selects a different variant and the stalls disappear, save both traces. If the player selects the same combination and one audio URI consistently takes longer to return, investigate the delivery path for that track.

Apple documents its Media Stream Validator and player error logs as complementary diagnostics. Keep the validator report alongside the playback traces. That gives the packager owner an exact entry to correct and the delivery team an exact request to investigate. Apple’s HLS debugging note

Archival cover: Close-up of a TV remote control, Shixart1985 (Nenad Stojković). Cropped and JPEG-encoded under CC BY 2.0.