Skip to content

Audio Subtitles and OpenAI Whisper

  • If getting from YouTube or platforms support subtitles, try using yt-dlp - YouTube Downloader (yt-dlp) first like yt-dlp --write-auto-sub --sub-lang en --skip-download "https://www.youtube.com/watch?v=videoid" --output subtitles.txt

Using OpenAI Whisper to Create Subtitles from a Video

Section titled “Using OpenAI Whisper to Create Subtitles from a Video”

Follow instructions from OpenAI Whisper - GitHub

Example to create English subtitles from an existing mp4 video (example assumes python, ffmpeg, and rust tools are installed):

Terminal window
mkdir subtitles
cd subtitles
python -m virtualenv ./venv
# or uv init; uv venv
source ./venv/bin/activate
pip install -U openai-whisper
# or uv add openai-whisper
# Create audio from existing video
ffmpeg -i input_video.mp4 -q:a 0 -map a audio.wav
# Create subtitle file with audio using a model
# See Whisper documentation on which model to use and with languages
whisper audio.wav --model small --language English --output_format srt
## audio.srt file will be created