Tools
whisper.cpp, ffmpeg
Price
Free (open source)
Time
2 min per video, after setup
Level
Terminal, beginner

Many videos are watched with the sound off. Subtitles keep your message readable anyway, and they help people who are hard of hearing. Two formats are enough: SRT, a plain text file with a number, a start and end time, then the sentence; and VTT (WebVTT), its variant designed for video on the web.

Install the tools

If you followed the Transcribe a video locally tutorial, everything is already set up: skip ahead.

  1. Install whisper.cpp and ffmpeg with Homebrewwhisper.cpp does the speech recognition, ffmpeg prepares the audio.
    Terminal
    brew install whisper.cpp ffmpeg
  2. Download a modelThe "small" model (about 490 MB) is a good balance of speed and quality. For English-only videos, the smaller "base.en" model also works.
    Terminal
    mkdir -p ~/.local/share/whisper
    curl -L -o ~/.local/share/whisper/ggml-small.bin \
      https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin

Generate the subtitles

  1. Extract the audio from your videoOpen the Terminal in the video's folder and replace my-video.mp4 with its name. whisper.cpp expects a 16 kHz mono WAV file.
    Terminal
    ffmpeg -i my-video.mp4 -ar 16000 -ac 1 my-video.wav
  2. Create the SRT and VTT files-osrt and -ovtt pick the formats, -ml 42 caps each subtitle at 42 characters so it stays readable, -sow splits between words and -of sets the file name. Use -l auto if you are not sure of the language.
    Terminal
    whisper-cli -m ~/.local/share/whisper/ggml-small.bin -l en \
      -osrt -ovtt -ml 42 -sow -of my-video -f my-video.wav
    You get my-video.srt and my-video.vtt, which look like this:
    my-video.srt
    1
    00:00:00,000 --> 00:00:02,530
    Hi, here are three ideas to
    
    2
    00:00:02,530 --> 00:00:05,280
    save time on your quotes.
  3. Proofread and fixOpen the file in TextEdit and correct misheard words without touching the timings. Names, brands and foreign words are the most common mistakes.

Where to use the file

  • YouTube: in YouTube Studio, open Subtitles, add the language, choose to upload a file "with timing" and send the SRT. YouTube accepts both SRT and VTT.
  • Instagram, TikTok: the text has to be part of the picture. Import the SRT into your video editor if it supports it (check its help pages), style it, then export.
  • Your website: add the VTT file to the video tag. Visitors can then turn subtitles on or off.
HTML
<video controls src="my-video.mp4">
  <track default kind="subtitles" srclang="en" label="English" src="my-video.vtt">
</video>

Check before posting. Automatic transcription always makes a few mistakes. Proofread before you publish, especially numbers, prices and client names: a wrong subtitle is more visible than a mumbled word.

Sources

Publishing a lot of video? This can run automatically on every file dropped into a folder: it is the kind of automation I set up.