Syntax
What EXT-X-BYTERANGE means
EXT-X-BYTERANGE says that a media segment is only part of the file at its URI. Instead of storing hundreds of small segment files, a server can keep one large file and describe each segment as a range of bytes inside it. Players then fetch each segment with an HTTP Range request.
The format is #EXT-X-BYTERANGE:<n>[@<o>]:
- n
- The length of the range, in bytes.
- o
- Optional. The offset where the range starts, counted in bytes from the start of the file. Without it, the range starts at the byte right after the previous segment's range.
A range of n bytes at offset o covers bytes o to o+n-1. For 1000@0, the HTTP request header is Range: bytes=0-999.
Where it goes
Media playlists only. It applies to the next URI line and nothing else, so each segment that is a range needs its own tag. A segment without the tag is the whole file at its URI.
Rules from RFC 8216
Section 4.3.2.2 sets these rules:
- Using the tag requires
EXT-X-VERSION4 or higher. - If the offset is left out, a previous segment must exist in the playlist and must be a range of the same file. Otherwise the segment is undefined and players must refuse the playlist.
- Servers may describe segments as ranges when they support partial loading of files, for example through HTTP Range requests.
- In an I-frame-only playlist, a range must not include the file's Media Initialization Section, the header data a player needs before it can read the media.
Common mistakes
- Off-by-one ranges. HTTP ranges include both ends, so the last byte is
o+n-1, noto+n. - Servers that ignore Range requests. A server that answers with the whole file (status 200) instead of the requested part (status 206) makes players download far more than needed, or fail.
- No offset on the first range. The first segment taken from a file needs an explicit offset such as
@0. - Confusing it with the
BYTERANGEattribute.EXT-X-MAPhas its ownBYTERANGEattribute, written as a quoted string, for the initialization section.
How players treat it
Players that support byte ranges send one Range request per segment. Ranges are common in I-frame playlists, which point at frames inside the regular segments, and in on-demand streams stored as a single file. Every cache and content delivery network between the player and the server must pass Range requests through correctly for this to work.
Example
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:6
#EXTINF:6.000,
#EXT-X-BYTERANGE:752000@0
lecture.ts
#EXTINF:6.000,
#EXT-X-BYTERANGE:730440
lecture.ts
#EXTINF:4.500,
#EXT-X-BYTERANGE:541440
lecture.ts
#EXT-X-ENDLISTAll three segments live in one file, lecture.ts; the first starts at byte 0 and each later range starts where the previous one ended.
How m3u8.cloud handles it
Supported. When a playlist uses EXT-X-BYTERANGE, m3u8.cloud fetches each piece as a byte range of the larger file instead of downloading the whole file for every piece.
Related tags
Check the tags in any playlist
Open the m3u8 inspector