Syntax
What EXTINF means
EXTINF gives the duration of one media segment, in seconds. A segment is one of the short files a stream is cut into. The tag applies only to the next segment, and every segment must have one.
The format is #EXTINF:<duration>,[<title>]:
- duration
- A decimal number such as
6.006, or a whole number such as6. - title
- Optional text after the comma, meant for people. Players do not need it, and most HLS playlists leave it empty.
The comma is part of the format, so a line with no title still ends in a comma: #EXTINF:6.006,.
Where it goes
Media playlists only, once per segment, among the tags directly above the segment's URI line. Other segment tags, such as EXT-X-BYTERANGE, can sit between it and the URI. Adding up every EXTINF value gives the duration of the whole playlist.
Rules from RFC 8216
Section 4.3.2.1 and the related sections set these rules:
- Every media segment must have an
EXTINFtag. - Durations should be decimal numbers, precise enough that small errors do not add up over many segments.
- If the playlist's
EXT-X-VERSIONis lower than 3, durations must be whole numbers. Whole-number durations should be rounded to the nearest integer. - Each duration, rounded to the nearest whole second, must not be larger than the playlist's
EXT-X-TARGETDURATION. - In an I-frame-only playlist, the duration is the time from this I-frame to the next one.
Common mistakes
- Rounded durations that drift. Video at 29.97 frames per second often has segments of 6.006 seconds. Writing them as
6loses 6 milliseconds each time, which adds up to 6 seconds over 1,000 segments. The seek bar and the real position then disagree. - Durations that do not match the media. A packager that writes the planned length instead of the real one makes players show the wrong total length.
- A segment longer than the target duration. A 6.6-second segment rounds to 7, which breaks a target duration of 6.
- A missing comma. Many parsers accept
#EXTINF:6.006, but it is not valid.
How players treat it
Players use EXTINF values to build the timeline and the seek bar, and to work out which segment holds a given time before they download it. Once a segment arrives, the timestamps inside the media decide exactly when each frame plays. Players generally ignore the title.
Example
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:6.006,
https://example.gov/council/seg0.ts
#EXTINF:6.006,Opening remarks
https://example.gov/council/seg1.ts
#EXTINF:2.002,
https://example.gov/council/seg2.ts
#EXT-X-ENDLISTEach EXTINF gives the length of the segment on the line after it; the second one also carries an optional title.
How m3u8.cloud handles it
m3u8.cloud adds up the EXTINF durations to show the length of the video. When you trim, it uses them to work out which pieces (segments) your start and end times fall in, so only those pieces are downloaded.
The m3u8 inspector lists every piece with its duration.
Related tags
Check the tags in any playlist
Open the m3u8 inspector