SRT Subtitle Duplicate Remover
Remove duplicate/ghost entries from auto-generated SRT subtitle files. | GitHub | PyPI | AUR |Blog
Auto-generated SRT subtitles (from YouTube, Whisper, etc.) often contain duplicated entries in a "scrolling karaoke" pattern:
1
00:00:00,440 --> 00:00:02,909
so welcome to the last Talk of the day
2
00:00:02,909 --> 00:00:02,919
so welcome to the last Talk of the day
3
00:00:02,919 --> 00:00:06,630
so welcome to the last Talk of the day
and OSS what do ABI and why should they
Each real entry shows 2 lines (previous + new), and between them are 10ms "ghost" entries that only repeat the previous text. This roughly triples the file size and makes the subtitles unreadable.
pip install subtitle-deduplicatoryay -S subtitle-deduplicator# Basic usage (outputs to video_deduped.srt)
subtitle-dedup video.srt
# Specify output file
subtitle-dedup video.srt -o video_clean.srt
# Overwrite in place
subtitle-dedup video.srt --in-place
# Custom ghost threshold (default: 20ms)
subtitle-dedup video.srt -t 50
# Specify encoding
subtitle-dedup video.srt -e latin-1Example Output:
✔ Deduplication complete!
ℹ Input: video.srt
ℹ Output: video_clean.srt
ℹ Original entries: 1559
ℹ Deduplicated: 760
ℹ Removed: 799 (51.3%)
| Duplicate Type | Description |
|---|---|
| Ghost entries | 10ms entries that repeat previous text |
| Carry-over lines | First line duplicating previous entry's last line |
| Identical entries | Back-to-back entries with same text |
| Empty entries | Entries with no actual text content |
subtitle-deduplicator uses only Python standard library — no pip install requirements beyond Python 3.8+.
MIT