Syntax
What EXT-X-TARGETDURATION means
EXT-X-TARGETDURATION sets the longest a media segment in the playlist may be, in whole seconds. Each segment's EXTINF duration, rounded to the nearest whole number, must not be larger than this value. A 6.006-second segment rounds to 6 and fits a target duration of 6; a 6.6-second segment rounds to 7 and does not.
The value is a decimal integer, and it applies to the whole playlist.
Where it goes
Every media playlist must have exactly one, usually near the top. It never appears in a master playlist.
Rules from RFC 8216
Section 4.3.3.1 and section 6.2 set these rules:
- The tag is required in every media playlist.
- The value must not change during the life of the playlist.
- All media playlists in a master playlist's variant streams must use the same target duration. Subtitle playlists and I-frame playlists may differ if they have an
EXT-X-PLAYLIST-TYPEofVOD. - The RFC calls 10 seconds a typical target duration.
The RFC 8216bis draft adds that the value must be at least 1, and notes that in protocol version 5 and earlier the target was compared with segment durations without rounding.
How it paces live streams
- The server must publish a new version of a live playlist, with at least one new segment, between half and one and a half target durations after the previous version.
- After a reload that brought changes, a player must wait at least one target duration before reloading again. If nothing had changed, it waits half a target duration.
- A server must not shrink a live playlist below three target durations of content.
- Players should not start playing less than three target durations from the end, which is one reason live streams start a little behind real time.
Common mistakes
- A value that is too small. If an encoder now and then makes a long segment, the playlist breaks the rule and some players stall.
- A decimal value.
#EXT-X-TARGETDURATION:6.0is not valid; the value must be a whole number. - Changing the value mid-stream, for example after an encoder restart with different settings.
How players treat it
Players use the target duration to time playlist reloads and to decide how far from the live edge to start. A segment much longer than the target can make a player run out of buffered video before the next reload brings more.
Example
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:1200
#EXTINF:6.006,
seg1200.ts
#EXTINF:5.972,
seg1201.ts
#EXTINF:6.006,
seg1202.tsEvery EXTINF value in this live playlist rounds to 6 or less, so a target duration of 6 seconds is valid.
How m3u8.cloud handles it
When you record a live stream, m3u8.cloud uses EXT-X-TARGETDURATION to decide how often to reload the playlist to look for new pieces.
Related tags
Check the tags in any playlist
Open the m3u8 inspector