Skip to main content

Subtatix

Subtatix is a small CLI for generating .srt (or .vtt) subtitles with local AI from audio or video files with optional translation. Everything is processed on your machine.

Generate subtitles from my-video.mp4 into my-video.srt and my-video.es.srt (Spanish):

subtatix transcribe my-video.mp4 --to es

It works for entire directories too:

subtatix transcribe . --to es

It relies heavily on WhisperX for transcription and subtitle timing alignment.

Requirements

  • Python 3.12+
  • ffmpeg installed separately and available on your PATH
  • Enough disk space for model downloads and caching

The first run will be slower because WhisperX and translation models need to be downloaded. Subsequent runs reuse the cached models and do not need to download them again unless the cache is cleared.

ffmpeg is an external system dependency. It is not installed by pip, uvx, or uv tool install.

Installation

Run without installing:

uvx subtatix --help

Install as a tool with uv:

uv tool install subtatix

Install with pip:

pip install subtatix

or from my Forgejo PyPI instance:

uvx --index https://forgejo.chrispaganon.com/api/packages/chris-paganon/pypi/simple/ subtatix --help
uv tool install --index https://forgejo.chrispaganon.com/api/packages/chris-paganon/pypi/simple/ subtatix
pip install --index-url https://forgejo.chrispaganon.com/api/packages/chris-paganon/pypi/simple/ subtatix

Shell completion

Install completion for your current shell (bash, zsh, fish or PowerShell), then restart it:

subtatix --install-completion

Use subtatix --show-completion to print the script instead.

Usage

transcribe creates subtitles from an audio or video file. It writes .srt by default:

subtatix transcribe input.mp4
subtatix transcribe input.mp4 --from en --to es --output translated/subtitles
subtatix transcribe input.mp4 --to es --discard-transcription

The first command writes input.srt. The second writes translated/subtitles.srt and translated/subtitles.es.srt. --discard-transcription writes only the translated output when used with --to.

Readable cue lengths: long sentences are split into cues of at most 100 characters, preferably at punctuation or pauses, so subtitles don't take over the screen.

translate translates an existing .srt or .vtt file without transcribing audio or video:

subtatix translate input.srt --from en --to es --output translated/subtitles
subtatix translate input.vtt --from en --to es

For translation-only mode, the input must be an .srt or .vtt file and --from is required. These commands write translated/subtitles.es.srt and input.es.vtt.

Common options and discovery commands:

subtatix transcribe input.mp4 --format vtt
subtatix translate input.srt --from en --to es --format vtt
subtatix transcribe input.mp4 --batch-size 4 --device cpu
subtatix translate input.srt --from en --to es --translation-batch-size 4
subtatix translate input.srt --from en --to es --translation-device cpu
subtatix list languages
subtatix list source-languages
subtatix list target-languages

Passing an --output value that ends in a subtitle suffix like .srt or .vtt is rejected. Use a base path such as --output subtitles instead.

Existing subtitle files

Existing output files are never overwritten unless you pass --overwrite. Subtatix lists the files it will skip before starting, and prints Nothing to do. when every output already exists.

With transcribe --to, an existing transcription is reused when only its translation is missing: input.srt is translated into input.es.srt without transcribing the audio again. Subtitle files don't record their language, so --from is mandatory in that case and every reused file is assumed to be in that language:

subtatix transcribe input.mp4 --to es --from en
subtatix transcribe input.mp4 --to es --overwrite

Directories

Both commands also accept a directory. Add --recursive (-r) to include subdirectories. Hidden files and directories are ignored:

subtatix transcribe videos --to es --from en
subtatix transcribe videos -r --output subtitles
subtatix transcribe videos -r --ext mp4,mkv
subtatix translate subtitles -r --from en --to es
  • transcribe processes common audio and video files (mp4, mkv, mov, webm, mp3, wav, flac, m4a, ...). translate processes .srt and .vtt files.
  • --ext replaces the default extension list, for example --ext mp4,mkv or --ext mp4 --ext mkv.
  • Subtitles are written next to their input files. With --output, the input folder structure is mirrored inside the output directory.

Each file is handled depending on which subtitle files already exist, for example with transcribe --to es:

x.srt x.es.srt What happens
no no Transcribe, then translate
yes no Reuse x.srt and only translate (requires --from)
no yes Skip the file
yes yes Skip the file

--overwrite transcribes and translates every file again.

Models

By default, transcription uses WhisperX with the Whisper model large-v2. This is a good general default when you want higher transcription quality and aligned subtitle timings, but it is heavier and slower than smaller Whisper models.

Translation uses facebook/nllb-200-distilled-1.3B. The CLI accepts simple target codes such as en, es, fr, de, pt, ja, ko, zh, and also raw NLLB codes such as spa_Latn.

On CUDA, translation loads the model in half precision and automatically retries with smaller translation batches if the GPU runs out of memory. If your GPU is still too small or busy, reduce --translation-batch-size or use --translation-device cpu.

Other model options can also be used:

  • For transcription, you can pass another Whisper model with --model, such as small, medium, or large-v3, depending on your speed and accuracy needs.
  • For translation, you can pass another NLLB model with --translation-model: nllb-200-distilled-600M (faster, lighter), nllb-200-distilled-1.3B, nllb-200-1.3B, or nllb-200-3.3B (best quality, needs about 7 GB of GPU memory).

Examples:

subtatix transcribe input.mp4 --model small
subtatix transcribe input.mp4 --model large-v3 --to spa_Latn
subtatix translate input.srt --from en --to es --translation-model nllb-200-3.3B
subtatix list target-languages

Limitations

  • Translations are processed one subtitle cue at a time to preserve the original timing exactly. The tradeoff is that each cue is translated without the surrounding subtitle lines, so some lines may sound less natural when they depend on nearby context.
  • Adding nearby cues as extra context is not reliable with regular translation models, because they cannot tell which text is only context and which text must actually be translated.
  • Translating larger blocks and splitting them back into subtitle cues is also not a good fit. Translation can reorder or merge sentence parts across cue boundaries, making it impossible to split the result back without damaging the timing.
  • A typical llm model could handle context more explicitly, but that would make translation much slower, heavier, and less predictable, especially with smaller local models.

Metadata

Release files for subtatix 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subtatix 0.4.0
File Size Uploaded Provenance Actions
subtatix-0.4.0.tar.gz 24.1 kB Without provenance Details for subtatix-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for subtatix 0.4.0
File Interpreter ABI Platform Actions
subtatix-0.4.0-py3-none-any.whl Python 3 none any Details for subtatix-0.4.0-py3-none-any.whl

Total release size: 53.1 kB

Release files / subtatix-0.4.0.tar.gz

Download URL subtatix-0.4.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1715017058daf2f491abab49a977ccf18a55184b28df5db67088edb3aff95210
BLAKE2b-256 checksum
How to use checksums
ac54b9a1e080c704b9f6c129adf3f95b62bc27c907975210e0b44a15ce0b404b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / subtatix-0.4.0-py3-none-any.whl

Download URL subtatix-0.4.0-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87e1410f281276fbfe9e4a893b48be66f8295f0a0b8da1c62b847efaef03b1f5
BLAKE2b-256 checksum
How to use checksums
bff08f0233389fe99fa975560b7d5dd9d9c7622d2fd3b42d8269882ebd543dc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for subtatix 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page