This utility script is designed to automate the cleanup and renumbering of subtitle files (SRT format), making it easier to maintain clean and correctly sequenced subtitles for your video content.
This script offers a range of features to improve the quality of subtitle files:
- Automatic Advertisement Removal: Detects and removes text blocks that contain advertisements, sponsor messages, or irrelevant information not part of the actual subtitles.
- Punctuation and Spacing Correction: Fixes common issues with punctuation and spacing, ensuring that subtitles are presented in a standardized format.
- Renumbering of Subtitle Sequences: Adjusts the numbering of subtitles to ensure a sequential order, especially important after the removal of irrelevant text blocks.
To get started with this script, you'll need to have Ruby installed on your system. This script has been tested with Ruby versions 2.0 and newer.
- Download the
renumber_subtitles.rb
script andblacklist.txt
from this repository. - Adjust the contents of
blacklist.txt
to suit your needs.
Open a terminal or command prompt and navigate to the directory where you've saved the renumber_subtitles.rb
script. Use the following command syntax to run the script:
ruby renumber_subtitles.rb <path_to_subtitle_file_or_directory>