Open-source subtitle generation for seamless content translation.
Project description
Subtitle Generator
AI-powered subtitle generation using Whisper for accurate speech-to-text transcription.
Features
- 🎯 Multi-format output - VTT, SRT, TXT, JSON, LRC, ASS, TTML
- 🚀 Fast processing - Powered by whisper.cpp for high-performance inference
- 📦 Batch processing - Process multiple videos at once
- 🔄 Video embedding - Embed subtitles directly into videos
- 🌍 Multilingual - Support for multiple languages
Installation
pip install subtitle-generator
Prerequisites
- FFmpeg is required for video/audio processing:
# macOS brew install ffmpeg # Ubuntu/Debian sudo apt install ffmpeg # Windows (via chocolatey) choco install ffmpeg
Quick Start
# Generate subtitles (VTT format)
subtitle video.mp4
# Generate SRT format
subtitle video.mp4 --format srt
# Embed subtitles into video
subtitle video.mp4 --merge
# Use a larger model for better accuracy
subtitle video.mp4 --model large
CLI Commands
| Command | Description |
|---|---|
subtitle <video> |
Generate subtitles for a video |
subtitle models --list |
List available Whisper models |
subtitle models --download <model> |
Download a specific model |
subtitle batch --input-dir <dir> |
Batch process multiple videos |
subtitle formats |
Show supported output formats |
Options
| Option | Description |
|---|---|
--model, -m |
Model to use: tiny, base, small, medium, large |
--format, -f |
Output format: vtt, srt, txt, json, lrc, ass, ttml |
--merge |
Embed subtitles into the video file |
--threads, -t |
Number of processing threads |
--verbose, -v |
Enable verbose output |
Python API
from src.core.subtitle_gen import SubtitleGenerator
# Generate subtitles
generator = SubtitleGenerator()
result = generator.generate("video.mp4", format="srt")
print(f"Subtitles saved to: {result}")
Models
| Model | Size | Speed | Accuracy |
|---|---|---|---|
tiny |
~75MB | ⚡⚡⚡⚡ | ⭐⭐ |
base |
~140MB | ⚡⚡⚡ | ⭐⭐⭐ |
small |
~460MB | ⚡⚡ | ⭐⭐⭐⭐ |
medium |
~1.5GB | ⚡ | ⭐⭐⭐⭐⭐ |
large |
~3GB | 🐢 | ⭐⭐⭐⭐⭐ |
Tip: Use
.enmodels (e.g.,base.en) for English-only content for faster processing.
Links
License
MIT License - see LICENSE for details.
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
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_generator-2.0.2.tar.gz.
File metadata
- Download URL: subtitle_generator-2.0.2.tar.gz
- Upload date:
- Size: 36.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33c33ec8c66cb37df3b4597deee34d5f8f3805f2606538d5238d723a4dded7fb
|
|
| MD5 |
e8fec4c3e359a999977f32dece4d8406
|
|
| BLAKE2b-256 |
f756e49efcf75569b0bce8cc11a13fe3c4fd398700e0931a1d6f789a1adad70a
|
File details
Details for the file subtitle_generator-2.0.2-py3-none-any.whl.
File metadata
- Download URL: subtitle_generator-2.0.2-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5a0770acd6657c67584fdf27710801e3ddad3b3eb5b67b14aabeb3e16f8385f
|
|
| MD5 |
fd96d5eb6b4d993f323c4d0375a96c28
|
|
| BLAKE2b-256 |
069e01f579a5109f45830c3b2430a0d683159d7e061ab122024e10bb16cfc992
|