OpenAI Whisper Tutorial: Transcribe Audio Locally With Python
OpenAI Whisper tutorial: transcribe audio locally with Python. Setup, model choice, CLI commands, and the Python API, with privacy and cost trade-offs.
By Galactic News Editorial · Published 2026-11-19T19:45:45+00:00 · Updated 2026-11-19T19:45:45+00:00
OpenAI Whisper Tutorial: Transcribe Audio Locally With Python
This OpenAI Whisper tutorial shows how to transcribe audio locally with Python. Whisper is a free, open-source speech recognition model from OpenAI. You install it, run it on your own machine, and your audio never leaves your computer. This guide covers setup, your first transcription, model choice, and the Python API.
What Whisper Is and When Local Transcription Wins
Whisper is a general-purpose speech recognition model. It is trained on a large dataset of diverse audio. It handles multilingual speech recognition, speech translation into English, and language identification. The code and model weights are released under the MIT License.
Running it locally has two clear advantages. First, privacy. The audio stays on your machine, which matters for interviews, medical recordings, and client calls. Second, cost. There is no per-minute fee for local runs. You pay only for your own hardware and electricity.
The trade-off is speed. Local transcription runs at the pace of your machine. A laptop CPU is slower than real time on larger models. A GPU changes that, but it is not required. For short files and occasional jobs, a CPU setup works fine.
OpenAI Whisper Tutorial: Step-by-Step Setup
Follow these steps to get Whisper running on your machine.
- Install Python. Whisper needs Python 3.8 to 3.11. The official README says the code was tested with Python 3.9.9 and recent PyTorch versions. If you run a newer Python, create a virtual environment with a supported version first.
- Install FFmpeg. Whisper depends on FFmpeg to read audio files. On a Mac, run
brew install ffmpeg. On Ubuntu, runsudo apt update && sudo apt install ffmpeg. On Windows, download it from the FFmpeg site and add it to your system path. - Install Whisper. Run
pip install -U openai-whisper. Note the package name. Installing plainpip install whispergives you an unrelated project. You can also install the latest commit withpip install git+https://github.com/openai/whisper.git. - Check the install. Run
whisper --help. If it prints the options list, the install worked. - Transcribe your first file. Run
whisper audio.mp3 --model turbo. Whisper downloads the model weights automatically on first use, then writes the transcript next to your audio file. - Read the output. Whisper writes several files by default, including a plain text transcript and a subtitle file. Open the text file to check the result.
Choosing the Right Whisper Model
Whisper ships in six sizes. Bigger models are more accurate and slower. Smaller models are faster and less accurate. The table below uses the figures from the official README, measured on an A100 GPU with English speech. Your machine will differ.
| Model | Parameters | Memory needed | Relative speed | English-only version |
|---|---|---|---|---|
| tiny | 39 M | About 1 GB | About 10x | tiny.en |
| base | 74 M | About 1 GB | About 7x | base.en |
| small | 244 M | About 2 GB | About 4x | small.en |
| medium | 769 M | About 5 GB | About 2x | medium.en |
| large | 1,550 M | About 10 GB | 1x | None |
| turbo | 809 M | About 6 GB | About 8x | None |
Start with turbo. It is the default model, an optimized version of large-v3 that the README describes as much faster with minimal accuracy loss. It needs about 6 GB of GPU memory. On a CPU-only machine, try base or small first and step up if the quality is not good enough.
Two rules from the README matter in practice. First, turbo is not trained for translation. For translating speech into English, pick a multilingual model like medium or large. Second, English-only models exist for the smaller sizes. If your audio is English and your machine is weak, a .en model saves memory.
Transcribing in Python
The command line covers one-off jobs. For an app, use the Python API. The pattern is short.
import whisper
model = whisper.load_model("turbo")
result = model.transcribe("audio.mp3")
print(result["text"])That is the whole flow. The model loads, the file transcribes, and the result holds the text plus per-segment timestamps. The timestamps let you build a player that highlights words as the audio plays, or a search index over a recording library.
Common options are worth knowing. Pass language="English" to skip language detection and speed things up. Use fp16=False on a CPU, since half-precision is a GPU feature. For long files, split the audio into chunks first, then transcribe each chunk and join the results.
Output formats matter too. The CLI writes text, SRT, VTT, TSV, and JSON by default. Pick JSON when your code needs timestamps. Pick SRT or VTT when you need captions for a video.
When to Use the Hosted API Instead
Local Whisper is free, but it is not always the right call. The hosted API fits three cases. First, you need transcription inside a web app with no GPU server. Second, your volume is spiky and you do not want to manage machines. Third, you need the newer transcription models OpenAI now recommends, such as gpt-transcribe.
The hosted API is billed per minute, so check the current pricing page before committing. Note that the original whisper-1 API model is deprecated, with shutdown planned for February 2027, and OpenAI recommends its newer transcription models instead. Local Whisper is unaffected. The open-source model and code remain on GitHub.
Bottom Line
Install Python and FFmpeg, run pip install -U openai-whisper, and transcribe with whisper audio.mp3 --model turbo. Start with turbo, drop to base or small on weak hardware, and use medium or large for translation. Keep audio local when privacy matters, and switch to the hosted API only when you need scale or a managed service. The whole setup takes under half an hour.