Sometimes I find interesting videos in English while browsing the web, but my English is not good enough to follow everything. Creating subtitles and translating them into my native language is a practical solution. One option is to upload the video to YouTube and let YouTube generate subtitles, but that can take time.
A few days ago, I found a useful Facebook post explaining how to use Python to automatically create an .srt subtitle file. Once the subtitle file is available, it can be translated with another tool.
This guide uses Windows 10. The same general idea can also be used on Linux or macOS.
AutoSub (Python)
Autosub is a utility for automatically recognizing speech and creating subtitles. It accepts a video or audio file as input, detects speech activity to find speech segments, sends parallel requests to the Google Web Speech API to generate subtitles, optionally translates them into another language, and finally saves the subtitle file to disk. It supports multiple input and output languages, which can be listed with --list-languages, and can generate SRT or JSON output.
Open C:\Python27\scripts, rename autosub_app.py to autosub_app.py.bak so that the original can be restored later, and copy the downloaded autosub_app.py into the same directory.
Test the installation by opening Command Prompt as Administrator and running C:\Python27\scripts\autosub_app.py -h.
If the help output looks like the screenshot, the installation is working.
 Screenshot
Create a right-click menu shortcut by opening Notepad and pasting this code:
Press Windows + R, paste %APPDATA%\Microsoft\Windows\SendTo, and press Enter.
Drag the .bat file into that folder. The result should look like the screenshot below.
 Screenshot
After completing the setup, right-click a video, choose Send to, and select the .bat file. Wait for the .srt file to be generated in the same folder as the video.
Góp Ý / Bình Luận / Đánh giá