Generate SRT subtitles from audio/video files using WhisperX
Project description
subtitle-engine
Generate .srt subtitle files from audio or video files using WhisperX. Optionally generate a caption from the transcript with a local Ollama LLM.
Installation
Requires Python 3.12 or newer.
pip install subtitle-engine
Or install from source:
git clone https://github.com/leevipuntanen/subtitle-engine.git
cd subtitle-engine
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Usage
# Basic usage — writes <input>.srt next to the source file
subeng video.mp4
# Specify output file
subeng video.mp4 --output subtitles.srt
# Use a different model or language
subeng video.mp4 --model medium --language fi
# Force CPU / CUDA / MPS
subeng video.mp4 --device cpu
# Speaker diarization (requires a Hugging Face token)
subeng video.mp4 --diarize --hf-token $HF_TOKEN
# Generate a caption from the transcript using Ollama
subeng video.mp4 --caption --ollama-model qwen3.5:0.8b
Options
| Option | Description |
|---|---|
--output, -o |
Output SRT file path |
--model, -m |
WhisperX model: tiny, base, small (default), medium, large-v2, large-v3 |
--language, -l |
ISO language code, e.g. en, fi. Auto-detected if omitted. |
--device, -d |
cpu, cuda or mps. Auto-detected if omitted. |
--batch-size, -b |
Inference batch size (default: 16) |
--compute-type, -c |
int8 or float16. Auto-selected if omitted. |
--diarize |
Enable speaker diarization |
--hf-token |
Hugging Face token for diarization (or set HF_TOKEN env var) |
--caption |
Generate a caption from the transcript via Ollama |
--ollama-model |
Ollama model name (required with --caption) |
--ollama-host |
Ollama API host (default: http://localhost:11434) |
Development
Run the test suite:
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
subtitle_engine-0.1.0.tar.gz
(10.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file subtitle_engine-0.1.0.tar.gz.
File metadata
- Download URL: subtitle_engine-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dd257ab189b38571a2df4d83a93ba0c07ec33180549f835c3e7ff3012225068
|
|
| MD5 |
7e3f184cff64c712ffbf30cac200c893
|
|
| BLAKE2b-256 |
266c1466ac805b0973c09534d9fc5567f94821a28a9ebc873af114f77b0ccdbc
|
File details
Details for the file subtitle_engine-0.1.0-py3-none-any.whl.
File metadata
- Download URL: subtitle_engine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26cd662bc337664a909a25d8006d453a907c55def5185443127f61b0bbe201cb
|
|
| MD5 |
2e4f556ec4b905eaea95a09aaaa75bea
|
|
| BLAKE2b-256 |
92c3b77885a59768deeed7bdecd7454e8494f2566ba031afe1858e2d1b2e658e
|