VOL. 1NO. ----Mon26.10.26EDITION--:--

LOADING · TRADINGVIEW

AIAITutorial NO. ---

How to transcribe audio with Whisper in Python (step-by-step)

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.

By Published 8 min read
OpenAI logo and wordmark, the developer of the open-source Whisper speech recognition model used in Python
OpenAI / Wikimedia Commons / Public domain · Source

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". 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, 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 package, which is the simplest to start with. The second is SYSTRAN's faster-whisper, 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, 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.

ModelParametersEnglish-only nameMultilingual nameApprox. VRAMRelative speed
tiny39Mtiny.entiny~1 GB~10x
base74Mbase.enbase~1 GB~7x
small244Msmall.ensmall~2 GB~4x
medium769Mmedium.enmedium~5 GB~2x
large1,550Mn/alarge~10 GB1x
turbo809Mn/aturbo~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 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:

SetupImplementation and precisionTimeMemory
large-v2, RTX 3070 Ti 8 GBopenai/whisper, fp162m23s4,708 MB VRAM
large-v2, RTX 3070 Ti 8 GBfaster-whisper, fp161m03s4,525 MB VRAM
large-v2, RTX 3070 Ti 8 GBfaster-whisper, int8, batch 816s4,500 MB VRAM
small, Intel i7-12700K, 8 threadsopenai/whisper, fp326m58s2,335 MB RAM
small, Intel i7-12700K, 8 threadsfaster-whisper, int81m42s1,477 MB RAM
small, Intel i7-12700K, 8 threadsfaster-whisper, int8, batch 851s3,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, or route new recordings through an automated pipeline like the one in our n8n and Ollama workflow tutorial. 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.

AIMore in AI

See all

Latest elsewhereDate · Title · Reading time

  1. Luka Doncic scores 52 points as Lakers beat Jazz 132-123

    Doncic led the Lakers back from an 18-point hole in Salt Lake City and now has 19 games of 40-plus points as a Laker, one more than LeBron James' 18. The Lakers are 3-0.

    CULT · 4 MIN
  2. Bitcoin Slips 0.89% on Oct 25, 2026 Ahead of Fed Meeting

    Bitcoin ended a quiet Sunday at $80,053.16 on Coinbase after briefly dipping below $80,000 again, while ether fell 1.21% and liquidations eased ahead of the Fed's October 27–28 meeting.

    CRYP · 6 MIN
  3. Next bitcoin halving: block 1,050,000 expected in April 2028

    Bitcoin's block subsidy halves every 210,000 blocks. With about 76,850 blocks to go as of Oct. 25, 2026, the fifth halving should land in spring 2028; here is the full schedule and what it means for miner income.

    CRYP · 7 MIN
  4. Prague protest: thousands rally against Czech public media bill

    Staff at Czech Television and Czech Radio have called a strike for Tuesday, November 3, and a larger rally is planned at Letná park on November 15. The bill still needs Senate approval.

    POL · 4 MIN