Syntax
Attributes
| Attribute | Value | Required | What it means |
|---|---|---|---|
| METHOD | NONE, AES-128 or SAMPLE-AES | Yes | How the segments are encrypted. NONE means the segments that follow are not encrypted, and then no other attribute may be present. Added in the RFC 8216bis draft: the optional methods SAMPLE-AES-CTR and AES-256-GCM. |
| URI | URI of the key file | Unless METHOD is NONE | Where the key can be obtained. A relative URI is resolved against the address of the playlist. |
| IV | 128-bit number starting with 0x Default: Media sequence number of the segment | No | Initialization vector used with the key. Without it, the identity key format uses the segment's media sequence number instead. Needs version 2. |
| KEYFORMAT | "identity" or a key system identifier Default: "identity" | No | How the key is represented at the URI. "identity" means a plain 16-byte key file; DRM systems use their own values, such as "com.apple.streamingkeydelivery" for FairPlay. Needs version 5. |
| KEYFORMATVERSIONS | Positive integers separated by /, such as "1" or "1/2" Default: "1" | No | Which versions of the key format this tag works with. Needs version 5. |
What EXT-X-KEY means
EXT-X-KEY says whether the media segments that follow are encrypted, how, and where a player can get the key to decrypt them. It applies to every segment, and to every initialization section declared by EXT-X-MAP, between it and the next EXT-X-KEY with the same KEYFORMAT, or the end of the playlist. A media playlist with no EXT-X-KEY is not encrypted.
Encryption methods
NONE- The segments are not encrypted. No other attribute may be present.
AES-128- Each whole segment is encrypted with AES using a 128-bit key, in CBC mode with PKCS7 padding. The cipher restarts at each segment, using the
IVattribute or the segment's media sequence number as the initialization vector. SAMPLE-AES- Only the audio and video samples inside each segment are encrypted, while the container stays readable. fMP4 segments use the
cbcsscheme of MPEG Common Encryption. DRM systems such as Apple's FairPlay use this method.
The RFC 8216bis draft adds two optional methods, SAMPLE-AES-CTR (the cenc scheme, for fMP4) and AES-256-GCM. Neither is part of RFC 8216.
Where it goes
Media playlists only, before the first segment it applies to. Each new EXT-X-KEY starts a new key period, so playlists that rotate keys contain several. Two or more tags with different KEYFORMAT values may apply to the same segments if they lead to the same key, which is how one stream can serve several DRM systems.
Rules from RFC 8216
METHODis required.URIis required unless the method isNONE.- An unencrypted segment that follows encrypted ones must have
METHOD=NONEapplied, or players will treat it as encrypted. - A segment is encrypted with one method, one key and one IV.
- A live server must not remove an
EXT-X-KEYwhile it still applies to a segment in the playlist. - Players must ignore a key tag whose
KEYFORMATthey do not support, and playback should fail if only such tags apply to a segment. Players must not try to decrypt segments whoseMETHODthey do not recognize. - If an initialization section is encrypted with
AES-128, the key tag that applies to it must includeIV.
Common mistakes
- A missing
METHOD=NONEafter an encrypted section, so the unencrypted part that follows, such as an inserted clip, fails to play. - Version too low.
IVneeds version 2, andKEYFORMATorKEYFORMATVERSIONSneed version 5. The RFC 8216bis draft also requires version 5 forSAMPLE-AES; RFC 8216 lists no version for it. - Lowercase hex in
IV. RFC 8216 defines hexadecimal sequences as0xor0Xfollowed by the digits 0 to 9 and A to F. Many parsers accept lowercase, but it is not strictly valid.
How players treat it
With AES-128 or SAMPLE-AES and the default identity key format, the player requests the key file at URI, which holds 16 raw bytes, and decrypts each segment. Key servers often require the same sign-in, cookies or tokens as the page that shows the video. For DRM key formats, the player hands the request to the platform's content protection system, which on the web works through Encrypted Media Extensions.
Example
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-KEY:METHOD=AES-128,URI="keys/k1.bin",IV=0x1A2B3C4D5E6F708192A3B4C5D6E7F801
#EXTINF:6.000,
segment0.ts
#EXTINF:6.000,
segment1.ts
#EXT-X-KEY:METHOD=NONE
#EXTINF:6.000,
segment2.ts
#EXT-X-ENDLISTThe first two segments use the AES-128 key at keys/k1.bin, resolved against the playlist's address, while METHOD=NONE marks the third segment as unencrypted.
How m3u8.cloud handles it
Playlists with no EXT-X-KEY, or with METHOD=NONE, download normally. Any other method, such as AES-128, SAMPLE-AES or SAMPLE-AES-CTR, or any KEYFORMAT used for DRM, makes m3u8.cloud stop and explain why instead of downloading.
m3u8.cloud never fetches keys and never decrypts. The relay refuses encrypted playlists too.
Related tags
Check the tags in any playlist
Open the m3u8 inspector