ios - HTTP Live Streaming (HLS) - Lowering the target-duration, choosing the initial stream, and debugging

StackOverflow https://stackoverflow.com/questions/20863019

  •  23-09-2022
  •  | 
  •  

Question

The goal is to optimize viewing quality as fast as possible (always the goal isn't it?).

Project notes:

  1. Using HTTP Live Streaming (HLS) to allow the iOS device to choose the best stream for viewing.
  2. The stream is not live.
  3. The video duration is ~1 minute.
  4. Targeting iPhone 3gs and beyond

Three questions:

  1. What should the target encoder settings be for the initial cellular stream? Encoder settings tables: Preparing Media for Delivery to iOS-Based Devices

  2. Apple suggests (reproduced below) the target duration should be 10 seconds. If the initial stream quality is lower than current capability, you'll be stuck viewing that same stream for 10 seconds before the switch is made. I'm considering moving it to 3-5 seconds. Are there recommendations around a lower limit? I believe Apple's advice comes from a live streaming perspective, and may not apply.

  3. How can I debug the HLS on the device? To view stream switches, and timings. I ran into a link at one point...

Use 10 second Target Durations

The value you specify in the EXT-X-TARGETDURATION tag for the maximum media segment duration will have an effect on startup. We strongly recommend a 10 second target duration. If you use a smaller target duration, you increase the likelihood of a stall. Here's why: if you've got live content being delivered through a CDN, there will be propogation delays, and for this content to make it all the way out to the edge nodes on the CDN it will be variable. In addition, if the client is fetching the data over the cellular network there will be higher latencies. Both of these factors make it much more likely you'll encounter a stall if you use a small target duration.

Thanks SO

Was it helpful?

Solution

1) This will probably be trial and error with your consumers. I would go with a very low bitrate for the initial stream given a low target duration and assume the quality change will happen quickly (see 2)

2) This really does depend on your CDN. It is easier for VOD however because there is only one HTTP request per segment, unlike live (2 requests per segment). That being said, Microsoft silverlight's default is 2 seconds. And it was good enough for netflix.

3) No idea.

OTHER TIPS

For #1, Apple mentions having more than 1 master file to solve quality for first stream played.

If you are an iOS app developer, you can query the user’s device to determine whether the initial connection is cellular or WiFi and choose an appropriate master index file. To ensure the user has a good experience when the stream is first played, regardless of the initial network connection, you should have more than one master index file consisting of the same alternate index files but with a different first stream.

A 150k stream for the cellular variant playlist is recommended.

A 240k or 440k stream for the Wi-Fi variant playlist is recommended.

Note: For details on how to query an iOS-based device for its network connection type, see the following sample code: Reachability.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top