> ## Content Index
> Fetch the complete content index at: https://bullquill.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to transcribe audio with Whisper in Python (step-by-step)
- URL: https://bullquill.com/how-to-transcribe-audio-whisper-python/
- Published: 2026-10-26T00:14:01.000Z
- Updated: 2026-10-26T00:27:45.000Z
- Description: Install openai-whisper and ffmpeg, choose a model from tiny (39M parameters) to large (1,550M), write TXT or SRT files straight from the command line, then switch to faster-whisper to cut memory use.
- Author: Rowan Ashby
- Tags: AI, Tutorial, How-To, OpenAI Whisper, faster-whisper, Python, Speech Recognition, #lang-en, #evergreen, #tr-how-to-transcribe-audio-whisper-python

## Key takeaways

- OpenAI's Whisper turns speech into text on your own machine: install `openai-whisper` plus ffmpeg, load a model and call `transcribe()`.
- Model sizes run from tiny (39M parameters, about 1 GB of VRAM) to large (1,550M parameters, about 10 GB), according to the official repository.
- The command-line tool writes TXT, VTT, SRT, TSV and JSON files, so subtitles need no extra code.
- faster-whisper reuses the same models on CTranslate2 and, per its maintainers, runs up to 4 times faster for the same accuracy with less memory.
- The turbo model is fast but cannot translate; use medium or large for speech-to-English translation.

## How to transcribe audio with Whisper in Python

To transcribe audio with Whisper in Python, run **pip install -U openai-whisper**, install ffmpeg, then call **whisper.load\_model("turbo").transcribe("audio.mp3")**. Everything runs locally, and the code and weights are MIT-licensed, according to OpenAI's GitHub repository.

Whisper is an open-source speech recognition model that OpenAI described in a December 2022 paper, ["Robust Speech Recognition via Large-Scale Weak Supervision"](https://arxiv.org/abs/2212.04356?ref=bullquill.com). The original models were trained on 680,000 hours of multilingual and multitask audio, which is why they cope with accents, background noise and technical vocabulary better than many older systems. The later large-v3 checkpoint, according to its [Hugging Face model card](https://huggingface.co/openai/whisper-large-v3?ref=bullquill.com), was trained on about 1 million hours of weakly labeled audio and 4 million hours of pseudo-labeled audio and cuts errors by roughly 10% to 20% compared with large-v2.

This guide covers two libraries. The first is the official [openai/whisper](https://github.com/openai/whisper?ref=bullquill.com) package, which is the simplest to start with. The second is [SYSTRAN's faster-whisper](https://github.com/SYSTRAN/faster-whisper?ref=bullquill.com), which is the better choice when you have hours of audio or only a CPU. If you already run language models at home with our [Ollama guide](https://bullquill.com/how-to-run-local-llm-with-ollama/), Whisper is the natural next piece: it turns meetings, podcasts and voice notes into text that a local model can summarise or search.

## Step 1: Install Whisper and ffmpeg

Create a virtual environment first so the PyTorch dependency does not clash with other projects. The Whisper authors say they tested with Python 3.9.9 and PyTorch 1.10.1 and expect the code to work with Python 3.8 to 3.11 and recent PyTorch releases.

```
python3 -m venv whisper-env
source whisper-env/bin/activate      # Windows: whisper-env\Scripts\activate
pip install -U openai-whisper
```

openai-whisper reads audio through the `ffmpeg` command-line tool, so install it with your system package manager:

```
# Ubuntu or Debian
sudo apt update && sudo apt install ffmpeg

# macOS (Homebrew)
brew install ffmpeg

# Windows (Chocolatey or Scoop)
choco install ffmpeg
scoop install ffmpeg
```

If installation fails with `No module named 'setuptools_rust'`, the README says to run `pip install setuptools-rust`; the tokenizer dependency occasionally needs Rust on platforms without a prebuilt wheel.

## Step 2: Pick the right Whisper model size

The model you load decides speed, memory use and accuracy. The table below reproduces the figures published in the official repository. Speed is relative to the large model on an A100 GPU, so treat it as a ranking rather than a promise for your hardware.

| Model  | Parameters | English-only name | Multilingual name | Approx. VRAM | Relative speed |
| ------ | ---------- | ----------------- | ----------------- | ------------ | -------------- |
| tiny   | 39M        | tiny.en           | tiny              | \~1 GB       | \~10x          |
| base   | 74M        | base.en           | base              | \~1 GB       | \~7x           |
| small  | 244M       | small.en          | small             | \~2 GB       | \~4x           |
| medium | 769M       | medium.en         | medium            | \~5 GB       | \~2x           |
| large  | 1,550M     | n/a               | large             | \~10 GB      | 1x             |
| turbo  | 809M       | n/a               | turbo             | \~6 GB       | \~8x           |

Source: openai/whisper README, data as of 26 October 2026.

Three rules of thumb follow from those numbers:

- **English audio on a CPU:** start with `base.en` or `small.en`. The README notes the `.en` models perform better for English, especially at the tiny and base sizes.
- **Multilingual audio on a GPU:** `turbo` is the default. OpenAI describes it as an optimised large-v3 that is faster with minimal accuracy loss.
- **Translation into English:** use `medium` or `large`. The README states plainly that "the turbo model is not trained for translation tasks" and will return the original language.

Model files download automatically on first use and are cached, so the first run takes longer than later ones. The memory figures behave much like those for language models; our explainer on [LLM quantization and GGUF](https://bullquill.com/what-is-llm-quantization-gguf/) covers why lower precision shrinks them.

## Step 3: Transcribe an audio file from the command line

The quickest test needs no Python code at all. The `whisper` command installed by the package accepts one or more files in any format ffmpeg can read, such as MP3, WAV, M4A or MP4:

```
whisper interview.mp3 --model small.en --output_format srt --output_dir transcripts
```

Useful options, all listed in the CLI source code:

- `--model`: model name; the default is `turbo`.
- `--language`: set it (for example `--language Japanese`) to skip auto-detection and avoid wrong guesses on short clips.
- `--task translate`: produce English text from non-English speech (not with turbo).
- `--output_format`: `txt`, `vtt`, `srt`, `tsv`, `json`, `jsonl` or `all` (the default).
- `--word_timestamps True`: per-word timing, required for options such as `--max_line_width` that reflow subtitles.
- `--initial_prompt`: a short text with names or jargon to steer spelling.
- `--fp16 False`: silences the half-precision warning when running on a CPU.

## Step 4: Transcribe audio in a Python script

Inside Python, three lines give you the full transcript, and the result also carries timestamped segments and the detected language:

```
import whisper

model = whisper.load_model("small")          # or "turbo", "large-v3", "base.en"
result = model.transcribe("interview.mp3", language="en", fp16=False)

print(result["language"])
print(result["text"])

for seg in result["segments"]:
    print(f'[{seg["start"]:7.2f} -> {seg["end"]:7.2f}] {seg["text"].strip()}')
```

`fp16=False` is only needed on a CPU; on an NVIDIA GPU leave it at the default for speed. Behind the scenes Whisper works on 30-second windows of audio and slides through longer recordings, so a two-hour file works the same way as a two-minute clip, only slower.

## Step 5: Export SRT subtitles in Python

The package ships the same writers the CLI uses. `get_writer()` takes a format and an output folder, and the returned writer takes the result and the original audio path, which it uses to name the file:

```
from whisper.utils import get_writer

writer = get_writer("srt", "transcripts")    # "vtt", "txt", "tsv", "json" or "all"
writer(result, "interview.mp3")              # writes transcripts/interview.srt
```

Open the SRT file in VLC or upload it to a video platform to check timing. If subtitle lines are too long, transcribe with `word_timestamps=True` and pass options such as `{"max_line_width": 42, "max_line_count": 2}` as a third argument to the writer.

## Step 6: Speed it up with faster-whisper

faster-whisper loads the same Whisper weights into CTranslate2, an inference engine built for transformer models. It needs Python 3.9 or newer and, unlike openai-whisper, does not need ffmpeg on the system because it decodes audio with the PyAV library. GPU use requires NVIDIA's cuBLAS for CUDA 12 and cuDNN 9, according to the project README.

```
pip install faster-whisper
```

```
from faster_whisper import WhisperModel

# GPU: device="cuda", compute_type="float16"
# CPU: device="cpu",  compute_type="int8"
model = WhisperModel("large-v3", device="cpu", compute_type="int8")

segments, info = model.transcribe("interview.mp3", beam_size=5, vad_filter=True)
print(f"Detected {info.language} ({info.language_probability:.2f})")

for seg in segments:          # transcription runs while you iterate
    print(f"[{seg.start:7.2f} -> {seg.end:7.2f}] {seg.text.strip()}")
```

Two details trip up first-time users. `segments` is a generator, so nothing is transcribed until you loop over it or call `list()`. And `vad_filter=True` runs a voice activity detector that, by default, removes silences longer than 2 seconds, which reduces both run time and the "hallucinated" text Whisper sometimes produces over long pauses.

The maintainers publish benchmarks on 13 minutes of audio with a beam size of 5\. Selected rows:

| Setup                             | Implementation and precision  | Time  | Memory        |
| --------------------------------- | ----------------------------- | ----- | ------------- |
| large-v2, RTX 3070 Ti 8 GB        | openai/whisper, fp16          | 2m23s | 4,708 MB VRAM |
| large-v2, RTX 3070 Ti 8 GB        | faster-whisper, fp16          | 1m03s | 4,525 MB VRAM |
| large-v2, RTX 3070 Ti 8 GB        | faster-whisper, int8, batch 8 | 16s   | 4,500 MB VRAM |
| small, Intel i7-12700K, 8 threads | openai/whisper, fp32          | 6m58s | 2,335 MB RAM  |
| small, Intel i7-12700K, 8 threads | faster-whisper, int8          | 1m42s | 1,477 MB RAM  |
| small, Intel i7-12700K, 8 threads | faster-whisper, int8, batch 8 | 51s   | 3,608 MB RAM  |

Source: SYSTRAN/faster-whisper README benchmarks, data as of 26 October 2026\. Results on other hardware will differ.

For long files on a GPU, the batched pipeline gives the largest gain. It is a drop-in replacement for `transcribe()`:

```
from faster_whisper import WhisperModel, BatchedInferencePipeline

model = WhisperModel("turbo", device="cuda", compute_type="float16")
batched = BatchedInferencePipeline(model=model)
segments, info = batched.transcribe("podcast.mp3", batch_size=16)
```

### Write SRT subtitles with faster-whisper

faster-whisper has no built-in subtitle writer, but SRT is a simple format: a counter, a time range in `HH:MM:SS,mmm`, the text and a blank line.

```
def srt_time(t):
    ms = round(t * 1000)
    h, ms = divmod(ms, 3_600_000)
    m, ms = divmod(ms, 60_000)
    s, ms = divmod(ms, 1000)
    return f"{h:02}:{m:02}:{s:02},{ms:03}"

segments, info = model.transcribe("interview.mp3", vad_filter=True)

with open("interview.srt", "w", encoding="utf-8") as f:
    for i, seg in enumerate(segments, start=1):
        f.write(f"{i}\n{srt_time(seg.start)} --> {srt_time(seg.end)}\n{seg.text.strip()}\n\n")
```

Need word-level timing for karaoke-style captions or search? Pass `word_timestamps=True` and read `seg.words`, where each item has `start`, `end` and `word`.

## Common problems and fixes

- **"FP16 is not supported on CPU; using FP32 instead":** harmless. Pass `fp16=False` (or `--fp16 False`) to hide it.
- **FileNotFoundError when loading audio with openai-whisper:** ffmpeg is missing from your PATH. Run `ffmpeg -version` to check.
- **CUDA out of memory:** pick a smaller model from the table, or move to faster-whisper with `compute_type="int8_float16"` or `"int8"`.
- **Wrong language on short clips:** set the language explicitly instead of relying on detection from the first 30 seconds.
- **Repeated or invented sentences over silence or music:** enable `vad_filter=True` in faster-whisper, or trim long silent stretches before transcription.
- **Misspelled names and jargon:** pass a short `initial_prompt` containing the correct spellings.

## What it means

Local transcription removes two old obstacles: per-minute fees and sending private recordings to a third-party server. With a mid-range laptop, the small or turbo model produces usable transcripts of interviews, lectures and meetings, and faster-whisper's int8 mode makes even CPU-only machines practical for hours of audio.

Transcripts also become raw material for the rest of a local AI stack. You can index them for question answering with a [local RAG app in Python](https://bullquill.com/how-to-build-rag-app-python-local/), or route new recordings through an automated pipeline like the one in our [n8n and Ollama workflow tutorial](https://bullquill.com/how-to-build-n8n-ai-workflow-ollama/). Accuracy still varies with audio quality, accents and domain vocabulary, so spot-check important passages, especially quotes and numbers, before relying on a transcript.

## Frequently asked questions

### Is OpenAI Whisper free to use offline?

Yes. The openai-whisper code and model weights are released under the MIT License, and once a model has been downloaded the transcription runs entirely on your own CPU or GPU without an API key or internet connection.

### Which Whisper model should I use?

For English-only audio on a laptop CPU, small.en or base.en is a sensible start. For multilingual audio with a GPU of about 6 GB, turbo is the default in openai-whisper. Use large-v3 when accuracy matters more than speed, and medium or large when you need translation to English, because turbo is not trained for translation.

### How do I get SRT subtitles from Whisper?

On the command line run whisper audio.mp3 --output\_format srt. In Python, pass the transcribe() result to whisper.utils.get\_writer('srt', output\_dir). With faster-whisper, write each segment's start, end and text yourself in SRT time format.

### Is faster-whisper more accurate than openai-whisper?

No. It uses the same Whisper models, reimplemented on the CTranslate2 inference engine. Its maintainers say it is up to 4 times faster for the same accuracy while using less memory, and 8-bit quantization reduces memory further.