Configure Hls Segments

Configure HLS Segments

When a video is transcoded, it is cut into many small pieces (.ts segments). The HLS segment duration controls how long each of those pieces is. It used to be fixed at 4 seconds — it is now configurable per library, and the new default is 6 seconds.

📘

Why it matters

A longer segment produces fewer files, and therefore fewer requests to the CDN and to storage — it is a cost lever. Moving from 4s to 6s reduces the number of files per video by about 33%.

It does not reduce bandwidth in GB — the bitrate is the same. It can slightly increase time-to-first-frame and reduce seek precision.

The field

NameTypeMinMaxDefaultRequired
hls_segment_durationinteger4156no

Values outside the range, non-integer, or non-numeric return 400.

Where it lives

EndpointRole of the field
GET /libraryreturns hls_segment_duration
GET /library/{library_id}returns hls_segment_duration
PUT /library/{library_id}accepts hls_segment_duration
🚧

Applies to new videos only

Changing this configuration does not reprocess anything. Videos that are already converted keep the segments they have; the new value applies to the next upload or reencode.

Good to know

  • You cannot choose the duration per upload. The value always comes from the library configuration. To vary it, change the configuration between uploads, or use separate libraries.
  • The value is read when the upload finishes, not when it starts. Changing the configuration in the middle of a long upload makes the new value take effect.
  • Configuration is currently available via the API only.