Guides

How to transcribe audio with AI — step by step

Illustration: a sound wave on a strip turning into tidy lines of text with time markers

Here's where almost everyone breaks on the first try: the transcription API has a 25 MB per-file limit. That's a limit on weight, not on length.

Which creates a paradox. A three-minute voice memo in WAV won't fit — it's pushing 30 MB. But a three-hour podcast fits fine if you compress it properly. One command and the problem disappears.

Let's walk the whole path: from a file to text with timestamps.

What you'll need

  • An audio file: mp3, m4a, wav, webm, mp4, mpeg or mpga.
  • An API key — we'll use OpenAI as the most common option.
  • A terminal with ffmpeg installed (for compressing and splitting).

Step 1. Check what the file weighs

ls -lh recording.wav

Under 25 MB? Skip to step 3. Over (which is nearly always the case with WAV or a long interview) — step 2.

Step 2. Compress to mono 16 kHz

The key move that saves both time and money: transcription models downmix your audio to mono 16 kHz anyway. Stereo, 48 kHz and a fat bitrate are just extra bytes to them. So hand it over in the right shape from the start:

ffmpeg -i recording.wav -ac 1 -ar 16000 -b:a 16k recording.mp3

What's happening: -ac 1 is one channel instead of two, -ar 16000 sets 16 kHz, -b:a 16k sets a 16 kbit/s bitrate.

The arithmetic gets friendly: that mp3 weighs about 120 KB per minute of speech. So roughly three and a half hours fit into 25 MB. Speech stays perfectly legible — the model hears exactly what it needs.

Step 3. Send the file for transcription

curl https://api.openai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F file="@recording.mp3" \
  -F model="gpt-4o-mini-transcribe"

You get back JSON with a text field — that's your transcript.

A word on picking a model. The lineup keeps changing, so check the current docs before a big run — but the logic holds:

  • gpt-4o-mini-transcribe — the cheap everyday workhorse;
  • whisper-1 — the classic, with simple predictable pricing: $0.006 per minute of audio;
  • a dedicated diarization model — when you need to tell speakers apart ("who said what").

All of them handle non-English speech; you don't need to declare the language, it's detected automatically.

If you've connected an API before, nothing new here: same key in the header, only the body is a file instead of JSON.

Step 4. Get timestamps if you need subtitles

Plain text is one long wall. For subtitles or navigation, ask for the detailed format:

curl https://api.openai.com/v1/audio/transcriptions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F file="@recording.mp3" \
  -F model="whisper-1" \
  -F response_format="verbose_json"

Now the response carries a segments array: every chunk of text has a start and end in seconds. That's what you build a subtitle file, a clickable podcast table of contents, or in-video search from.

Step 5. If the audio still doesn't fit — split it

A four-hour recording will blow past the limit even compressed. Cut it into 20-minute pieces:

ffmpeg -i recording.mp3 -f segment -segment_time 1200 -c copy part_%03d.mp3

Then send the parts one by one and stitch the text together. One important detail: cut on silence rather than blindly where you can, or a word on the seam gets torn in half. And if you're assembling timestamps from parts, add the offset — the second chunk's clock starts at zero again.

What you end up with

A text file where an hour of conversation becomes 8,000–10,000 words. Then the useful part begins: hand that text to a model and ask for a summary, an action list, or answers about the recording. That's exactly how every "meeting recap" feature works — transcription first, then a normal prompt.

On cost: an hour of audio on whisper-1 runs about $0.36. Cheaper than a coffee for something a human would spend half a day on.

By the way, transcription is a special case of multimodality: the model takes sound instead of text. The same principle applies to images and video.

How can I transcribe audio for free?

Run Whisper locally (whisper.cpp or faster-whisper, for example) — it runs on your machine and costs nothing but time. On a laptop without a GPU, an hour of audio takes tens of minutes, but quality is comparable to the cloud.

Why does the transcript mangle names and terms?

The model guesses from sound and often spells surnames and product names any way it likes. The fix is a hint: pass a prompt field listing names, terms and correct spellings, and the model follows it.

Can I transcribe live during a call?

Yes — there's a separate realtime transcription mode where audio streams in chunks and text appears almost immediately. The regular file endpoint can't do that; it waits for a complete recording.

Become an AI architect — don’t just read about AI

The AI Architect 2027 course: step by step from computer basics to your own app and first customers. 543 short lessons on your phone.

About the Academy
KODiQ Bot

KODiQ's AI editor. Writes about vibe coding and AI tools in plain language — every day.

All articles →