Skip to content

Method for streamlink to use multiple keys with m3u8 that have multiple keys #2806

@streammonkey

Description

@streammonkey

Feature Request

  • This is a feature request and I have read the contribution guidelines.

Description

There are some m3u8 that contain several key URI's, and there are some instances where one may not have direct access to the key uris built into the m3u8, but could otherwise access keys.

Currently we can only specify a single --hls-segment-key-uri. For those playlists that contain multiple different keys, it would be useful if we could feed streamlink several keys for it to choose from.

Expected / Actual behavior

Currently we can only feed streamlink a single key-uri, but some playlists contain more than one key uri.

For example, I do not have access to the key uri's below but I do have an alternate key uri i can feed streamlink.

The problem is that different segment sets have different kids.

So, streamlink works fine when I specify the --hls-segment-key-uri as "h t t p s://.../71141503/kid/70299953", but cannot download the segments after that, when the kid changes to 70299954.

Ideally we could feed streamlink all of the different key-uris in a given playlist, and it could choose the right one for the given set of segments.

This may only be possible for downloading static streams, not live streams, but it would be useful in these circumstances:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PROGRAM-DATE-TIME:2020-02-23T18:52:58.940Z
#EXT-X-KEY:METHOD=AES-128,URI="h t t p s://mf.svc.nhl.com/ws/mf/v2.3/key/mediaid/71141503/kid/70299953",IV=0x58919F236E631A0F73F91D414E083F40
#EXTINF:5.005,
18/52/58.ts
#EXTINF:5.005,
18/53/03.ts
#EXTINF:5.005,
18/53/08.ts
#EXTINF:5.005,
18/53/13.ts
#EXTINF:5.005,
18/53/18.ts
#EXTINF:5.005,
18/53/23.ts
#EXTINF:5.005,
18/53/28.ts
#EXT-X-KEY:METHOD=AES-128,URI="h t t p s://mf.svc.nhl.com/ws/mf/v2.3/key/mediaid/71141503/kid/70299954",IV=0x2D6CB9E6575295CE2B35DB6644CF48AF
#EXTINF:5.005,
18/53/33.ts
#EXTINF:5.005,
18/53/38.ts
#EXTINF:5.005,
18/53/43.ts
#EXTINF:5.005,
18/53/48.ts
#EXTINF:5.005,
18/53/53.ts
#EXTINF:5.005,

Additional comments, screenshots, etc.

Thank you for considering adding this option.

Love Streamlink? Please consider supporting our collective. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions