Set HLS Segment Duration

Updates the HLS segment duration of a specific library. Send only the hls_segment_duration field in the body; the library_id goes in the URL.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

PUT /library/{library_id}

Updates the HLS segment duration of a specific library. Send only the hls_segment_duration field in the body; the library_id goes in the URL.

The HLS segment duration is how long each .ts piece of a transcoded video lasts (default 6 seconds). A larger segment produces fewer files, and therefore fewer requests to the CDN and to storage — a cost lever (4s → 6s is about 33% fewer files per video). It does not reduce bandwidth in GB (the bitrate is the same), and it can slightly increase time-to-first-frame and reduce seek precision.

📘

Authorization

Requires a valid API token in the Authorization header (no Bearer prefix).

HTTP Method & Path

PUT /library/{library_id}

Base URL: https://api-v2.pandavideo.com.br

🚧

Path

It is /library/{library_id} (singular); the library_id goes in the URL, not in the body. A PUT /library without the id in the URL returns an error.

Path Parameters

ParameterTypeRequiredDescription
library_idstring (uuid)yesUnique identifier of the library.

Request Body

Content-Type: application/json

Body Parameters

FieldTypeRangeRequiredDescription
hls_segment_durationinteger4–15noDuration of each HLS segment in seconds. Applies to new uploads and reencodes.
{
  "hls_segment_duration": 10
}
⚠️

Validation

Values outside the 4–15 range, non-integer, or non-numeric return 400. Because the validator uses additionalProperties: false, the field must be declared — otherwise the whole request is rejected.

Behavior — what to expect

🚧

Applies to new videos only

Changing the value does not reprocess anything. Existing videos keep the segments they already have; the new value applies to the next upload or reencode.

  • The value comes from the library, not the upload. You cannot choose the duration per upload — it 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 during a long upload makes the new value take effect.
📘

Forcing a duration on a single video

The library value applies to every new upload. To force a specific duration for one video, a reencode of that video can override the library value — the library must have keep_original_files: true.

Success Response (200)

{
  "data": {
    "hls_segment_duration": 10
  }
}

Error Responses

  • 400 — value out of range, not an integer, or not numeric.
  • 404 — library not found.

Audit log

An audit log entry is queued (via SQS) for each changed attribute under the qualities category (encoding, playback, keep_original_files, compression_mode, hls_segment_duration).

Example — cURL

curl -X PUT "https://api-v2.pandavideo.com.br/library/{library_id}" \
  -H "Authorization: {api_key}" \
  -H "Content-Type: application/json" \
  -d '{"hls_segment_duration": 10}'
Path Params
uuid
required

Unique identifier of the library (UUID). Goes in the URL, not in the body.

Body Params
integer
4 to 15
Defaults to 6

Duration of each HLS segment in seconds. Integer 4-15, default 6. Applies to new uploads and reencodes only.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json