SubtitleKit - Subtitle Processing Toolkit
Comprehensive Python library and desktop application for subtitle processing, synchronization, and correction.
✨ Features
- Merge & Sync: Combine subtitle files with automatic synchronization
- Fix Overlaps: Detect and correct timing issues and overlaps
- Apply Corrections: Apply text corrections from JSON files
- Subtitle Optimizer: Automatic CPS optimization, line reduction, filler word removal, and AI-powered shortening (via Gemini API)
- LLM Integration: Generate optimized JSON for translation workflows
- Desktop App: Cross-platform GUI (Windows, macOS, Linux)
- Colab Ready: Works seamlessly in Google Colab notebooks
🚀 Quick Start
Installation
pip install subtitlekit
Google Colab
# Install
!pip install subtitlekit
# Launch UI
from subtitlekit.ui import show_ui
show_ui(lang='en') # or 'el' for Greek
As a Library
from subtitlekit import merge_subtitles, fix_overlaps, apply_corrections
# Merge subtitle files
merge_subtitles("original.srt", ["helper.srt"], "output.json")
# Fix timing overlaps
fix_overlaps("input.srt", "reference.srt", "fixed.srt")
# Apply corrections from JSON
apply_corrections("input.srt", "corrections.json", "output.srt")
CLI Usage
# Merge subtitles
subtitlekit merge --original original.srt --helper helper.srt --output output.json
# Fix overlaps
subtitlekit overlaps --input input.srt --reference ref.srt --output fixed.srt
# Apply corrections
subtitlekit corrections --input input.srt --corrections fixes.json --output corrected.srt
# Optimize subtitles
subtitlekit optimize input.srt --interjections --line-reduction --cps --llm
Desktop App
Download the standalone application from Releases.
Or launch programmatically:
python -m subtitlekit.ui.desktop
📖 Documentation
Merge Subtitles
Combines original subtitle file with one or more helper files (different languages) to create JSON output optimized for LLM translation workflows.
subtitlekit merge \
--original movie.srt \
--helper helpful_en.srt \
--helper helpful_pt.srt \
--output for_translation.json \
--skip-sync # optional: skip ffsubsync
Output format:
{
"id": 1,
"t": "00:00:11,878 --> 00:00:16,130",
"trans": "Original text to translate",
"h1": "Helper text (language 1)",
"h2": "Helper text (language 2)"
}
Fix Overlaps
Detects and corrects timing issues:
- Overlapping timestamps
- Out-of-order entries
- Unreasonable durations
- Duplicate timings
subtitlekit overlaps \
--input problematic.srt \
--reference correct_timings.srt \
--output fixed.srt \
--window 5
Apply Corrections
Apply text corrections from JSON file:
subtitlekit corrections \
--input subtitle.srt \
--corrections fixes.json \
--output corrected.srt
Subtitle Optimizer
Automated pipeline to improve subtitle readability and timing. Supports multiple languages (English, Greek, etc.) for interjection removal.
subtitlekit optimize movie.srt \
--interjections \
--line-reduction \
--cps \
--llm \
--api-key YOUR_GEMINI_API_KEY
Optimization Phases:
- Interjection Removal: Removes filler words (e.g., "Uh,", "Well,").
- Line Reduction: Collapses 3+ line entries into 2 lines for better layout.
- CPS Optimization: Extends timing and merges short subtitles to hit target Characters Per Second (default: 20.0).
- LLM Shortening: Uses Gemini AI to shorten entries that still exceed CPS limits.
- Translation Prep: Experimental
--simplifyflag to simplify text for easier translation.
🌍 I18n Support
Desktop and Colab UIs support:
- 🇬🇧 English
- 🇬🇷 Greek (Ελληνικά)
📦 Development
# Clone repository
git clone https://github.com/angelospk/subtitlekit.git
cd subtitlekit
# Install in development mode
pip install -e .
# Install pre-commit hooks (Mandatory for contributing)
pip install pre-commit
pre-commit install
# Run tests manually
pytest -v
🤝 Contributing
Contributions are welcome! Please ensure all tests pass before submitting a Pull Request. We use pre-commit to enforce running pytest automatically before every commit to prevent breaking changes.
📄 License
MIT License - see LICENSE file.
🙏 Credits
Built by angelospk
Metadata
Release files for subtitlekit 0.2.2
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 | Actions |
|---|---|---|---|---|
| subtitlekit-0.2.2.tar.gz | 77.2 kB | Without provenance | Details for subtitlekit-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| subtitlekit-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for subtitlekit-0.2.2-py3-none-any.whl |
Total release size: 153.5 kB
Release files / subtitlekit-0.2.2.tar.gz
| Download URL | subtitlekit-0.2.2.tar.gz |
|---|---|
| Size | 77.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5def3e0432fd8773cb39b897e84cf3c24e6a51536cccfdf35efb4f7195ddd4e2
|
|
BLAKE2b-256 checksum How to use checksums |
a656f478097795f684f3207cd7a6988adf2d6279f1ea0f6453023dbbc0561a74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / subtitlekit-0.2.2-py3-none-any.whl
| Download URL | subtitlekit-0.2.2-py3-none-any.whl |
|---|---|
| Size | 76.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6174af5e095cfacdce9fd1b03b48104dbc9b6b9f5d96cdf4098dbdb196fe083d
|
|
BLAKE2b-256 checksum How to use checksums |
d3592c831c368399353ac356fee92396dca29932a4480d40f41f0052d0030582
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for subtitlekit 0.2.2
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.