video-streaminghttp-live-streaming

Concatenate multiple HLS master playlists


The DASH Manifest provides the notion of “Periods” to concatenate multiple clips - each with its own track information - in a single manifest.

Is there a similar functionality which allows to concatenate multiple master playlist files in a kind of “master master”-playlist file?


Solution

  • Short answer: No, not on a Master Playlist level.

    I guess the closest thing to Periods of MPEG-DASH in HLS are Discontinuity Sequences. You would have to concatenate the variant playlists and add an EXT-X-DISCONTINUITY.

    Example:

    First clip's variant:

    #EXTM3U
    #EXT-X-TARGETDURATION:10
    #EXT-X-VERSION:3
    
    #EXTINF:10,
    clip-1/1.ts
    #EXTINF:10,
    clip-1/2.ts
    #EXTINF:10,
    clip-1/3.ts
    #EXT-X-ENDLIST
    

    Second clip's variant:

    #EXTM3U
    #EXT-X-TARGETDURATION:10
    #EXT-X-VERSION:3
    
    #EXTINF:10,
    clip-2/1.ts
    #EXTINF:10,
    clip-2/2.ts
    #EXTINF:10,
    clip-2/3.ts
    #EXT-X-ENDLIST
    

    The concatenated clips' variant would be:

    #EXTM3U
    #EXT-X-TARGETDURATION:10
    #EXT-X-VERSION:3
    
    #EXTINF:10,
    clip-1/1.ts
    #EXTINF:10,
    clip-1/2.ts
    #EXTINF:10,
    clip-1/3.ts
    #EXT-X-DISCONTINUITY
    #EXTINF:10,
    clip-2/1.ts
    #EXTINF:10,
    clip-2/2.ts
    #EXTINF:10,
    clip-2/3.ts
    #EXT-X-ENDLIST
    

    The EXT-X-DISCONTINUITYtag is needed to mark a discontinuity in timestamps and/or encoding parameters. You would have to do this for each variant playlist (i.e. each quality level).

    If the clips do not have the same bitrate ladder (i.e. quality profiles) it's not really feasible to concatenate them.