Repository navigation
Description
Summary
Add a nightly task that extracts embedded subtitle tracks from media files and saves them in shared subtitle storage under an Embedded category. Playback can then load the stored subtitle without reading the MKV to extract it on demand.
The task should process new or changed files and skip tracks that already have valid extracts.
User value / why v1
Embedded subtitles sometimes load slowly during playback. Preparing them ahead of time would reduce that delay, including on the first playback after extraction.
This supports the current focus on playback performance and polish. Release priority is open for discussion.
Proposed behavior
- Extract all supported embedded subtitle tracks, ideally in one pass per media file.
- Store extracts in shared S3 storage so any server node can serve them.
- Preserve language, title, forced/default flags, styling, and required font attachments. Preserve supported bitmap formats without requiring OCR.
- Keep the original embedded track identity in the subtitle picker; storing an extract should not create a duplicate entry.
- Use the stored extract when available and retain on-demand extraction as a fallback.
- Invalidate extracts when the source file changes and clean up artifacts for deleted files.
- Support configurable scheduling, manual execution, progress reporting, and bounded concurrency.
- Resume safely after interruption and prevent multiple nodes from extracting the same file concurrently.
Automatically queuing newly scanned files could be a later extension.
Technical notes
The existing internal/playback/subtitle_cache.go caches complete SUP, VTT, and ASS extracts on local disk. It is populated on demand and has a default 2 GiB eviction budget. Its comments explicitly note that extracting a small subtitle track can require reading a multi-GB source to completion.
This proposal adds persistent, shared preparation. Simply warming the existing cache nightly could evict earlier extracts before they are used.
The first library-wide run could create substantial I/O. Subsequent runs should only process missing or outdated extracts. Storage retention and unsupported-format behavior need to be agreed during design.
These notes come from source inspection; no playback benchmarks or deployment reproduction were performed for this proposal.
API surface
Reuse the existing administrator task operations documented in contracts/api/v2/openapi.json for scheduling, execution, cancellation, and progress where their semantics fit.
The current task API explicitly describes execution as process-local. Cluster-safe extraction requires separate coordination; it must not imply that existing task operations provide durable cluster-wide execution.
Expose feature availability through a /api/v2 capability endpoint. The exact capability fields and any subtitle-storage category additions remain to be designed before scope lock. No new /api/v1 contract work is proposed.
Client impact (android / apple / web)
- Web: expose the task through administration and show Embedded in subtitle storage management.
- Apple and Android: aim to preserve existing subtitle selection and delivery contracts. Verify both clients before ruling out follow-up work.
- Jellyfin compatibility: consider reuse of the stored extracts while preserving its subtitle inventory and delivery behavior.
Backend implementation belongs in silo-server; any required native client changes belong in silo-apple and silo-android.
Rough size (server-side)
M — provisional; format handling and cluster coordination may increase the scope.
Related issues
- [bug] Reuse cached embedded subtitle text for AI translation #1099 — reuse cached embedded subtitle text for AI translation.
- [ux] show subtitles in one language-first list #1029 — show subtitles in one language-first list.
- Protocol v3 subtitle sidecars are always served by the API node #625 — protocol v3 subtitle sidecars are always served by the API node.
AI disclosure
- AI harness: OpenAI Codex desktop app.
- AI tools: Codex agent using shell commands and GitHub CLI for source inspection and related-issue search.
- AI model:
gpt-6. - AI involvement: AI-assisted; user supplied the proposal, and Codex inspected the source and drafted the issue.
- Independent or adversarial review: n/a — proposal only; no implementation changes.
Activity
[-]Pre-extract embedded subtitles into shared storage with a nightly task[/-][+][v1] Pre-extract embedded subtitles into shared storage with a nightly task[/+]