← Blog.backToBlog

HLS Segmenter Tutorial: Create Segments and Playlists

7 min read

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

DurationUse when
2–4sLower latency, more requests
6–10sBalanced 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

  1. Open index.m3u8 in a text editor and confirm tags.
  2. Serve files over HTTP.
  3. Play the URL in our player.
  4. 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.