Subtitle Generator
Generate subtitles for video/audio files using whisper.cpp.
Install
pip install subtitle-generator
subtitle setup-whisper # one-time: clones + builds whisper-cli
subtitle setup-whisper needs git, cmake, a C++ compiler, and
ffmpeg:
# macOS
xcode-select --install && brew install cmake ffmpeg
# Linux
sudo apt-get install -y build-essential cmake git ffmpeg
# Windows
# Install Git, CMake, VS Build Tools, ffmpeg.
The built binary lands in your per-OS user data dir (e.g.
~/Library/Application Support/subtitle-generator/bin/ on macOS) and is
auto-discovered on every subsequent run.
subtitle setup-whisperbuildsinnovatorved/whisper.cpp(develop), which includes-vifor direct video ingestion. If a stockwhisper-cliwithout-viis used instead,subtitle-generatorautomatically extracts 16 kHz mono WAV viaffmpeg.
Usage
# VTT (default), output in current directory
subtitle video.mp4
# SRT
subtitle video.mp4 --format srt
# Generate SRT and embed soft subtitles into the video
# Writes ./video.srt and ./video_subtitled.mp4
subtitle video.mp4 --merge --format srt
# Burn (hardcode) subtitles into the video
# Writes ./video.srt and ./video_burned.mp4
subtitle video.mp4 --burn --format srt
# Fast high-accuracy model (large-v3-turbo) or full large-v3
subtitle video.mp4 --model turbo
subtitle video.mp4 --model large
# Specify language or translate to English
subtitle video.mp4 --language es --translate
# Custom output directory
subtitle /path/to/video.mp4 --output-dir ~/subs --format srt
Subcommands
| Command | Description |
|---|---|
subtitle <video> |
Transcribe and write subtitle file |
subtitle <video> --merge |
Transcribe + mux soft subtitles into a copy of the video |
subtitle <video> --burn |
Transcribe + burn hard subtitles into a copy of the video |
subtitle setup-whisper |
Build whisper-cli into user data dir (one-time) |
subtitle models --list |
List/check downloaded models |
subtitle batch --input-dir <dir> |
Batch-process a directory in parallel |
subtitle formats |
Show supported subtitle formats |
Options
| Flag | Description |
|---|---|
--model, -m |
tiny / base / small / medium / turbo / large-v3 / large (default: base) |
--format, -f |
vtt / srt / txt / json / lrc / csv (default: vtt) |
--language, -l |
Spoken language code (en, es, auto, etc.) |
--translate, -tr |
Translate speech to English |
--merge |
Embed soft subtitles into a copy of the video |
--burn |
Burn hard subtitles into a copy of the video |
--output-dir, -o |
Output directory (default: current dir) |
--threads, -t |
whisper.cpp thread count |
--whisper-binary |
Override the auto-discovered whisper-cli path |
--models-dir |
Override the model cache directory |
--verbose, -v |
Verbose output |
--version, -V |
Show version |
Python API
from subtitle_generator.core import SubtitleGenerator, WhisperCppTranscriber
from subtitle_generator.models import ModelManager
generator = SubtitleGenerator(
transcriber=WhisperCppTranscriber(),
model_manager=ModelManager(),
)
result = generator.generate(
input_path="video.mp4",
model_name="base",
output_format="srt",
)
print(result.output_path if result.success else result.error)
Links
- Source: https://github.com/innovatorved/subtitle
- Issues: https://github.com/innovatorved/subtitle/issues
License
MIT
Metadata
Release files for subtitle-generator 3.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| subtitle_generator-3.1.0.tar.gz | 37.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| subtitle_generator-3.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.4 kB
Release files / subtitle_generator-3.1.0.tar.gz
| Download URL | subtitle_generator-3.1.0.tar.gz |
|---|---|
| Size | 37.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63c313ee83ed143ca1a29e04c344af653929b5100bfe30a260bcd4655fd46f91
|
|
BLAKE2b-256 checksum How to use checksums |
478b9a2268b30ca8750fcdcc7eabf1b8d4adc3b49b1c571e6e8cfe6349f1d15d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / subtitle_generator-3.1.0-py3-none-any.whl
| Download URL | subtitle_generator-3.1.0-py3-none-any.whl |
|---|---|
| Size | 38.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7acae6f7e27a1bc89f5867e702d417f0bee541547d989ae20f963f807315218
|
|
BLAKE2b-256 checksum How to use checksums |
bcf29b4599d8a2fb8f8061b692f669f09faa80c9ccadaf91095973ec0dbc40c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for subtitle-generator 3.1.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.