1.6 KiB
1.6 KiB
ADR-0002: K-TV owns the stream via a Playout Service
Status
Accepted
Context
The original design proxied streaming to each provider — Jellyfin served its own HLS, local files were either served directly or transcoded individually. This made it impossible to:
- Inject SCTE-35 markers for mid-roll breaks
- Insert timed metadata for overlays
- Stitch interstitial content between program items into a continuous stream
- Guarantee consistent stream format across providers
Decision
K-TV owns the stream end-to-end via a Playout Service. Providers expose a source URI (network URL or local file path) instead of a viewer-facing playback URL. The Playout Service reads from the source URI using FFmpeg on-demand (no full file download), and produces the HLS output with all audio/subtitle tracks, segmentation, SCTE-35, and timed metadata.
Alternatives considered
- Continue proxying to provider streams — rejected because mid-roll breaks, interstitials, and overlays require playlist-level control that provider-owned streams don't offer.
- Download files locally then transcode — rejected because it duplicates storage and defeats the purpose of having providers manage content.
Consequences
- Provider port changes from "give me a playback URL" to "give me a source URI."
- Every stream goes through FFmpeg — CPU cost scales with concurrent viewers. Caching segments mitigates repeat access.
- Subtitles and audio tracks come from the source container — no separate subtitle API needed.
- All viewers get a uniform HLS experience regardless of provider.
- Disk space management becomes critical — HLS segments must be cleaned up.