Subtitle processing toolkit: merge, sync, fix overlaps, and apply corrections
Project description
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
- 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
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
Corrections JSON format:
[
{
"id": 1,
"rx": "text to find",
"sb": "replacement text",
"rate": 8,
"type": "grammar"
}
]
🌍 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 .
# Run tests
pytest -v
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
MIT License - see LICENSE file.
🙏 Credits
Built by angelospk
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 subtitlekit-0.1.3.dev0.tar.gz.
File metadata
- Download URL: subtitlekit-0.1.3.dev0.tar.gz
- Upload date:
- Size: 50.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cd1fe2342613bbd4e637ed512808a9682e4843922870d517f186d057d3a6e0f
|
|
| MD5 |
c6266a7cb79cb69788db4e56031d6519
|
|
| BLAKE2b-256 |
1fa6c21e235c9737d9e3e290540c5f76937df2124b6068ec8c08002c2f3566bf
|
File details
Details for the file subtitlekit-0.1.3.dev0-py3-none-any.whl.
File metadata
- Download URL: subtitlekit-0.1.3.dev0-py3-none-any.whl
- Upload date:
- Size: 40.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05c537d3ad02b41a0b2e4f7841e8ccd230e5f2b9606782df102c26ff0d852702
|
|
| MD5 |
637fb26d17ce99d3890a6adc54b2157d
|
|
| BLAKE2b-256 |
53d29ed281853f84b7de601a886dcb3badec4de4136aeb0c162770bf49038200
|