Subtitles for your whole library, made on your own server.

SubGen scans your media folders, transcribes the audio with Whisper, translates it with local models, and writes SRT, ASS or WebVTT files right beside each video. Your media stays on your hardware.

New in 0.9: whispered and quiet dialogue is no longer skipped, and subtitles start when the voice does. See the release notes.

An example cue from the film Low Tide, shown in the language you pick, with the sidecar file SubGen writes for it.

We should leave beforethe tide comes in.

Low Tide (2024).en.srt128 00:42:17,480 --> 00:42:20,120 We should leave before the tide comes in.

Everything between the audio track and a finished subtitle file

SubGen builds the pipeline around subtitle quality: cues that read well, no wasted transcription, and proper tools for fixing the last few lines by hand.

Runs entirely on your hardware

Transcription and translation happen inside one container, on CPU or an NVIDIA GPU. Nothing is sent to a cloud service, and nothing is billed per minute.

  • faster-whisper transcribes from the media audio, picking CUDA automatically when a GPU is present.
  • Local translation with Hugging Face models stored on your disk, or your own Ollama or LibreTranslate server.
  • Predictable downloads. Only the models you use are downloaded: the two defaults on first start, and any other model when you click install. Jobs never download anything, and one setting turns automatic installs off for offline servers.
  • Gentle on shared hardware. Jobs run one at a time, models are unloaded after 15 idle minutes to free GPU memory, and uploads and downloads stop before the disk fills up.
Your pipeline/models
Transcription
faster-whisper, CPU or NVIDIA CUDA from the same image tiny to large-v3auto device
Translation, built in
Hugging Face models on local storage NLLB-200M2M100Marian / OPUS-MT
Translation, your server
Point SubGen at a service you already run OllamaLibreTranslate
Internet needed
Only while models download (the defaults on first start). Generation works fully offline.

Cues people can actually read

Raw speech recognition output arrives in long, uneven chunks. The subtitle-quality engine rebuilds it from word timestamps into cues that follow the rules you set.

  • Re-segmentation by characters per line, lines per cue, minimum and maximum duration, and the gap between cues.
  • Line balancing splits two-line cues at natural points so neither line is a stub.
  • Quiet dialogue kept: surround audio is mixed towards the dialogue channel and whispers are boosted, so they reach Whisper instead of being skipped as silence.
  • Subtitles in sync: the audio track's start delay is kept and each line starts where the voice does.
  • Hallucination filtering drops the repeated phrases Whisper sometimes invents over silence and music, one sentence at a time.
Same speech, before and after

Whisper segment

00:03:02,100 --> 00:03:11,940So I told him we couldn't make it back before dark, and he just laughed and said the road would be fine. Thank you. Thank you. Thank you.
Repeated phrase over silence removed

SubGen cues

00:03:02,100 --> 00:03:05,060So I told him we couldn't make it back before dark,
00:03:05,300 --> 00:03:08,420and he just laughed and said the road would be fine.
42 characters per line2 lines1 to 7 secondsGap between cues

Transcribe once, translate many

Transcription is the slow part, so SubGen does it once per file. The transcript is cached and reused for every target language and format, including ones you add months later.

  • One pass of Whisper feeds Arabic, French, Spanish and any other target language.
  • SRT, ASS and WebVTT from the same cues, written atomically so players never see half a file.
  • Sidecars your player finds, named like Movie (2024).ar.srt next to the video.
One file, many sidecars/media/movies
Low Tide (2024).mkvAudio track 2, English
TranscriptCached after the first run
  • Low Tide (2024).en.srtWritten
  • Low Tide (2024).ar.srtWritten
  • Low Tide (2024).fr.vttWritten
  • Low Tide (2024).es.assWritten
  • Low Tide (2024).de.srtAdded later, no re-transcription

Scans that know what is already there

Point SubGen at a library and it works out which files actually need subtitles, so a first scan of a large collection does not bury the queue.

  • Skips covered files that already have a matching external subtitle, including variants like Movie.eng.srt, or an embedded subtitle track.
  • Ignore patterns keep samples, trailers and extras out of the queue.
  • Prunes deleted media from the inventory and picks the audio track that matches the language you expect.
  • Waits for copies to finish before touching files that are still being written.
Scan results, target language English/media/movies
  • Low Tide (2024).mkvUses audio track 2 (English)Queued
  • Northern Line (2021).mkvNorthern Line (2021).eng.srt is beside itAlready has subtitles
  • Paper Moon Hotel (2018).mkvEmbedded English subtitle trackAlready has subtitles
  • extras/teaser-sample.mkvMatches the pattern *sample*Ignored
  • Old Cut (2009).mkvNo longer on diskPruned

Studio and a real subtitle editor

Not everything lives in a library. Drop a single file into Studio and download its subtitles when the job finishes. Then fix the lines that matter in the editor.

  • Studio takes video or audio by drag and drop. Uploads expire on their own after the retention window you choose.
  • Edit against the picture with a video preview, timing shift, split and merge, and find and replace.
  • Readability warnings flag cues that are too long or too fast to read before you save.
EditorLow Tide (2024).en.srt
21201:12:04,200 --> 01:12:06,900You kept the lighthouse key?
21301:12:07,000 --> 01:12:07,900I couldn't. Not tonight, not after everything that happened out there.Reading speed 77 characters per second
21401:12:08,300 --> 01:12:10,100Then we go without it.
Shift timingSplitMergeFind and replaceSave

Built to be left running

SubGen is meant to sit on a NAS or home server and get on with it. The admin tools are there for the times you need them, and the defaults are locked down.

Day to day

Manage models, the queue and settings from the browser, without opening a shell.

Models
Default models install on first start. Install others in one click, watch the download progress, and delete the old model when you switch.
Queue
Priorities, cancel, retry and regenerate, bulk actions across many jobs, plus live speed and time remaining.
Settings
Grouped, validated options for transcription, segmentation, translation, scanning, output and the Studio workspace, each with a reset to default.
Activity and backups
A searchable audit log of edits, deletions, settings changes and sign-ins, with one-click database backup and validated restore.

Security

One administrator, configured from the environment, and a container that asks for as little as possible.

Sign-in
Login throttling, optional two-factor codes you turn on in Settings, and sign-out that revokes every session.
Request protection
Session-bound CSRF tokens on every change and a strict Content Security Policy in the web interface.
Non-root container
Starts as root only to hand its folders to your PUID/PGID, then runs as that user with no Linux capabilities, no-new-privileges, and no Docker socket.
Contained file access
Writes and deletions are limited to subtitle files inside configured libraries.

How a job runs

Every subtitle goes through the same stages, and the queue shows which stage each job is in.

  1. Find

    A library scan or a Studio upload adds the file to the queue.

  2. Probe

    ffprobe reads the duration and tracks, and SubGen picks the right audio track.

  3. Extract

    The chosen audio track is decoded for speech recognition.

  4. Transcribe

    faster-whisper with word timestamps, or a cached transcript when one exists.

  5. Shape

    The quality engine builds balanced, readable cues and drops hallucinations.

  6. Translate

    Each target language, with a local model or your own provider.

  7. Write

    An atomic write of SRT, ASS or WebVTT beside the media.

A look around

The web interface covers the whole job, from installing models to editing a single cue.

Quick start

You need Linux with Docker Engine and Compose v2. The image targets linux/amd64. For GPU transcription, add an NVIDIA GPU, a current driver and the NVIDIA Container Toolkit.

  1. Download two files

    SubGen needs a compose file and an .env file, nothing else.

    shell
    mkdir subgen && cd subgen
    curl -fsSLO https://raw.githubusercontent.com/Fahed-Alhammadi/SubGen/main/docker-compose.yaml
    curl -fsSL https://raw.githubusercontent.com/Fahed-Alhammadi/SubGen/main/.env.example -o .env
    chmod 600 .env
  2. Set your password

    Use at least 12 characters. PUID and PGID are the user that owns your media; id -u and id -g show them.

    .env
    # User that owns your media folders. Find it with: id -u  and  id -g
    PUID=1000
    PGID=1000
    
    # Admin sign-in. Password: at least 12 characters.
    SUBGEN_ADMIN_USERNAME=admin
    SUBGEN_ADMIN_PASSWORD=change-me-to-a-long-password
  3. Point it at your media

    Replace the two example media folders with yours and add as many as you like. On a host without an NVIDIA GPU, remove gpus: all; the same image then uses the CPU.

    docker-compose.yaml
    services:
      subgen:
        image: ghcr.io/fahed-alhammadi/subgen:latest
        container_name: subgen
        restart: unless-stopped
        gpus: all                       # remove this line if the host has no NVIDIA GPU
        ports:
          - "8080:8080"
        env_file: .env
        volumes:
          - ./config:/config            # database, settings and Studio uploads
          - ./models:/models            # Whisper and translation models
          - /path/to/movies:/media/movies
          - /path/to/tv:/media/tv
        security_opt: [no-new-privileges:true]
        cap_drop: [ALL]
        cap_add: [CHOWN, SETUID, SETGID]  # used only at startup to switch to PUID/PGID
  4. Start SubGen

    SubGen creates its folders, gives them to PUID/PGID, generates its own session key and runs as that user, never as root.

    shell
    docker compose up -d
  5. Let the models install and add a library

    Open http://<server>:8080 and sign in. Whisper Small and NLLB-200 600M install by themselves on first start (about 3 GB); the Models page shows the progress. On a GPU, switch to a larger Whisper model there. Then add each mounted folder under Libraries, choose its languages and formats, and select Scan now. Everything else, from the processing device to sign-in limits, is under Settings.

Updating. Back up the config folder, then run docker compose pull and docker compose up -d. For reproducible deployments, pin a version in the compose file, for example ghcr.io/fahed-alhammadi/subgen:0.9. Older compose and .env files keep working.

Remote access. Put SubGen behind an HTTPS reverse proxy: publish the port as "127.0.0.1:8080:8080" when the proxy runs on the same host, or attach SubGen to the proxy's Docker network and set SUBGEN_TRUSTED_PROXIES to that network's range. Cookies switch to HTTPS-only automatically.

Questions

Does SubGen send my media or audio anywhere?

No. Transcription and the built-in translation provider run inside the container using models on your disk. The only outbound traffic is model downloads: the default models on first start, and any model you install. Set SUBGEN_AUTO_INSTALL_MODELS=false to stop the automatic ones. If you configure Ollama or LibreTranslate, subtitle text goes to the address you enter, which is usually another container on the same machine.

Do I need an NVIDIA GPU?

No. The same image runs on CPU and on NVIDIA GPUs. With the device set to auto, SubGen uses CUDA when it is available. A GPU is much faster for large libraries; smaller Whisper models are practical on CPU.

Which languages are supported?

Whisper transcribes dozens of spoken languages. For local translation, SubGen maps more than 60 common language codes to NLLB, and M2M100 and Marian models cover further pairs. Ollama and LibreTranslate support whatever your chosen model or server supports. Always check timing and translation quality on your own media before enabling unattended processing.

Does it reuse subtitles that already exist?

Existing external and embedded subtitles are used to decide that a file does not need work, so scans skip it. They are never used as a transcription source: SubGen always generates from the audio.

Where are subtitles saved, and will Plex, Jellyfin or Emby find them?

Subtitles are written beside the media with the language code in the name, for example Movie (2024).ar.srt, Movie (2024).en.vtt or Movie (2024).fr.ass. This is the sidecar naming that common media servers look for. Library folders must be writable by the container user.

Can I run it on a NAS with network shares?

Yes, on any Linux host that runs Docker with an amd64 CPU. Local disks, NFS and SMB/CIFS mounts all work. Mount each library at its own path below /media and keep share credentials out of Git.

What does the license allow?

SubGen is open source under the MIT License. You can use, modify, redistribute and even sell it, for yourself, your organisation or as a service, as long as you keep the copyright and license notice. It comes without warranty.

Is it ready for my irreplaceable library?

SubGen is in active pre-1.0 development. Pin a versioned image, back up /config, and try it on a copy or a small library first. Subtitle writes are atomic and deletions are limited to subtitle files, but backups are still your safety net.