Skip to content

fr0stb1rd/subtitle-deduplicator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

subtitle-deduplicator 🎬

PyPI AUR GitHub

SRT Subtitle Duplicate Remover

Remove duplicate/ghost entries from auto-generated SRT subtitle files. | GitHub | PyPI | AUR |Blog

Why?

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.

Install

PyPI

pip install subtitle-deduplicator

Arch Linux (AUR)

yay -S subtitle-deduplicator

Usage

# 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-1

Example Output:

✔ Deduplication complete!
ℹ Input:               video.srt
ℹ Output:              video_clean.srt
ℹ Original entries:    1559
ℹ Deduplicated:        760
ℹ Removed:             799 (51.3%)

What It Removes

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

Zero Dependencies

subtitle-deduplicator uses only Python standard library — no pip install requirements beyond Python 3.8+.

License

MIT

About

lightweight command-line tool that cleans auto-generated SRT subtitles by removing ghost entries, carry-over lines, and duplicate content.

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages