AI tools

How do you transcribe audio with Whisper?

· By Robert Scales · 4 min read

Short answer

Install Whisper and the free ffmpeg audio tool, then run one command such as `whisper interview.mp3 --model small --language French` and Whisper writes a plain-text transcript plus two subtitle files with timestamps. Choose the model size your computer can handle, give it the language and any tricky names, and always check the result by ear.

Whisper, the speech recognition model OpenAI released as open source on September 21, runs on your own computer. That makes it useful for exactly the kind of recording many people have sitting on a phone: an interview, a meeting, a lecture or a voice memo. You give it an audio file, and it gives you back a transcript.

This guide walks through one real-world job from start to finish: a 15-minute interview recorded in French on a phone, turned into text you can quote and subtitles you can attach to a video.

Before you start

You need three things:

  1. Python, the programming language Whisper is written in, version 3.7 or newer.
  2. ffmpeg, a free program that reads almost any audio or video format. On a Mac it installs through Homebrew; on Windows and Linux through the usual package tools.
  3. Whisper itself, installed with a single pip command from its GitHub page.

The first time you use a model, Whisper downloads it automatically. A graphics card (GPU) speeds things up a lot, but the smaller models also run on an ordinary laptop processor, just more slowly.

A worked example: transcribing an interview

Say the file is called entrevue-boulangere.m4a: a baker in a small town talks about her business. Here are the steps.

Step 1: pick a model. The command uses the small model unless you choose another. Small is a sensible start for a laptop. If your machine has a capable GPU, medium is noticeably more accurate.

Step 2: run the command.

Prompt
whisper entrevue-boulangere.m4a --model medium --language French --initial_prompt "Entrevue avec Josée Lacasse, Boulangerie du Ruisseau, Saint-André-Avellin." -o transcripts

Each part has a job:

PartWhat it does
--model mediumChooses the model size
--language FrenchSkips automatic detection, which otherwise guesses the language from the first 30 seconds
--initial_prompt "…"Gives the model some text to start from, which helps with names, places and spelling
-o transcriptsSaves the results in a folder called transcripts

The names in this example are made up; use the real names and places from your own recording. A prompt written in French also nudges the model toward French punctuation and accents.

Step 3: read the output. Whisper prints each line with its timestamps as it works. When it finishes, the folder holds three files with the same name as the audio:

  • .txt: the plain transcript, ready to paste into a document.
  • .srt and .vtt: two common subtitle formats, each line tied to a start and end time, ready to load into a video editor or a web player.

Step 4: check it. Play the audio while you read the text. Pay close attention to names, numbers and the first and last words of each segment, which the Whisper paper lists among the places errors tend to appear. Whisper can also get stuck repeating a phrase or, more rarely, write a sentence nobody said. For anything you will publish or quote, a careful listen is not optional.

If you prefer Python, the same job takes a few lines: load a model, call transcribe on the file, and you get back a dictionary with the full text, a list of timed segments and the detected language.

Try it: Record two minutes of yourself describing your street, including at least two local place names. Transcribe it once with no prompt and once with an --initial_prompt that lists those names. Compare the two .txt files and count the differences.

Getting better results

A few habits make a large difference:

  • Record cleanly. Place the phone close to the speaker, away from a fridge or a coffee grinder. Whisper copes with noise better than many systems, but clean audio still wins.
  • Go up one size for important work. Larger models are slower but make fewer mistakes, especially outside English.
  • Use subtitles to navigate. Even if you only need the text, the .srt file tells you exactly where in the recording each sentence is, which makes checking much faster.
  • Mind privacy. Because Whisper runs on your own machine, the recording does not have to leave your computer, which matters for confidential interviews.

How accurate is it in French?

French is one of Whisper's strongest languages after English. Its training data included 9,752 hours of French speech with transcripts, one of the largest shares of any language.

The paper measures accuracy with the word error rate (WER): the share of words the model gets wrong, by substituting, missing or adding them. Lower is better; a WER of 10% means about one word in ten needs fixing. Here are its French results on three public test sets:

Test set (type of speech)Small modelMediumLarge
Multilingual LibriSpeech (audiobooks)16.2%8.9%8.9%
Common Voice 9 (volunteers reading sentences)22.7%16.0%14.7%
FLEURS (read sentences, many speakers)15.0%8.7%7.7%

Two lessons stand out. First, model size matters a great deal in French: on the audiobook and FLEURS tests, the small model makes nearly twice as many errors as medium, while in English the gap between them is much narrower. Second, results vary by kind of recording, so the same model can be very good on clear reading and weaker on casual or amateur audio.

These test sets are mostly read speech, and the paper does not report results by accent, so they say little about a fast-talking interview in Québec French full of local expressions. The practical approach is to test it yourself: transcribe a few minutes of the kind of audio you actually have with the small and medium models, check them against the recording, and pick the smallest model that gives you text you are happy to correct.

Sources

  1. whisper/transcribe.py (command-line options, commit of 30 September 2022) — OpenAI on GitHub, September 30, 2022
  2. Robust Speech Recognition via Large-Scale Weak Supervision — OpenAI, September 21, 2022
  3. openai/whisper (README) — OpenAI on GitHub, September 21, 2022

Get the free Guide to Artificial Intelligence

Sign up for the weekly newsletter and receive the free guide: what changed in AI this week, one lesson, one prompt to try. Unsubscribe in one click.

How we handle your address

Back to top

Display

Your choices are saved in this browser only. No data is sent.

Text size
100%
Colours
Reading
More settings
Accessibility statement