AVAssetDownloadConfiguration: How many video variants are actually downloaded when multiple variants exist in the HLS master playlist?

Hi,

I’m trying to better understand how AVAssetDownloadConfiguration selects video variants when downloading HLS content for offline playback.

Suppose I have an HLS master playlist (.m3u8) that contains several video variants defined with #EXT-X-STREAM-INF.

For example, the master playlist may contain multiple video streams like this:

  • Same resolution, different BANDWIDTH
  • Or different resolutions (for example 720p, 1080p, etc.)

My question is:

How many video variants are actually downloaded when using AVAssetDownloadConfiguration without specifying any variantQualifiers?

In other words:

  • If the master playlist contains multiple video variants, will the download task fetch only one variant, or multiple variants?
  • Does the behavior differ depending on whether the variants differ only by BANDWIDTH or also by RESOLUTION?

What I observed in testing

In my tests, I always end up with only one video variant downloaded, specifically the one with the highest BANDWIDTH parameter. In the m3u8 files I tested, all video variants had identical parameters (resolution, codec, frame rate, etc.) and differed only by the BANDWIDTH attribute in the master playlist.

However, when inspecting the downloaded .movpkg, I noticed something interesting in boot.xml.

It lists two video streams:

  • one with complete="true" (the one with highest bandwidth)
  • another with complete="no" (the one with lowest bandwidth)

I actually had 3 video streams listed in m3u8, but the one with middle bandwidth wasn't listed in boot.xml file at all.

There are also additional streams for audio and subtitles in boot.xml file.

This made me wonder whether the system initially attempts to download another video variant (possibly a lower bitrate one), but then switches to the highest-quality variant and only completes that one.

Additional question about variantQualifiers

If I provide a predicate such as:

NSPredicate(format: "peakBitRate > 0")

which should theoretically match all variants, will the download task attempt to download all matching video variants, or will it still select only one?

Summary

So the main questions are:

  1. Without variantQualifiers, does AVAssetDownloadConfiguration always download a single video variant, and if so, how is it chosen?
  2. Does the behavior differ if variants have different resolutions vs only different bitrates?
  3. When a predicate matches multiple variants, can multiple video variants actually be downloaded in a single .movpkg?
  4. Why might boot.xml list multiple video streams when only one appears to be fully downloaded?

Any clarification on the intended behavior would be greatly appreciated.

Thanks!

Answered by Emil_A in 878395022

Hi, Thank your questions regarding AVAssetDownloadConfiguration.

  1. AVAssetDownloadConfiguration is capable of specifying multiple quality/bitrate variants. However, with its default settings, AVAssetDownloadTask will download only a single variant, selecting the best quality that is compatible with the device’s capabilities. If multiple variants are desired by the application, AVAssetDownloadConfiguration.auxiliaryContentConfigurations should be configured with the appropriate requirements.
  2. The behavior remains consistent regardless of whether the multi-variant playlist offers different resolutions or only differing bitrates.
  3. A predicate set through AVAssetDownloadContentConfiguration.variantQualifiers always results in the download of a single video variant. If the predicate yields no matches, the system automatically selects one variant based on the device’s capabilities.
  4. Metadata for additional variants may be present in the *.movpkg, but only a single video variant will contain actual media segments unless auxiliaryContentConfigurations is used to explicitly configure multi-variant downloads.
Accepted Answer

Hi, Thank your questions regarding AVAssetDownloadConfiguration.

  1. AVAssetDownloadConfiguration is capable of specifying multiple quality/bitrate variants. However, with its default settings, AVAssetDownloadTask will download only a single variant, selecting the best quality that is compatible with the device’s capabilities. If multiple variants are desired by the application, AVAssetDownloadConfiguration.auxiliaryContentConfigurations should be configured with the appropriate requirements.
  2. The behavior remains consistent regardless of whether the multi-variant playlist offers different resolutions or only differing bitrates.
  3. A predicate set through AVAssetDownloadContentConfiguration.variantQualifiers always results in the download of a single video variant. If the predicate yields no matches, the system automatically selects one variant based on the device’s capabilities.
  4. Metadata for additional variants may be present in the *.movpkg, but only a single video variant will contain actual media segments unless auxiliaryContentConfigurations is used to explicitly configure multi-variant downloads.
AVAssetDownloadConfiguration: How many video variants are actually downloaded when multiple variants exist in the HLS master playlist?
 
 
Q