McCloudS/subgen
À propos
Générez automatiquement des sous-titres avec le modèle Whisper d’OpenAI via Jellyfin, Plex, Emby, Tautulli ou Bazarr.
Autres projetsProgression mesurée des étoiles
- in 24h
- +3
- in 7 days
- +20
- in 15 days
- +26
- in 1 month
- +34
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalSubgen
[!TIP] No GPU? No problem. mermeow is a hosted Bazarr Whisper provider built on Subgen. Paste one URL into Bazarr and get subtitles without running anything yourself. Free hours to try it, and it helps fund Subgen. More below.
Updates:
29 Nov 2026: Stronger hallucination filtering with whisper.cpp: a speech check (Silero, after transcription), a check for passages that repeat themselves, and more invented credits. Each job now logs a short quality summary and warns when a result looks wrong. Queued files now survive a restart (QUEUE_FILE).
Nov 2026: Subgen now uses whisper.cpp. Every image runs whisper.cpp, on NVIDIA (CUDA), Intel and AMD GPUs including integrated graphics (Vulkan), and CPU, on amd64 and arm64, plus a new whisper.cpp image for NVIDIA Jetson. On NVIDIA it is about twice as fast as faster-whisper with less VRAM. Models download again on first start; see Upgrading from stable-ts for everything that changes. :amd now points to the Vulkan image (the ROCm image is retired). The images no longer include faster-whisper; standalone installs still use it unless whisper-cli is installed. The previous stable-ts version is preserved, unsupported, on the legacy-stable-ts branch. Fixes found by end-to-end testing: whisper.cpp couldn't read video files from webhooks, /batch or folder scans; /asr ignored its output parameter and always returned SRT (now txt, vtt, tsv and json work); Bazarr's raw audio (encode=false) failed on whisper.cpp. Subtitles keep hyphens, wrap every line at 42 characters and pace cues like professional subtitles. WHISPER_THREADS now sizes itself for whisper.cpp. New HALLUCINATION_FILTER (on by default) removes phrases Whisper loops over music and invented credits like "Transcription by CastingWords". Language detection now skips the first 90 seconds by default (DETECT_LANGUAGE_OFFSET), past most opening themes. See Speed, memory and concurrent transcriptions.
8 Jun 2026: Dropped stable-ts-whisperless (archived upstream). Subgen now drives faster-whisper directly with a built-in Netflix-style subtitle segmenter. New tuning variables: MAX_LINE_LENGTH, GAP_SPLIT_SECS, VAD_FILTER. Removed CUSTOM_REGROUP and WORD_LEVEL_HIGHLIGHT — these were stable-ts-specific and no longer have any effect.
7 Jun 2026: Fixed a bug where files containing only a forced embedded subtitle track were incorrectly treated as having full subtitle coverage and skipped. Forced tracks cover only a small fraction of dialogue (typically foreign-language inserts) and should not count as full coverage. Added IGNORE_FORCED_SUBTITLES (default True) to control this behaviour.
11 Apr 2026: Fixed subtitle timing on files with audio stream offsets (common in Amazon WEB-DL). Whisper ignores silence padding, causing subtitles to be early by the offset amount. Subgen now detects this via ffprobe and compensates automatically when the source video file is accessible. See Audio Start-Time Offset Fix for details.
27 Mar 2026: Potentially added ROCm support for AMD GPU/APUs. I don't have anything to test it, so a fair chance it doesn't work at all. I'm unsure if it will work with AMD APUs. Image is: mccloud/subgen:amd. It's pretty large right now at ~10gb. In theory, it should see your AMD card the same way it sees any other cuda device. Some light research shows ROCm only 'officially' supports higher end consumer cards and datacenter cards. HSA_OVERRIDE_GFX_VERSION can be set to 'trick' your old cards (and maybe APUs) to work, but you'll have to do your own research/googling.
17 Mar 2026: Added WEBHOOK_URL_COMPLETED. When a task finishes, Subgen will send a POST request with a JSON structure.
4 Mar 2026: Reformmated the readme and spend an hour with Gemini trying to format it and clean it up and it essentially only gave me icons for headers.
Feb 2026: Contributor helped cut the GPU container size in half. Added ASR_TIMEOUT as environment variable to timeout ASR endpoint transcriptions after X seconds.
31 Jan 2026: Added the ability to run the container 'rootless', accepts PUID and PGID as environment variables and should take user at a container level (Podman), let me know!.
13 Jan 2026: Probably fixed the runaway memory problems for CPU only. Added MODEL_CLEANUP_DELAY which will wait X seconds before purging the model to clear up (V)RAM. This mostly helps with Bazarr or when concurrent transcriptions is 1. Rewrote ASR (Bazarr) queuing so it should respect queing and follow concurrent transcriptions. Also fixed the error when too many Bazarr or ASR requests would start to fail.
26 Aug 2025: Renamed environment variables to make them slightly easier to understand. Currently maintains backwards compatibility. See https://github.com/McCloudS/subgen/pull/229
12 Aug 2025: Added distil-large-v3.5
7 Feb 2025: Fixed (V)RAM clearing, added PLEX_QUEUE_SEASON, other extraneous fixes or refactorting.
23 Dec 2025: Added PLEX_QUEUE_NEXT_EPISODE and PLEX_QUEUE_SERIES. Will automatically start generating subtitles for the next episode in your series, or queue the whole series.
4 Dec 2025: Added more ENV settings: DETECT_LANGUAGE_OFFSET, PREFERRED_AUDIO_LANGUAGES, SKIP_IF_AUDIO_TRACK_IS, ONLY_SKIP_IF_SUBGEN_SUBTITLE, SKIP_UNKNOWN_LANGUAGE, SKIP_IF_LANGUAGE_IS_NOT_SET_BUT_SUBTITLES_EXIST, SHOULD_WHISPER_DETECT_AUDIO_LANGUAGE
30 Nov 2024: Signifcant refactoring and handling by Muisje. Added language code class for more robustness and flexibility and ability to separate audio tracks to make sure you get the one you want. New ENV Variables: SUBTITLE_LANGUAGE_NAMING_TYPE, SKIP_IF_AUDIO_TRACK_IS, PREFERRED_AUDIO_LANGUAGE, SKIP_IF_TO_TRANSCRIBE_SUB_ALREADY_EXIST There will be some minor hiccups, so please identify them as we work through this major overhaul.
22 Nov 2024: Updated to support large-v3-turbo
30 Sept 2024: Removed webui
5 Sept 2024: Fixed Emby response to a test message/notification. Clarified Emby/Plex/Jellyfin instructions for paths.
14 Aug 2024: Cleaned up usage of kwargs across the board a bit. Added ability for /asr to encode or not, so you don't need to worry about what files/formats you upload.
3 Aug 2024: Added SUBGEN_KWARGS environment variable which allows you to override the model.transcribe with most options you'd like from faster-whisper. This won't be exposed via the webui, it's best to set directly.
21 Apr 2024: Fixed queuing with thanks to https://github.com/xhzhu0628 @ https://github.com/McCloudS/subgen/pull/85. Bazarr intentionally doesn't follow CONCURRENT_TRANSCRIPTIONS because it needs a time sensitive response.
31 Mar 2024: Removed /subsync endpoint and general refactoring. Open an issue if you were using it!
22 Mar 2024: Added LRC capability via see: LRC_FOR_AUDIO_FILES | True | Will generate LRC (instead of SRT) files for filetypes: '.mp3', '.flac', '.wav', '.alac', '.ape', '.ogg', '.wma', '.m4a', '.m4b', '.aac', '.aiff'
21 Mar 2024: Added a 'wizard' into the launcher that will help standalone users get common Bazarr variables configured. See below in Launcher section. Removed 'Transformers' as an option. While I usually don't like to remove features, I don't think anyone is using this and the results are wildly unpredictable and often cause out of memory errors. Added two new environment variables called USE_MODEL_PROMPT and CUSTOM_MODEL_PROMPT. If USE_MODEL_PROMPT is True it will use CUSTOM_MODEL_PROMPT if set, otherwise will default to using the pre-configured language pairings. These pre-configurated translations are geared towards fixing some audio that may not have punctionation. We can prompt it to try to force the use of punctuation during transcription.
19 Mar 2024: Added a MONITOR environment variable. Will 'watch' or 'monitor' your TRANSCRIBE_FOLDERS for changes and run on them. Useful if you just want to paste files into a folder and get subtitles.
5 Mar 2024: Cleaned up logging. Added timestamps option (if Debug = True, timestamps will print in logs).
4 Mar 2024: Updated Dockerfile CUDA to 12.2.2 (From CTranslate2). Added endpoint /status to return Subgen version. Can also use distil models now! See variables below!
29 Feb 2024: Changed default port to align with whisper-asr and deconflict other consumers of the previous port.
11 Feb 2024: Added a 'launcher.py' file for Docker to prevent huge image downloads. Now set UPDATE to True if you want pull the latest version, otherwise it will default to what was in the image on build. Docker builds will still be auto-built on any commit. If you don't want to use the auto-update function, no action is needed on your part and continue to update docker images as before. Fixed bug where detect-langauge could return an empty result. Reduced useless debug output that was spamming logs and defaulted DEBUG to True. Added APPEND, which will add a transcribed watermark at the end of a subtitle.
10 Feb 2024: Added some features from JaiZed's branch such as skipping if SDH subtitles are detected, functions updated to also be able to transcribe audio files, allow individual files to be manually transcribed, and a better implementation of forceLanguage. Added /batch endpoint (Thanks JaiZed). Allows you to navigate in a browser to http://subgen_ip:9000/docs and call the batch endpoint which can take a file or a folder to manually transcribe files. Added CLEAR_VRAM_ON_COMPLETE, HF_TRANSFORMERS, HF_BATCH_SIZE. Hugging Face Transformers boast '9x increase', but my limited testing shows it's comparable to faster-whisper or slightly slower. I also have an older 8gb GPU. Simplest way to persist HF Transformer models is to set "HF_HUB_CACHE" and set it to "/subgen/models" for Docker (assuming you have the matching volume).
8 Feb 2024: Added FORCE_DETECTED_LANGUAGE_TO to force a wrongly detected language. Fixed asr to actually use the language passed to it.
5 Feb 2024: General housekeeping, minor tweaks on the TRANSCRIBE_FOLDERS function.
28 Jan 2024: Fixed issue with ffmpeg python module not importing correctly. Removed separate GPU/CPU containers. Also removed the script from installing packages, which should help with odd updates I can't control (from other packages/modules). The image is a couple gigabytes larger, but allows easier maintenance.
19 Dec 2023: Added the ability for Plex and Jellyfin to automatically update metadata so the subtitles shows up properly on playback. (See https://github.com/McCloudS/subgen/pull/33 from Rikiar73574)
31 Oct 2023: Added Bazarr support via Whipser provider.
25 Oct 2023: Added Emby (IE http://192.168.1.111:9000/emby) support and TRANSCRIBE_FOLDERS, which will recurse through the provided folders and generate subtitles. It's geared towards attempting to transcribe existing media without using a webhook.
23 Oct 2023: There are now two docker images, ones for CPU (it's smaller): mccloud/subgen:latest, mccloud/subgen:cpu, the other is for cuda/GPU: mccloud/subgen:cuda. I also added Jellyfin support and considerable cleanup in the script. I also renamed the webhooks, so they will require new configuration/updates on your end. Instead of /webhook they are now /plex, /tautulli, and /jellyfin.
22 Oct 2023: The script should have backwards compability with previous envirionment settings, but just to be sure, look at the new options below. If you don't want to manually edit your environment variables, just edit the script manually. While I have added GPU support, I haven't tested it yet.
19 Oct 2023: And we're back! Uses faster-whisper. Shouldn't break anything from previous settings, but adds a couple new options that aren't documented at this point in time. As of now, this is not a docker image on dockerhub. The potential intent is to move this eventually to a pure python script, primarily to simplify my efforts. Quick and dirty to meet dependencies: pip or pip3 install flask requests faster-whisper
2 Feb 2023: Added Tautulli webhooks back in. Didn't realize Plex webhooks was PlexPass only. See below for instructions to add it back in.
31 Jan 2023 : Rewrote the script substantially to remove Tautulli and fix some variable handling. For some reason my implementation requires the container to be in host mode. My Plex was giving "401 Unauthorized" when attempt to query from docker subnets during API calls. (Fixed now, it can be in bridge)
🎬 What is this?
Subgen transcribes your personal media to create subtitles (.srt or .lrc) from audio/video files. It can transcribe non-English languages to themselves, or translate foreign languages into English.
It is designed to integrate perfectly with Bazarr (as a Whisper Provider), or run via webhooks triggered directly by your Plex, Emby, Jellyfin, or Tautulli servers whenever media is added or played. Under the hood, it uses whisper.cpp (or faster-whisper) for AI transcription and a built-in Netflix-style subtitle segmenter for clean, readable output. CPU, NVIDIA (CUDA), and Intel or AMD GPUs (Vulkan) are supported.
🤔 Why?
Some shows just won't have subtitles available, or embedded H265 subtitles might be wildly out of sync. This gap-fills everything else by generating highly accurate subtitles locally on your own hardware.
☁️ No GPU? Try mermeow
Don't have the hardware to run Whisper yourself, or don't want another container to keep running? mermeow is a hosted Bazarr Whisper provider I run, built on Subgen's subtitle pipeline: the same line splitting, Netflix-style pacing and hallucination filtering you get here.
- Nothing to install: paste your personal mermeow URL into Bazarr's Whisper provider and you're done.
- Fast: Whisper large-v3-turbo runs in the cloud. An hour of audio is usually transcribed in about 20 seconds; most of the wait is Bazarr extracting and uploading the audio.
- Try it free: sign in with GitHub for free hours, then add more with a monthly or one-time GitHub sponsorship.
- Supports Subgen: it helps fund the time I put into this project.
mermeow only works through Bazarr (no Plex, Jellyfin, Emby or Tautulli webhooks). Only the audio Bazarr sends is uploaded, and it's deleted when the job finishes. Subgen itself stays free and open source, and running it on your own hardware is still the main way to use it.
⚡ Quick Start: Bazarr (The Bare Minimum)
If you just want to plug Subgen into Bazarr and get going, here is the absolute minimum you need to configure in your Subgen Docker container. No path mapping or media mounts are needed!
1. Set your Environment Variables in Subgen:
- Pick the image for your hardware (see Docker) and give the container the GPU:
--gpus allfor NVIDIA,--device /dev/drifor Intel or AMD. whisper.cpp uses the GPU automatically. (TRANSCRIBE_DEVICE=cudais only needed for faster-whisper.) WHISPER_MODEL: Default ismedium.large-v3-turbois faster and more accurate on any GPU; its quantized versionlarge-v3-turbo-q5_0needs about 1 GB of video memory. Note:large-v3-turboonly supports transcription. If you need translation (e.g.TRANSCRIBE_OR_TRANSLATE=translate), uselarge-v3instead.CONCURRENT_TRANSCRIPTIONS: Default is2. Each concurrent job holds its own copy of the model with whisper.cpp; see Speed, memory and concurrent transcriptions.
2. Configure Bazarr:
- In Bazarr, go to Settings > Whisper Provider.
- Select Whisper as the provider.
- Set the Docker Endpoint to your Subgen IP and port:
http://<your-ip>:9000(Note: Do not use127.0.0.1if Bazarr is also in a Docker container). - Save! Subgen will now act as an invisible, self-hosted API for Bazarr's transcription requests.
3. Disable Auto-Sync for Subgen subtitles (important):
Subgen already produces accurately timed subtitles. If you have Bazarr's Automatic Subtitles Audio Synchronization enabled, you must exclude whisperai from it — otherwise Bazarr will run ffsubsync on top of already-synced subtitles and degrade their quality.
- In Bazarr, go to Settings > Subtitles > Audio Synchronization.
- Under "Do not sync subtitles downloaded from those providers", add
whisperai.
🔧 Audio Start-Time Offset Fix
Some media containers — particularly Amazon WEB-DL files — have an audio stream that starts later than the video stream (e.g., audio start_time of ~4 seconds). When Bazarr extracts audio from these files, it compensates by prepending silence via ffmpeg's adelay filter. However, Whisper's speech recognition completely ignores this digital silence, producing timestamps that are early by the offset amount (e.g., every subtitle appears ~4 seconds too early).
Subgen now automatically detects and compensates for this. When the source video file is accessible, it uses ffprobe to read the audio stream's start_time metadata, then shifts all Whisper timestamps forward by that amount after transcription.
This fix is fully backwards compatible. If the video file is not accessible, or has no audio offset (i.e. start_time is 0), behaviour is completely unchanged.
How to enable it (Bazarr)
Mount your media into the Subgen container with the same paths that Bazarr sees. For example, if Bazarr sees TV shows at
/tv, add a volume mount so Subgen also sees/tv:volumes: - /path/to/your/tv:/tv - /path/to/your/movies:/moviesEnable "Pass Video Name" in Bazarr. Go to Settings > Whisper Provider and check the Pass Video Name option. This tells Bazarr to send the video file path alongside the audio, allowing Subgen to look up the source file and detect any audio offset.
That's it. No new environment variables are required. Files without an audio offset are unaffected.
🛠 Installation & Setup
1. Docker (Recommended)
The easiest way to run Subgen is via Docker. We maintain images on Docker Hub (mccloud/subgen), all using whisper.cpp. Tags are named by GPU backend, so pick the one your hardware needs:
| Tag | Hardware | How to pass the GPU |
|---|---|---|
mccloud/subgen:latest (also :cuda) |
NVIDIA, GTX 10xx / Tesla P4 (Pascal) and newer, CUDA 12.8 | --gpus all (or --runtime=nvidia) |
mccloud/subgen:vulkan (also :amd) |
Intel iGPU/Arc, AMD GPUs and APUs, any other Vulkan GPU (amd64 and arm64) | --device /dev/dri |
mccloud/subgen:cpu |
No GPU (amd64 and arm64) | |
mccloud/subgen:jetson |
NVIDIA Jetson Orin / Thor | see below |
Each tag also has a version-pinned copy (e.g. :2026.11.5-cuda). Development builds use the same names with a dev- prefix (:dev-cuda, :dev-vulkan, :dev-cpu, :dev-jetson; :dev is :dev-cuda) and may be unstable.
Crucial Note on Volume Mapping: If you are using Plex/Emby/Jellyfin/Tautulli webhooks, Subgen must see your media paths exactly identically to how your media server sees them. For example, if Plex uses /Share/media/TV:/tv, Subgen needs that exact same volume mount. (Note: This does not apply to Bazarr, which sends audio over HTTP).
1b. NVIDIA Jetson (Orin / Thor, arm64)
mccloud/subgen:jetson is whisper.cpp built with CUDA for Jetson (Orin natively; newer chips such as Thor compile it on first use). Requirements: JetPack 6+ (L4T r36+) with nvidia-container-toolkit. Run it with --runtime nvidia and PUID=0 (Jetson's GPU memory device is root-only); see docker-compose.jetson.yml. Check the log for whisper.cpp is using GPU device: .... See docs/JETSON.md for how CUDA is wired up and why the usual nvidia/cuda images break on Jetson. This image is built and tested by CI without a GPU; reports from Jetson owners are welcome.
2. Standalone (Without Docker)
Install Python 3.11 or 3.12 and
ffmpeg.Ensure you have the proper NVIDIA drivers/CUDA toolkit installed (if using GPU).
Download
launcher.pyfrom this repository and run:python3 launcher.py -u -i -sFor the dev branch, add
-b dev. The launcher installs the requirements of the branch you choose.
(Launcher includes a wizard to help standalone users easily configure common variables).
A standalone install transcribes with faster-whisper. To use whisper.cpp instead (for example on an AMD or Intel GPU), build or install whisper-cli from whisper.cpp and put it on your PATH or set WHISPER_CLI_PATH; subgen then picks it automatically (see TRANSCRIBE_BACKEND).
3. Unraid
While Unraid doesn't have an app or template for quick install, with minor manual work, you can easily install it. See this discussion thread for pictures and steps.
🔌 Integrations & Webhooks Setup
Choose your preferred integration below. Do not enable multiple webhooks for the same media events (e.g., don't use both Tautulli and Plex webhooks for "playback start"), or you will generate duplicate subtitles!
🟠 Plex
Requires Plex Pass. Plex and Subgen must have identical path configurations (or use Path Mapping).
- In Plex, go to Settings > Webhooks.
- Add a new webhook pointing to your Subgen instance:
http://<your-ip>:9000/plex - You will also need to generate a Plex Token.
- Relevant Variables:
PLEX_SERVER,PLEX_TOKEN.
🔵 Jellyfin
Jellyfin and Subgen must have identical path configurations (or use Path Mapping).
- Install the Webhooks plugin in Jellyfin.
- Click Add Generic Destination.
- Name it whatever you like, and set the Webhook URL to:
http://<your-ip>:9000/jellyfin - Check Item Added, Playback Start, and Send All Properties.
- Click Add Request Header. Set Key:
Content-Typeand Value:application/json. - Relevant Variables:
JELLYFIN_SERVER,JELLYFIN_TOKEN.
🟢 Emby
Emby and Subgen must have identical path configurations (or use Path Mapping). Emby responses contain full info, so no API tokens are required!
- In Emby, create a webhook pointing to:
http://<your-ip>:9000/emby - Set Request content type to
multipart/form-data. - Configure your desired events (Usually
New Media Added,Start, andUnpause).
🟣 Tautulli
Tautulli and Subgen must have identical path configurations (or use Path Mapping).
Create two separate Webhooks in Tautulli pointing to http://<your-ip>:9000/tautulli using the POST method.
Webhook 1: Playback Start
- Trigger: Playback Start
- JSON Header:
{"source": "Tautulli"} - Data (JSON):
{"event": "played", "file": "{file}", "filename": "{filename}", "mediatype": "{media_type}"}
Webhook 2: Recently Added
- Trigger: Recently Added
- JSON Header:
{"source": "Tautulli"} - Data (JSON):
{"event": "added", "file": "{file}", "filename": "{filename}", "mediatype": "{media_type}"}
⚙️ Configuration (Environment Variables)
Note: Subgen recently standardized environment variable names (e.g., PLEX_TOKEN). Legacy names (e.g., PLEXTOKEN) are still fully supported for backwards compatibility!
🧠 Core Whisper & AI Settings
| Variable | Default | Description |
|---|---|---|
TRANSCRIBE_DEVICE |
cpu |
faster-whisper only (standalone installs): cpu, gpu, or cuda. whisper.cpp uses a GPU automatically; see WHISPER_CPP_DEVICE. |
WHISPER_MODEL |
medium |
Model to use: tiny, base, small, medium, large-v3, distil-large-v3, large-v3-turbo, quantized versions like large-v3-turbo-q5_0, etc. See Choosing a model. large-v3-turbo does not support translation (fine-tuned on transcription only) — use large-v3 if TRANSCRIBE_OR_TRANSLATE=translate. |
CONCURRENT_TRANSCRIPTIONS |
2 |
Number of files to process in parallel. With whisper.cpp each one loads its own copy of the model, so memory grows with this number. See Speed, memory and concurrent transcriptions. |
WHISPER_THREADS |
auto / 4 |
CPU threads per transcription. whisper.cpp: unset means the CPU cores are shared between CONCURRENT_TRANSCRIPTIONS (between 4 and 16 each, never more than the machine has cores). faster-whisper: 4. |
COMPUTE_TYPE |
auto |
faster-whisper only. Precision quantization mapping (e.g., float16, int8). See CTranslate2 docs. With whisper.cpp, pick a quantized model instead (e.g. large-v3-turbo-q5_0). |
CLEAR_VRAM_ON_COMPLETE |
True |
Do garbage collection and clear the model from VRAM when the queue is empty. |
MODEL_CLEANUP_DELAY |
30 |
Seconds to wait before clearing the Whisper model from memory. |
ASR_TIMEOUT |
18000 |
Seconds to wait before timing out a transcription request (default 5 hours). |
HALLUCINATION_FILTER |
True |
Removes common Whisper hallucinations. A phrase of 3 or more words looped back to back 3 or more times keeps only its first copy, and cues that are only an invented credit ("Transcription by CastingWords", "Subtitles by the Amara.org community", "For more information, visit www.fema.org") are dropped. With whisper.cpp it also drops passages that repeat themselves (the same check OpenAI's Whisper uses), and runs Silero speech detection after transcription: a cue with no speech under it is dropped when Whisper was unsure of it or when it's a phrase Whisper typically invents ("Thank you.", "We'll be right back.", "(dramatic music)"). Confident lines are kept even where speech detection hears nothing, since it can miss shouting or singing over music. Short repeats such as "No! No! No!" and phrases said twice are never touched. A line really repeated 3 or more times in a row (a chant, a song chorus) keeps only one copy; set to False to keep everything. |
VAD_FILTER |
False |
Run Silero VAD before transcription to strip silence. Can reduce hallucinations on quiet segments, but may also drop dialogue. Set to True to enable. faster-whisper only for now: whisper.cpp's VAD breaks subtitle timing, so subgen ignores this setting with whisper.cpp and logs a warning. |
SUBGEN_KWARGS |
{} |
faster-whisper only. JSON dict of extra kwargs passed directly to faster-whisper's model.transcribe() (e.g. {"beam_size": 10}). For advanced users. |
🖥️ Backend & GPU (whisper.cpp)
whisper.cpp runs on NVIDIA (CUDA), AMD and Intel GPUs including integrated graphics (Vulkan), and CPU. It is what every Docker image uses, and the default whenever the whisper-cli binary is present.
| Variable | Default | Description |
|---|---|---|
TRANSCRIBE_BACKEND |
auto |
auto uses whisper.cpp when whisper-cli is installed, otherwise faster-whisper. Force one with whispercpp or faster-whisper. The whisper.cpp images don't include faster-whisper, so asking for it there logs a warning and uses whisper.cpp. |
WHISPER_CPP_MODEL |
(derived) | Path to a GGML model file. If unset, it is derived from WHISPER_MODEL (e.g. large-v3-turbo → ggml-large-v3-turbo.bin) and downloaded to MODEL_PATH. |
WHISPER_CPP_REPO |
(derived) | Hugging Face repo to download WHISPER_CPP_MODEL from. |
WHISPER_CLI_PATH |
whisper-cli |
Path to the whisper-cli binary. |
WHISPER_CPP_DEVICE |
(auto) | whisper.cpp uses a GPU automatically when it can see one. Set a GPU index (0, 1, ...) to pick one, or cpu to force CPU. TRANSCRIBE_DEVICE only applies to faster-whisper. Check the log for whisper.cpp is using GPU device: .... |
WHISPER_CPP_VAD_MODEL |
(auto) | Silero VAD model for whisper.cpp, downloaded on first use (under 1 MB). Used by HALLUCINATION_FILTER's speech check after transcription; whisper.cpp's own VAD stays disabled (see VAD_FILTER). |
VAD_THRESHOLD |
0.5 |
Speech probability threshold for whisper.cpp VAD (currently disabled). |
⚡ Processing Triggers & Queuing
(Not relevant for Bazarr users)
| Variable | Default | Description |
|---|---|---|
PROCESS_ADDED_MEDIA |
True |
Generate subs for newly added media (when triggered by webhook). |
PROCESS_MEDIA_ON_PLAY |
True |
Generate subs for media when it is played (when triggered by webhook). |
TRANSCRIBE_FOLDERS |
'' |
Pipe-separated list (e.g., /tv|/movies) to recurse through and queue existing media. |
MONITOR |
False |
Actively watches TRANSCRIBE_FOLDERS in real-time for newly pasted files. |
SKIP_STARTUP_SCAN |
False |
Skips the startup scan of TRANSCRIBE_FOLDERS entirely. Subgen will still watch for new files if MONITOR is enabled, but won't iterate existing files on start. Useful if your library is already subtitled and you only want to catch newly added files. |
QUEUE_FILE |
MODEL_PATH/subgen_queue.json |
Where queued file jobs (folder scans and Plex, Jellyfin, Emby and Tautulli webhooks) are saved, so they resume after a restart. Uploads from Bazarr aren't saved; Bazarr retries those itself. Set to an empty value to keep the queue in memory only. |
PLEX_QUEUE_NEXT_EPISODE |
False |
Auto-queues the next Plex episode when Subgen is triggered. |
PLEX_QUEUE_SEASON |
False |
Auto-queues the entire remaining season when Subgen is triggered. |
PLEX_QUEUE_SERIES |
False |
Auto-queues the entire remaining series when Subgen is triggered. |
WEBHOOK_URL_COMPLETED |
'' |
Sends a POST to the WEBHOOK_URL_COMPLETED URL with a JSON containing: {It will not fire on skips, /asr or /detect-language. |
⏭️ Skip Logic & Audio Targeting
Prevent Subgen from wasting time on files that don't need subtitles.
Directory skip marker: Place an empty .subgen_skip file in any directory to tell Subgen to skip that directory and all of its subdirectories — both during the startup scan and when watching for new files. Useful for completed shows or any section of your library that will never need new subtitles.
touch "/tv/The Simpsons/.subgen_skip" # skips all seasons
touch "/tv/Some Show/Season 1/.subgen_skip" # skips just that season
| Variable | Default | Description |
|---|---|---|
SKIP_IF_TARGET_SUBTITLES_EXIST |
True |
Skips if an auto-generated subtitle in your desired language already exists. |
SKIP_IF_EXTERNAL_SUBTITLES_EXIST |
False |
Skips if an external subtitle matching SUBTITLE_LANGUAGE_NAME is found. |
SKIP_IF_INTERNAL_SUBTITLES_LANGUAGE |
eng |
Skips if the file contains an embedded sub with this 3-letter code. |
SKIP_SUBTITLE_LANGUAGES |
'' |
Pipe-separated list (e.g., eng|spa). Skips if the file has audio in these languages. |
SKIP_IF_AUDIO_LANGUAGES |
'' |
Pipe-separated list (ISO 639-2). Skips generation if the file has audio tracks in these languages. |
PREFERRED_AUDIO_LANGUAGES |
eng |
Pipe-separated list. If multiple audio tracks exist, prefer transcribing this one. |
LIMIT_TO_PREFERRED_AUDIO_LANGUAGE |
False |
If True, skips files that do not have any audio tracks matching your preferred list. |
FORCE_DETECTED_LANGUAGE_TO |
'' |
Force model to this 2-letter language code if it keeps incorrectly detecting audio. |
DETECT_LANGUAGE_LENGTH |
30 |
Number of seconds to analyze audio to determine the language. |
DETECT_LANGUAGE_OFFSET |
90 |
Seconds to skip before detecting language, past most opening themes (Whisper can mistake intro music for another language). Audio shorter than DETECT_LANGUAGE_OFFSET + DETECT_LANGUAGE_LENGTH uses its last DETECT_LANGUAGE_LENGTH seconds instead, or all of it from the start if it is shorter than that. Set 0 to detect from the very start. |
SHOULD_WHISPER_DETECT_AUDIO_LANGUAGE |
False |
Should Whisper detect language if there is no audio language tagged in the media file. |
SKIP_UNKNOWN_LANGUAGE |
False |
Skip processing if Whisper cannot detect the audio language. |
SKIP_ONLY_SUBGEN_SUBTITLES |
False |
Skips generation only if the file has "subgen" somewhere in the existing subtitle filename. |
SKIP_IF_NO_LANGUAGE_BUT_SUBTITLES_EXIST |
False |
Skips generation if file doesn't have an audio stream marked with a language, but subtitles exist. |
IGNORE_FORCED_SUBTITLES |
True |
When True, forced embedded subtitle tracks are excluded from all skip-coverage checks. A file whose only matching subtitle tracks are forced will be treated as having no coverage and transcribed normally. Set to False to count forced tracks as full coverage (old behaviour). |
PROBE_CACHE_PATH |
MODEL_PATH/subgen_probe_cache.db |
Path to a sqlite file that caches raw stream facts (codecs, language tags, forced/default flags) per media file, keyed by path, size and mtime, so restarts don't re-probe unchanged files over slow mounts. An in-memory cache is always used, and skip decisions are never cached. Set to none to keep it in memory only. If MODEL_PATH is on a network filesystem (NFS, SMB/CIFS, sshfs, ...) or Unraid's /mnt/user FUSE layer, the default falls back to memory only and logs it. On Unraid, an exclusive appdata share or a pool path such as /mnt/cache/appdata keeps the cache on disk. An explicit path should be on local disk, because sqlite is not reliable on those filesystems. If several subgen instances share one models folder, give each its own file. |
PROBE_WORKERS |
min(4, usable CPUs) |
Threads that run ffprobe ahead of the startup scan (TRANSCRIBE_FOLDERS, /batch) so the sequential skip checks find each file's probe result already cached. The scan runs at most 8 files per worker ahead. 1 or 0 disables prefetching. Lower it on slow spinning disks or network mounts if scans contend with transcription. Invalid values log a warning and use the default. Skip decisions are not affected. |
Not sure why a file is being skipped? Use the Skip Logic Calculator — configure your settings, describe what subtitle files and streams exist, and it shows exactly what triggered the skip.
📝 Subtitle Formatting & Preferences
| Variable | Default | Description |
|---|---|---|
TRANSCRIBE_OR_TRANSLATE |
transcribe |
transcribe (matches input language) or translate (outputs English). |
SUBTITLE_LANGUAGE_NAME |
(detected language) | Language code to put in the subtitle file name instead of the detected one (e.g. en). Many people set aa so subgen's file floats to the top of Plex's list. |
SUBTITLE_LANGUAGE_NAMING_TYPE |
ISO_639_2_B |
Format to name files (ISO_639_1, ISO_639_2_T, NAME, NATIVE). |
LRC_FOR_AUDIO_FILES |
True |
Generates .lrc instead of .srt if processing pure audio files (e.g., mp3, flac). |
MAX_LINE_LENGTH |
42 |
Maximum characters per subtitle line. Lines are balanced across two rows where possible. |
GAP_SPLIT_SECS |
0.4 |
Silence gap in seconds between words that forces a new subtitle card. |
APPEND |
False |
Appends a "Transcribed by whisperAI..." watermark at the very end of the .srt. |
SHOW_IN_SUBNAME_SUBGEN |
True |
Adds .subgen to the output file name. |
SHOW_IN_SUBNAME_MODEL |
True |
Adds the model used (e.g., .medium) to the output file name. |
📂 System, Paths & Network Settings
| Variable | Default | Description |
|---|---|---|
WEBHOOK_PORT |
9000 |
Port used to listen for webhooks and Bazarr requests. |
PUID / PGID |
99 / 100 |
Run container as a specific user/group (helps with file permissions). |
DEBUG |
True |
Outputs extra logs, helpful for troubleshooting paths or webhook hits. |
RELOAD_SCRIPT_ON_CHANGE |
False |
(Dev) Auto-reloads uvicorn if subgen.py is edited. |
UPDATE |
False |
(Standalone) Will pull the latest subgen.py from repo via launcher.py. |
USE_PATH_MAPPING |
False |
Set to True if your media server and Subgen map their volumes differently. |
PATH_MAPPING_FROM |
/tv |
Example: The media path on Plex. |
PATH_MAPPING_TO |
/Volumes/TV |
Example: What Subgen natively sees that same path as. |
MODEL_PATH |
./models |
Path where AI models are downloaded and stored. |
🎬 Media Server Integration (Metadata Refreshing)
Required if you want Subgen to automatically generate Subtitles off of Webhook Events from Plex or Jellyfin or to tell Plex or Jellyfin to refresh the show's metadata so the subtitle immediately appears after generation.
| Variable | Default | Description |
|---|---|---|
PLEX_SERVER |
(None) | Local Plex address (e.g., http://192.168.1.100:32400). |
PLEX_TOKEN |
(None) | Your Plex Token for API access. |
JELLYFIN_SERVER |
(None) | Local Jellyfin address (e.g., http://192.168.1.100:8096). |
JELLYFIN_TOKEN |
(None) | Generated API token from Jellyfin UI. |
🧩 Choosing a model
Set WHISPER_MODEL to one of these names. With whisper.cpp, subgen downloads the matching GGML file to MODEL_PATH on first use (or set WHISPER_CPP_MODEL to a .bin file of your own). Memory use is about the file size plus 0.3 to 0.5 GB per concurrent transcription; large-v3-turbo-q5_0 measured 1.0 GB of video memory.
WHISPER_MODEL |
File size | Translate to English? | Notes |
|---|---|---|---|
large-v3-turbo |
1.5 GB | No | Best speed/accuracy balance on a GPU. |
large-v3-turbo-q8_0 / -q5_0 |
833 / 547 MB | No | Quantized turbo: about a third of the memory. q5_0 is what the benchmarks in this README used. |
large-v3 |
2.9 GB | Yes | Most accurate. Use this (or a quantized version) for TRANSCRIBE_OR_TRANSLATE=translate. |
large-v3-q5_0 |
1.0 GB | Yes | Quantized large-v3, good for translation on smaller GPUs. |
large-v2, large-v2-q8_0, large-v2-q5_0, large-v1 |
1.0 to 2.9 GB | Yes | Older large models. |
distil-large-v3.5, distil-large-v3 |
1.4 GB | No | Distilled, English only, fast. distil-large-v3.fp32 is a 2.9 GB full-precision version. |
medium (default), medium-q8_0, medium-q5_0 |
1.5 GB / 785 MB / 514 MB | Yes | Good on CPU. |
small, small-q8_0, small-q5_1 |
465 / 252 / 181 MB | Yes | Low-power machines. |
base, base-q8_0, base-q5_1 |
141 / 77 / 56 MB | Yes | Low-power hardware; less accurate. |
tiny, tiny-q8_0, tiny-q5_1 |
74 / 41 / 30 MB | Yes | Testing only. |
- Add
.enfor English-only versions ofmedium,small,baseandtiny(e.g.small.en,base.en-q5_1). They are slightly better at English but can't detect or transcribe other languages. - Quantized names (
-q5_0,-q8_0,-q5_1) are whisper.cpp only. faster-whisper accepts the plain names (large-v3,large-v3-turbo,distil-large-v3,medium, ...) and sets precision withCOMPUTE_TYPEinstead. - An unknown name stops subgen with an error that tells you to set
WHISPER_CPP_MODEL.
🚀 Speed, memory and concurrent transcriptions
Subgen loads the model once per transcription slot, and CONCURRENT_TRANSCRIPTIONS is the number of slots. Extra files wait in the queue; they never start another copy of the model.
- faster-whisper loads one model and shares it between the slots.
- whisper.cpp runs each transcription as its own
whisper-cliprocess with its own copy of the model. Loading takes under a second, but memory grows with every slot. Language detection (used by Bazarr) can briefly add one more copy.
Running two files at once is not twice as fast on a GPU: one transcription already keeps the GPU busy. Measured with large-v3-turbo-q5_0, 5-minute clips:
| Hardware | Concurrent jobs | Throughput | Memory |
|---|---|---|---|
| Tesla P4 (CUDA) | 1 | 21x real time | 1.0 GB VRAM |
| Tesla P4 (CUDA) | 2 | 24x (+15%) | 2.0 GB VRAM |
| Tesla P4 (CUDA) | 3 | 25x (+19%) | 3.0 GB VRAM |
| 24-core CPU | 1 job, 4 threads | 2.5x | 0.8 GB RAM |
| 24-core CPU | 1 job, 16 threads | 6.0x | 0.8 GB RAM |
| 24-core CPU | 2 jobs, 8 threads each | 6.6x | 1.6 GB RAM |
Recommendations
- GPU:
CONCURRENT_TRANSCRIPTIONS=1gives nearly the same throughput with half the memory. Use2if you have spare video memory and want a Bazarr request to start while a webhook job is still running (Bazarr requests already jump ahead of queued webhook jobs). - CPU: leave
WHISPER_THREADSunset. Subgen shares the cores between the slots, which is close to the best you can get. - Running out of memory: lower
CONCURRENT_TRANSCRIPTIONSfirst, then use a smaller or quantized model (large-v3-turbo-q5_0,medium). Memory per slot is roughly the model file size plus a few hundred MB.
🔄 Upgrading from stable-ts
Subgen used faster-whisper with stable-ts until November 2026. That version is preserved, unsupported and without new images, on the legacy-stable-ts branch.
To stay on stable-ts (no fixes or support from here on):
- Docker: pin the last stable-ts image instead of
:latest:mccloud/subgen:2026.11.2(NVIDIA),:2026.11.2-cpuor:2026.11.2-amd(ROCm). Its code is the same as thelegacy-stable-tsbranch. - And set
UPDATE=False, orBRANCH=legacy-stable-ts. WithUPDATE=Trueand noBRANCH, the launcher downloads the newestsubgen.pyfrommaininto the old image, which then runs the new code on faster-whisper without stable-ts. - Standalone:
python3 launcher.py -b legacy-stable-ts.
What changes when you update:
- Your image tag: NVIDIA stays on
:latest/:cuda.:cpustays:cpu. AMD (:amd) now gets the Vulkan image: pass/dev/driinstead of the ROCm devices (/dev/kfd), and dropHSA_OVERRIDE_GFX_VERSIONandCT2_CUDA_ALLOCATOR. - If you mapped a folder over
/subgenitself (the old Unraid template did) and setUPDATE=False, your old copy ofsubgen.pyin that folder would run and fail, because the new images don't include stable-ts. Map the folder to/subgen/modelsinstead and setMODEL_PATH=/subgen/models(the updated Unraid template does this), or setUPDATE=Trueonce to download the new code. - Models are downloaded again on first start. whisper.cpp uses GGML model files (
ggml-*.bin), not faster-whisper's. They are derived fromWHISPER_MODELand saved toMODEL_PATH. PointWHISPER_CPP_MODELat a file to use your own. Old faster-whisper model folders (models--Systran--...and similar) can be deleted afterwards. CUSTOM_REGROUPandWORD_LEVEL_HIGHLIGHTwere removed with stable-ts. Subgen logs a warning if they are still set. Line length and cue splitting are controlled byMAX_LINE_LENGTHandGAP_SPLIT_SECS.TRANSCRIBE_DEVICEonly applies to faster-whisper. whisper.cpp picks the GPU it can see; useWHISPER_CPP_DEVICEto choose one or forcecpu.- Language detection skips the first 90 seconds (
DETECT_LANGUAGE_OFFSET, previously0), so opening themes no longer cause wrong languages. Short audio falls back automatically. - Subtitle layout changed: two-line cues of up to 42 characters per line, at most two sentences per cue, no one-word flashes. Expect fewer, longer cues than stable-ts produced.
🌎 Supported Audio Languages (via OpenAI)
Afrikaans, Arabic, Armenian, Azerbaijani, Belarusian, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, Galician, German, Greek, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Italian, Japanese, Kannada, Kazakh, Korean, Latvian, Lithuanian, Macedonian, Malay, Marathi, Maori, Nepali, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tagalog, Tamil, Thai, Turkish, Ukrainian, Urdu, Vietnamese, and Welsh.
🔗 OpenAI-Compatible API Endpoints
Subgen exposes two endpoints that match the OpenAI Whisper API, so it can be used as a drop-in backend for any client that targets that API (Open WebUI, Obsidian plugins, etc.).
| Endpoint | Description |
|---|---|
POST /v1/audio/transcriptions |
Transcribe audio to text in the source language |
POST /v1/audio/translations |
Transcribe and translate audio to English |
Supported parameters:
| Parameter | Description |
|---|---|
file |
Audio file (any format ffmpeg can decode) |
language |
Source language ISO-639-1 code (transcriptions only; auto-detected if omitted) |
prompt |
Optional context passed to Whisper |
response_format |
json (default), text, srt, vtt, verbose_json |
model |
Accepted but ignored — subgen uses its configured model |
temperature |
Accepted but ignored |
Example:
curl -X POST http://<your-ip>:9000/v1/audio/transcriptions \
-F "[email protected]" \
-F "response_format=json"
# {"text": "..."}
verbose_json returns segments with start/end timestamps.
Bazarr / whisper-asr-webservice endpoint (POST /asr): query parameters task (transcribe or translate), language, output (srt default, vtt, txt, tsv, json), encode (false for raw 16 kHz mono PCM, which is what Bazarr sends) and video_file. POST /detect-language returns {"detected_language": ..., "language_code": ...}.
🪲 Known Issues
- It uses trained AI models; there will occasionally be mistranslations or hallucinations, mostly over music and background noise (e.g. "Thank you.", "For more information", "Transcribed by ..."). With whisper.cpp, subgen drops cues that fall on silence and writes no subtitle for a file with no speech. Over music it can still invent text;
HALLUCINATION_FILTER(on by default) removes looped phrases and known invented credits, but not every invented line. - The queue is kept in memory: files queued but not yet transcribed when the container stops are dropped. A webhook sent again,
/batch, or theTRANSCRIBE_FOLDERSscan on the next start queues them again. - If a Bazarr request and a webhook arrive for the same file at once, subgen transcribes it once and returns the result to Bazarr, which saves the subtitle; subgen doesn't write a second copy.
❤️ Credits
- whisper.cpp, the transcription engine
- Google & FFmpeg
- faster-whisper
- Whisper ASR Webservice for Bazarr HTTP webhook logic.
- Community Contributors
Explorer des projets similaires
Chargement…