This script processes video files in a specified folder, generates SRT subtitle files using the faster-whisper tool, and translates non-English subtitles to English, creating a new .en.forced.srt file.
- Python 3.x
googletranslibrarytqdmlibrarysrtlibrary
You can install the required libraries using pip:
pip install googletrans==4.0.0-rc1 tqdm srt- Download the faster-whisper standalone for Windows from here.
- Extract the downloaded files into a directory named
faster-standalone.
- Place your video files in a folder.
- Run the script with the folder path as an argument:
python generateEnForced.py <path_to_video_folder>Alternatively, you can run the script without arguments and it will prompt you to enter the folder path.
python generateEnForced.py F:/Dev/videosThis will process all video files in the specified folder, generate SRT files if they don't exist, and create .en.forced.srt files with translated subtitles.
- The script supports the following video file extensions:
.mp4,.avi,.mkv,.mov,.flv,.wmv,.mpeg,.webm. - Ensure that the faster-whisper executable and its dependencies are correctly placed in the
faster-standalonedirectory.
This project is licensed under the MIT License.