SubtitleKit

SubtitleKit Link to heading

Comprehensive Python Library for Subtitle Processing and Correction

PyPI version Python 3.8+

Overview Link to heading

SubtitleKit is a comprehensive Python library and desktop application for subtitle processing, synchronization, and correction. It’s designed to streamline subtitle workflows, particularly for translation projects involving LLM integration.

Available as a PyPI package, CLI tool, desktop application, and Google Colab notebook.

Key Features Link to heading

  • 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
  • Cross-Platform - Desktop GUI for Windows, macOS, Linux
  • Colab Ready - Works seamlessly in Google Colab notebooks
  • Bilingual UI - English and Greek interface support

Installation Link to heading

pip install subtitlekit

Usage Link to heading

As a Library Link to heading

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 Link to heading

# 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

Google Colab Link to heading

Open In Colab

from subtitlekit.ui import show_ui
show_ui(lang='en')  # or 'el' for Greek

Technical Details Link to heading

Merge Output Format Link to heading

Optimized JSON format for LLM translation workflows:

{
  "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)"
}

Corrections JSON Format Link to heading

[
  {
    "id": 1,
    "rx": "text to find",
    "sb": "replacement text",
    "rate": 8,
    "type": "grammar"
  }
]

Use Case Link to heading

This project grew out of my hobby of subtitling. SubtitleKit automates the tedious parts of subtitle work—fixing timing issues, merging helper tracks, and applying AI-generated corrections—letting me focus on the creative aspects of translation.