Generate Video Subtitles
You can generate English subtitles (e.g., .srt files) from MP4 videos using automatic speech recognition (ASR) tools.
OpenAI Whisper (Best Accuracy)
Of all the options, this is the one that I used for majority of my videos.
Whisper is an open-source ASR model by OpenAI, known for its accuracy and support for many languages.
-
Make sure Python 3.8+ and pip are available:
python3 --versionpip3 --versionIf not yet installed:
sudo apt updatesudo apt install -y python3 python3-pip -
Install Whisper and dependencies:
pip install openai-whispersudo apt install ffmpeg -
Verify:
pip show openai-whisperSample output:
Name: openai-whisperVersion: 20240930Summary: Robust Speech Recognition via Large-Scale Weak SupervisionHome-page: https://github.com/openai/whisperAuthor: OpenAIAuthor-email:License: MITLocation: /home/username/.local/lib/python3.10/site-packagesRequires: more-itertools, numba, numpy, tiktoken, torch, tqdm, triton -
Generate subtitles:
whisper your_video.mp4 --language English --task transcribe --output_format srt -
It will create
your_video.srtin the same folder.
Note: It uses your CPU or GPU. Can be slow on large files without a GPU.
(Optional) Transcribe All MP4s in a Folder
If you have multiple videos that you want to transcribe, you can use a script:
for f in *.mp4; do
whisper "$f" --language English --task transcribe --output_format srt
done
To process MP4 files in the current directory and all nested directories (recursively):
find . -type f -name "*.mp4" | while read -r f; do
whisper "$f" --language English --task transcribe --output_format srt
done
SubtitleEdit (GUI, Windows)
Subtitle Edit is a Windows app with built-in speech recognition using Whisper or Google APIs.
- Download Subtitle Edit: https://www.nikse.dk/subtitleedit/
- Open your MP4 video in the app.
- Go to
Video>Audio to text (Whisper)orGenerate Subtitles via Google.
YouTube (Hacky but works)
If the video is not sensitive/private, upload it as unlisted to YouTube.
- Upload video as unlisted/private.
- Wait for auto-captions to generate.
- Download captions via YouTube Studio or use 3rd-party tools like DownSub.
Online Tools
There are websites that offer auto-captioning:
These often require a free account or have limits unless you subscribe.