Http live streaming: EXT-X-DISCONTINUITY tag makes all segments afterwards only have audio

18,456

Solution 1

Things I'd check (Not in any particular order, just the order I've thought of them).

  1. Are the segments actually the length the M3U8 claims
  2. Are the audio and video streams in them the same length
  3. Does advert0.ts begin with a video key frame (That's a biggy!)
  4. Are the video and audio codecs and parameters the same (Especially Audio - That must not change at all)
  5. Does the stream play back on other HLS compatible devices or applications? For example, can you play the stream with VLC?
  6. Is there any way you can watch the server logs to see what level(s) you are playing before and after the failure occurs, if so, this might point to an answer (e.g. if the device is level switching on the discontinuity, perhaps you can reduce the segment size of the first block of segments so that you get one additional segment, providing an opportunity to get switched earlier.

Sorry I don't have one answer but there are a lot of tiny, little things that can trip you up.

Solution 2

If you use #EXT-X-DISCONTINUITY in variant streams, then you're supposed to have #EXT-X-DISCONTINUITY-SEQUENCE:<number> in each of the variants.

See: https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-18#section-4.3.3.3

Share:
18,456
Admin
Author by

Admin

Updated on June 17, 2022

Comments

  • Admin
    Admin almost 2 years

    I am playing HTTP Live Streaming on the iOS device family, using Apple's AVPlayer library on iOS 5 and 6.

    Since I am playing advertisements mid-roll, between content clips, I am using the #EXT-X-DISCONTINUITY tags, as suggested by the awesome person who helped answer a previous question.

    This has been working for a single bitrate, but I am getting problems only when using a variant playlist with child playlists for multiple bitrates. I am getting a black screen with audio only after the very first discontinuity tag, and it never recovers even after the ad is over. (I can hear the ad).

    This has been tested and reproduced on an iPhone 4, 4S, 5, and iPod Touch 4th gen. The iphone 4 is on iOS 5, the rest are iOS 6. It happens most of the time, but not every single time. But for sure, I want to emphasize that this only happens if my variant playlist contains more than one bitrate child playlist.

    Here is an example of a playlist that I use (this is the 400kbps version, and I have a 200 and 800kbps version with corresponding playlists that look exactly like the following, but replace all '400's with '200' and '800'. (Well, the actual playlist is longer but this is an example).

    #EXTM3U
    #EXT-X-TARGETDURATION:10
    #EXT-X-MEDIA-SEQUENCE:0
    #EXTINF:10,
    400-clipA-0.ts
    #EXTINF:10,
    400-clipA-1.ts
    #EXTINF:5,
    400-clipA-2.ts
    
    #EXT-X-DISCONTINUITY
    #EXTINF:10,
    400-advert0.ts
    #EXTINF:3,
    400-advert1.ts
    
    #EXT-X-DISCONTINUITY
    #EXTINF:10,
    400-clipB-0.ts
    #EXTINF:10,
    400-clipB-1.ts
    #EXTINF:5,
    400-clipB-2.ts
    
    #EXT-X-ENDLIST
    

    And I have the variant playlist that selects between the child playlists:

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=240000
    clips-200.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=440000
    clips-400.m3u8
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=840000
    clips-800.m3u8
    

    Note that what happens (~75% of the time) is that when I play this, the video will go to black after the very first discontinuity tag (right before the ad) and never recover again, although I can hear the audio of the ad. For example, if I made my variant playlist with only a single bitrate variant:

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=280000
    clips-200.m3u8
    

    Then I do not get this problem at all! Very strange. Additionally, if I remove all the discontinuity tags and still keep the other bitrates in the variant playlist, then it works fine (usually), but occasionally it will skip an entire .ts file for some reason, probably because it needs those discontinuity tags.

    Additionally, this happens more often when I play the files directly on Amazon Cloudfront, compared to from the Amazon S3 bucket where they originally reside.

    Some other info that might help: My original files (clips and ads) are all .mov files taken from an iPhone 4, with the same resolution on each. My outputs (the .ts files) were all then generated from these -- for each bitrate class, I have the same encoding settings across the clips and ads. Outputs are all the same resolution and framerate otherwise.

    One last thing, the mediasegmentvalidator provided by Apple does not give any warnings when I use it to check.

    I really appreciate any help that you guys can offer! This is a puzzling problem for me :-(

  • rnrneverdies
    rnrneverdies about 8 years
    This is valid only if you are using #EXT-X-VERSION: 6 or higher