Question · Transcription
How do you make subtitles with Whisper?
Run the whisper command on your audio or video with --output_format srt, which writes a numbered, timed subtitle file. Add --word_timestamps True with --max_line_width 42 to break the captions into short lines, then check every cue against the audio, because Whisper's output is a draft.
Updated October 17, 20264 min read8 cited facts, each traced to its source
Run Whisper on your file with --output_format srt, and it writes a numbered, timed subtitle file. For captions that break into short lines, add --word_timestamps True and --max_line_width 42. Then check the file against the audio, because Whisper's output is a draft and not a finished caption file.
This page gives the commands, the options behind them and the checks that matter. For the rules on caption format and quality, read the guide to captions and subtitles.
The command writes an SRT file, and two options control the line breaks
The openai-whisper command-line tool has an output format option, and its choices include both SRT and WebVTT 1. The guide explains when each format fits: SRT for uploads and desktop editors, and WebVTT for a web player. Pick the format that the platform you publish to expects.
The steps below assume you have installed Whisper. If you have not, follow how to use Whisper to transcribe audio first.
-
Transcribe with SRT output. In a terminal, run this command, with your own file name in place of the example:
whisper interview.mp3 --model turbo --output_format srt
-
Turn on word timestamps and set the line width. Run the same command with two more options:
whisper interview.mp3 --model turbo --output_format srt --word_timestamps True --max_line_width 42
-
Check each cue. Open the SRT file in a text editor, play the recording beside it, and correct the text as you go.
-
Burn the captions into the video only when you must. If viewers cannot switch the captions off, FFmpeg's subtitles filter can draw them onto the picture 2:
ffmpeg -i video.mp4 -vf subtitles=interview.srt burned.mp4
Keep the SRT file as the master. Burned-in text is part of the picture, so a typo means rendering the video again.
Word timestamps and a line width give the captions their breaks
The help text for --word_timestamps calls the option experimental, and says it extracts word-level timestamps and refines the results with them 3. The second command above is the one that gives you line control.
The --max_line_width option sets the number of characters in a line before the line breaks, and its help text says it requires word timestamps 4. The value 42 is a sensible start, because Netflix's subtitle template guide sets 42 characters per line for most Latin-alphabet languages 5. That guide is one company's standard, so treat 42 as a starting point and adjust it for your platform.
The reason to turn on word timestamps is timing. Whisper's own timestamps mark whole utterances rather than single words, and they can be inaccurate by several seconds 6. Matching each known word to the audio is called forced alignment, and it is the step that gives a caption its start and end times.
Whisper's draft can invent text in quiet passages, so check those first
Whisper can produce text that the audio does not contain. In a 2024 study of a 2023 version of Whisper, tested on recordings from people with and without aphasia, roughly 1 percent of transcriptions contained entire hallucinated phrases or sentences that did not exist in the audio 7. In a caption file, that shows up as a sentence on screen during silence, music or a long pause, or as the same phrase repeated.
Before you publish, read the cues at the long gaps first. If a cue does not match what was said, delete it or re-transcribe that section. Why Whisper hallucinates explains the causes in more detail.
Check every cue against the recording before you publish
A subtitle file that looks right in a text editor can still fail on screen. Work through these checks while you play the video:
- Names, terms and numbers. Fix each one against a written list or the audio.
- Start and end times. Each cue should appear when the speech starts and leave when it ends.
- Sound tags. Add a tag such as [Music playing] when a sound matters to the scene. Captions cover sounds that a viewer needs, and subtitles do not.
- Line length and duration. Each cue should fit the line width you set and stay on screen long enough to read.
Play the file at the speed viewers will see it. A caption that is a fraction of a second late is easy to miss on a read-through, and easy to spot in playback.
It depends: speaker names, the audio and the model
Speaker names are a separate step. The commands above do not put speaker names into the file. You can add the names by hand while you check the cues. Tools built on Whisper can do more: WhisperX adds speaker diarization to Whisper's output 8, which means it labels who is speaking. For more on this, read whether Whisper can identify speakers.
The audio sets the accuracy. A clear recording of one speaker gives a better draft than a noisy meeting with overlapping voices. Test the command on a few minutes of your own audio before you process a long file. That test tells you more about your recordings than any published benchmark, which measures a different set of recordings.
The model sets the trade-off. The turbo model in the command is fast and works well for English, but it is a trade-off between speed, memory and accuracy. Which Whisper model is best compares the sizes.
Summary: the file is quick to make, and the checking is what makes it correct
The file comes out of one command, but the captions are only as good as the check you give them. Set the format and line width, read every cue against the recording, and fix the names, the timing and the quiet passages before you publish. For the wider task of turning recordings into text, see transcription, and for the caption rules, see the guide to captions and subtitles.
Evidence
Every number on this page, with where it comes from. Open a fact to see the exact words in its source.
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
Go deeper
Related questions
- Are automatic captions good enough for accessibility rules?
- How do you add automatic captions to YouTube Shorts?
- What is an SRT file, and how is it different from VTT?
- What is the difference between captions and subtitles?
- Are AI transcription devices and voice recorders worth it?
- Are transcription courses and certification worth it?
- Can AI transcribe Zulu, Xhosa and other African languages?
- Can Apple Notes transcribe audio recordings?