Skip to content

Repository files navigation

Automated SRT Captioning Tool

A Python-based tool for cleaning and correcting SRT (SubRip Subtitle) caption files. Designed for processing ceremony recordings and graduation videos with intelligent text matching and name correction.

Features

  • Filler Word Removal: Automatically removes common filler words (uh, um, you know, etc.)
  • Script Matching: Matches captions against a reference script using fuzzy matching (85% similarity threshold)
  • Name Correction: Corrects graduate names using pattern matching
  • Batch Processing: Handles entire SRT files efficiently
  • Review Logging: Generates detailed logs of corrections made

Requirements

  • Python 3.x
  • Standard library only (no external dependencies)

Installation

  1. Clone this repository
  2. No additional dependencies required - uses Python standard library

Usage

Basic Usage

python3 srt_cleaner_script.py

Input Files Required

  1. input.srt - The SRT caption file to be cleaned
  2. ceremony_script.txt - Reference script for matching (one line per statement)
  3. graduate_names.txt - List of graduate names (one per line)

Output

  • cleaned_output.srt - Cleaned and corrected caption file
  • review_log.txt - Detailed log of all corrections made

Configuration

Edit the constants at the top of srt_cleaner_script.py:

SRT_FILE = "input.srt"           # Input SRT file
SCRIPT_FILE = "ceremony_script.txt"  # Reference script
NAMES_FILE = "graduate_names.txt"    # Graduate names
OUTPUT_FILE = "cleaned_output.srt"   # Output file

Filler Words

Customize the filler words to remove:

FILLER_WORDS = {"uh", "um", "you know", "okay", "alright", "all right", "let's do it again"}

How It Works

  1. Load Resources: Reads script lines, graduate names, and SRT blocks
  2. Text Cleaning: Removes filler words and normalizes text
  3. Script Matching: Uses difflib.SequenceMatcher for fuzzy matching (>85% similarity)
  4. Name Correction: Pattern-matches and corrects graduate names
  5. Output Generation: Creates cleaned SRT file with proper formatting

Example

Input:

1
00:00:01,000 --> 00:00:03,000
Uh, welcome everyone, um, to the ceremony

Output:

1
00:00:01,000 --> 00:00:03,000
Welcome everyone to the ceremony

Project Structure

srt-cleaner/
├── srt_cleaner_script.py       # Main cleaning script
├── srt-cleaner-project.py      # Alternative version
├── input.srt                   # Input caption file
├── ceremony_script.txt         # Reference script
├── graduate_names.txt          # Names database
├── cleaned_output.srt          # Output file
└── review_log.txt              # Correction log

Use Cases

  • Graduation ceremony videos
  • Conference recordings
  • Educational content
  • Professional presentations
  • Any video content requiring accurate captions

Contributing

Contributions are welcome! Please ensure:

  • Code follows Python PEP 8 style guidelines
  • Functions include docstrings
  • Changes are tested with sample SRT files

License

See LICENSE file for details.

Notes

  • Matching threshold of 85% balances accuracy and flexibility
  • Name correction uses partial matching (first 3 characters) for fuzzy matching
  • All text comparisons are case-insensitive for better matching

About

SRT Cleaner Project VS Code & Cursor

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages