HLS Segmenter Tutorial: Create Segments and Playlists
What a Segmenter Does
A segmenter/packager cuts encoded media into short files and writes playlists that reference them. That packaging step turns a mezzanine file or live encoder output into streamable HLS.
Choose Segment Duration
| Duration | Use when |
|---|---|
| 2–4s | Lower latency, more requests |
| 6–10s | Balanced VOD/CDN efficiency |
Performance notes: M3U8 performance.
Segment with FFmpeg (VOD Example)
ffmpeg -i input.mp4 -c:v libx264 -c:a aac -f hls -hls_time 6 -hls_playlist_type vod -hls_segment_filename "seg_%03d.ts" index.m3u8
This writes a media playlist plus numbered segments. Multi-bitrate masters need additional maps/variants. Playlist creation: create M3U8 playlist.
TS vs fMP4 Segments
Classic HLS uses MPEG-TS. CMAF/fMP4 segments are common for modern packaging and some advanced features. Pick based on player/CDN support and codec needs (e.g. HEVC workflows).
Validate the Output
- Open
index.m3u8in a text editor and confirm tags. - Serve files over HTTP.
- Play the URL in our player.
- Check startup, seeking (VOD), and errors.
Common Packaging Mistakes
- Wrong TARGETDURATION.
- Missing ENDLIST on finished VOD.
- Broken relative paths after moving folders.
- Inconsistent segment durations across variants.
Frequently Asked Questions
Is FFmpeg a segmenter?
It can package HLS, yes.
Do I need a live packager?
For live, yes — something that continuously writes segments/playlists.
Can I segment without re-encoding?
Sometimes, if codecs/containers already match targets.
How do I test packaging?
Play the resulting M3U8 in multiple players.