Stream
The stream command is the per-viewer half of the proxy pipeline: it runs once
for every connected TV, reads the local segments produced by the shared segmenter (or
playout) process, and sends the result to that viewer. That's why its input is a local file path,
not the upstream URL — the upstream is handled by the segmenter.
Because it runs per viewer, this is the place for cheap per-viewer processing. The default just repackages the video without re-encoding; transcoding here would run once per TV, so heavy work belongs in the segmenter or playout command instead.
Contract
- Input:
{{ .Stream.PlaylistPath }}— path to the local HLS playlist written by the segmenter/playout process. - Output: video stream data on
stdout.stderris printed to the debug logs. If the command exits with empty stdout, an upstream error is triggered.
YAML Structure
Fields
| Field | Type | Required | Description |
|---|---|---|---|
command |
Command |
No | Stream command. See Command. |
template_variables |
[]NameValue |
No | User variables available in the command. See Command. |
env_variables |
[]NameValue |
No | Environment variables for the command. |
The stream command receives the reserved variable {{ .Stream.PlaylistPath }} (the local HLS playlist) — see
Command → Reserved Variables.
Default Template Variables
These variables are used by the default command and can be overridden:
| Variable | Default | Description |
|---|---|---|
ffmpeg_log_level |
fatal |
ffmpeg -v log level |
Examples
Basic FFmpeg Remuxing
Repackage the local segments without re-encoding (the default behavior):
proxy:
stream:
command:
[ffmpeg, -v, error, -i, "{{ .Stream.PlaylistPath }}", -c, copy, -f, mpegts, "pipe:1"]
Transcoding with Custom Preset
Re-encode per viewer (heavier — prefer transcoding in the segmenter instead):
proxy:
stream:
command:
[ffmpeg, -v, "{{ .ffmpeg_log_level }}", -i, "{{ .Stream.PlaylistPath }}",
-c:v, libx264, -preset, ultrafast, -c:a, aac, -f, mpegts, "pipe:1"]
template_variables:
- { name: ffmpeg_log_level, value: error }
With Environment Variables
Pass configuration to a wrapper script via the environment: