EXT-X-MEDIA-SEQUENCE

Gives the sequence number of the first segment in the playlist; each later segment counts up by one.

Media playlist tagAny protocol versionIn: Media playlistRFC 8216, section 4.3.3.2

Syntax

#EXT-X-MEDIA-SEQUENCE:<number>

What EXT-X-MEDIA-SEQUENCE means

Every media segment has a media sequence number. EXT-X-MEDIA-SEQUENCE gives the number of the first segment listed in the playlist, and each following segment is one higher. Without the tag, the first segment is number 0.

The value is a decimal integer. Segment file names do not have to contain the number, though they often do.

Where it goes

Media playlists only, once, before the first segment. It matters most in live playlists, where old segments drop off the top as new ones are added at the bottom.

Rules from RFC 8216

Section 4.3.3.2 and sections 6.2.2 and 6.3 set these rules:

Common mistakes

How players treat it

To play normally, a player loads next the segment with the lowest number above the last one it loaded, and repeats this after every reload. With AES-128 encryption and no IV attribute, the media sequence number also serves as the initialization vector, so a wrong number makes decryption fail.

Example

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:2681
#EXTINF:6.000,
live/seg2681.ts
#EXTINF:6.000,
live/seg2682.ts
#EXTINF:6.000,
live/seg2683.ts

The first segment listed is number 2681, so the next two are 2682 and 2683; when the oldest segment drops off, the value goes up by one.

How m3u8.cloud handles it

When you record a live stream, m3u8.cloud uses the media sequence number to spot new pieces each time the playlist reloads. The m3u8 inspector also shows the value.

Check the tags in any playlist

Open the m3u8 inspector