Media & Streaming API
Plan playback modes, stream fragmented MP4 video or direct files, retrieve cached artwork, and fetch WebVTT subtitle tracks.
Request Playback Plan
Evaluates the file's audio and video streams against client decoder capabilities and returns the optimal playback mode (direct, remux, transcode):
GET /api/files/:id/plan?hevc=true&av1=false&audio=0&start=120.5
Authorization: Bearer <token>
Query Parameters
hevc:trueif client hardware can decode H.265/HEVC.av1:trueif client hardware can decode AV1.audio: Desired audio stream index (defaults to 0 or user preference).subtitle: Desired subtitle stream index.start: Target seek timestamp in seconds.raw: Set totruefor Desktopmpvdirect playback bypass.
Response (200 OK)
{
"mode": "remux",
"start": 118.4,
"audio": 0,
"subtitle": 2,
"video_codec": "h264",
"audio_codec": "aac",
"width": 1920,
"height": 1080
}
Stream Media Stream
Streams the media stream using the planned parameters:
GET /api/stream/:file_id?audio=0&start=118.4
Authorization: Bearer <token>
Playback Modes
- Direct Play: Returns
206 Partial Content(or200 OK) withAccept-Ranges: bytesandContent-Type: video/mp4. Supports fast seeking via byte offsets. - Remux / Transcode: Returns
200 OKwith chunked transfer encoding (Content-Type: video/mp4) streaming live fragmented MP4 fragments.
Fetch WebVTT Subtitles
Retrieves an extracted or converted WebVTT subtitle stream:
GET /api/subtitles/:stream_id
Authorization: Bearer <token>
Response (200 OK)
Content-Type: text/vtt; charset=utf-8
WEBVTT
00:01:14.200 --> 00:01:18.500
Welcome to the Kinema media server.
00:01:19.100 --> 00:01:23.400
Enjoy clean, high-performance streaming.
Fetch Cached Artwork / Poster
Returns cached TMDB or TVmaze artwork:
GET /api/images/:size/:name
Path Parameters
size:w500,original, orw300.name: Image filename hash.
Response (200 OK)
Content-Type: image/jpeg
Cache-Control: public, max-age=31536000, immutable