HLS output and recording
The hls sink writes playlists and fragmented media to a filesystem or
S3-compatible storage. It does not run a playback HTTP server. Serve the result
through the delivery component or storage/CDN appropriate to your deployment.
Start with the local recording configuration below, or use publish and record to add a recording alongside live SRT delivery. For object storage, follow the S3 recording recipe.
Packaging settings
| Setting | Location | Default | Unit / meaning |
|---|---|---|---|
url | protocol_options | Required for the destination | file:///output/ or your S3 endpoint. |
target_segment_duration | muxer_options | 10000 | Milliseconds; advertised range 1000–120000. |
target_part_duration | muxer_options | 1000 | Milliseconds; advertised range 500–60000. |
segment_list_size | muxer_options | 10 | Playlist window in segments; at least 5. |
delete_old_segments | S3 protocol_options | true | Delete expired objects. Set false only when retaining objects separately is intended. |
These plugin values use typed configuration objects:
[sinks.muxer_options]
target_segment_duration = { type = "u_int", value = 10_000 }
target_part_duration = { type = "u_int", value = 1000 }
segment_list_size = { type = "u_int", value = 17_280 }
The nominal window above is 48 hours: 17280 × 10 seconds. Actual segment lengths follow media boundaries, so this is an estimate of playlist duration, not disk capacity. Estimate storage separately from aggregate rendition bitrate and retention time.
Storage and restarts
For filesystem output, mount a writable persistent directory at the URL's path.
For S3, configure bucket, region, access_key_id, and secret_access_key
alongside the endpoint URL. Use the same destination/prefix when recovering a
recording. The sink attempts to recover playlist state and handles a restarted
stream with discontinuities; inspect recovery logs and resulting playlists.
Keeping old S3 objects does not keep them in the sliding playlist indefinitely. Coordinate object retention/lifecycle rules with the required playback window; removing referenced media breaks playback. Verify read/write/delete access with your storage provider and inspect both playlist and object behavior.
Check a recording
Confirm the sink is started and its byte counter increases. Inspect generated master/media playlists and ensure their segment URLs resolve from the playback location. Test audio and video in a player, and check that new segments appear and expired segments are removed as intended.
Local HLS recording example
Prepare media/input.mp4 using the quickstart.
Save local-hls.toml as config.toml.
This example writes 320×180 H.264 video and AAC audio to local HLS storage. It encodes with libx264, so use an image variant that includes x264; see Validation.
# Vindral Bridge Packager example
# Encode a file and write HLS to local disk.
version = "3"
[[sources]]
id = "input"
source_type = "file"
realtime_pacing = true
protocol_options = { url = "/media/input.mp4" }
[[transcoders]]
id = "encode"
source_ids = ["input"]
device = "cpu"
[[transcoders.tracks]]
id = "video"
type = "video"
track_selector = { type = "track-kind", kind = "video", is_required = true }
[[transcoders.tracks.renditions]]
id = "video-320"
codec = "h264"
encoder_name = "libx264"
bit_rate = 400_000
gop_size_ms = 1000
size = { scale_factor = 0.5 }
[[transcoders.tracks]]
id = "audio"
type = "audio"
passthrough = true
track_selector = { type = "track-kind", kind = "audio", is_required = true }
[[sinks]]
id = "hls"
sink_type = "hls"
source_ids = ["encode"]
protocol_options = { url = "file:///output/" }
[sinks.muxer_options]
target_segment_duration = { type = "u_int", value = 2000 }
segment_list_size = { type = "u_int", value = 10 }
Create and mount the output directory when starting the container:
mkdir -p output
docker run --rm --name packager-recording \
-p 127.0.0.1:4040:4040 \
-v "$PWD/config.toml:/etc/packager/config.toml:ro" \
-v "$PWD/media:/media:ro" \
-v "$PWD/output:/output" \
"${PACKAGER_IMAGE:?Set PACKAGER_IMAGE to your release image}" start
In another terminal, serve the files for a local playback test:
python3 -m http.server 8080 --bind 127.0.0.1 --directory output
Open http://127.0.0.1:8080/multivariant.m3u8 in an HLS player. The ten-segment
window with two-second segments is for testing; increase it to your recording
requirements using the settings above.