PlexSub
An open-source (MIT) Python CLI, Plex Pass webhook daemon, and OpenSubtitles + alass incremental upgrader generating synced sidecar .srt subtitles via faster-whisper, whisper.cpp, and optional Ollama post-processing.
Making Local Subtitles Reliable Automatically
Downloaded subtitles often drift by half a second or miss releases altogether, while firing heavy speech-to-text across an entire media library burns GPU time on files that don’t need it.
PlexSub is an MIT-licensed Python 3.11+ CLI and local Plex Pass webhook daemon that treats subtitle generation as an incremental, queue-driven pipeline—extracting what’s already there, checking timing before trusting it, and only reaching for heavier tools when needed.
How the Pipeline Works
- Plex Webhooks + Catch-Up Sync (
serve,sync): A FastAPI listener dispatches new library additions immediately while monotonic per-library watermarks catch anything missed during downtime. - Layered Local Scanning (
scan): Recursively discovers media files, extracts embedded text subtitle tracks, spot-checks existing sidecar timing via windowed ASR, promotes./Subs/SRTs, checks OpenSubtitles first when enabled, and falls back to local transcription. - Dual ASR Backends: Supports CTranslate2 CUDA/CPU (
faster-whisper) or Vulkan/CLIwhisper.cpp, paired with Silero VAD segmentation and lazy model unloading during idle windows so your GPU isn’t pinned forever. - Quota-Bounded Upgrader (
analyze,upgrade): Scores existing ASR subtitles for risk heuristics, respects daily OpenSubtitles download reserves and miss cooldowns, realigns candidate downloads against local reference cues withalass, and backs up previous sidecars (.asr.bak) before swapping them in. - Optional Ollama Cleanup & Translation (
translate): Cleans or translates cues into target-language UTF-8.srtfiles (<= 2 lines × 42 chars), bisecting batches automatically on malformed JSON/count responses and splitting overflow cues cleanly. - Resumable SQLite WAL Store: Tracks job state, cached media metadata (
duration_sec,audio_language), analysis scores, and OpenSubtitles history atomically while a single serialized ASR worker processes one job at a time.
Getting Started
git clone https://github.com/sudravirodhin/plexsub.git
cd plexsub
uv sync
cp config.example.toml config.toml
Fill in your Plex URL/token, path mappings, ASR backend, and optional OpenSubtitles or Ollama settings (all sensitive credentials also support PLEXSUB_* environment overrides), then run plexsub serve --catchup or plexsub scan <ROOT_DIR>. Full CLI commands and config reference live in the GitHub repository.