YouTube Transcripts

How to Transcribe a YouTube Video with Whisper (yt-dlp + Python Guide)

··7 min read

You need a transcript from a YouTube video. The auto-captions are wrong, there are no captions at all, or you need clean timestamped text you can actually trust. OpenAI Whisper handles all three cases — here is the exact pipeline to pull audio with yt-dlp and run Whisper locally, plus a clear decision tree for when you should skip Whisper entirely and pull existing captions instead.


Step 1 — Download the Audio with yt-dlp

Short answer: Run yt-dlp -x --audio-format mp3 <URL> to strip audio from a YouTube video and save it as an MP3. That file is your Whisper input.

yt-dlp is the maintained successor to youtube-dl and the right tool for the job. Install it first:

pip install yt-dlp
# or on macOS with Homebrew
brew install yt-dlp

Then download audio only:

yt-dlp -x --audio-format mp3 "https://www.youtube.com/watch?v=VIDEO_ID"

This extracts the audio stream and converts it to MP3. The output file lands in your current directory, named after the video title. If you want a predictable filename, add -o "audio.%(ext)s":

yt-dlp -x --audio-format mp3 -o "audio.%(ext)s" "https://www.youtube.com/watch?v=VIDEO_ID"

That gives you audio.mp3 every time — handy for scripting downstream steps.

A few flags worth knowing:

Flag What it does
-x Extract audio, discard video
--audio-format mp3 Re-encode to MP3 (Whisper also accepts WAV, M4A, FLAC)
--audio-quality 0 Best available quality (0 = best, 9 = worst)
-o "%(id)s.%(ext)s" Use the video ID as the filename

Whisper accepts any audio format ffmpeg can read, so WAV and M4A work too. MP3 is the most compatible.


Step 2 — Transcribe with OpenAI Whisper

Short answer: Install openai-whisper, load a model, call model.transcribe("audio.mp3"), and you get a dict with text, segments (with timestamps), and language.

Install

pip install openai-whisper
# also requires ffmpeg on your PATH
# macOS: brew install ffmpeg
# Ubuntu: sudo apt install ffmpeg

Basic transcription

import whisper

model = whisper.load_model("base")
result = model.transcribe("audio.mp3")

print(result["text"])

That prints the full transcript as a single string. For timestamped segments:

import whisper

model = whisper.load_model("base")
result = model.transcribe("audio.mp3")

for segment in result["segments"]:
    start = segment["start"]   # seconds, float
    end   = segment["end"]
    text  = segment["text"].strip()
    print(f"[{start:.1f}s -> {end:.1f}s] {text}")

Model sizes and tradeoffs

Whisper ships five models. Bigger models are more accurate but slower and use more RAM:

Model Parameters VRAM Relative speed Best for
tiny 39M ~1 GB ~10× faster than large Quick tests, low accuracy
base 74M ~1 GB ~7× Good English, dev default
small 244M ~2 GB ~4× Balanced
medium 769M ~5 GB ~2× Accented speech, mixed language
large 1550M ~10 GB 1× Highest accuracy, production

For most developer workflows on English content, base is the right starting point. Switch to small or medium if accuracy on technical vocabulary or accented speakers matters. The large model earns its cost on multilingual content or dense jargon.

Force a language to skip auto-detection (faster, more accurate when you know the language):

result = model.transcribe("audio.mp3", language="en")

Write the transcript to a file:

with open("transcript.txt", "w") as f:
    f.write(result["text"])

Step 3 — Use faster-whisper for Production Workloads

Short answer: faster-whisper is a drop-in replacement built on CTranslate2 — typically 4× faster than openai-whisper with the same or better accuracy. Use it when you are processing multiple videos or running on CPU.

Install

pip install faster-whisper

Basic usage

from faster_whisper import WhisperModel

model = WhisperModel("base", device="cpu", compute_type="int8")

segments, info = model.transcribe("audio.mp3", language="en")

print(f"Detected language: {info.language} (probability {info.language_probability:.2f})")

for segment in segments:
    print(f"[{segment.start:.1f}s -> {segment.end:.1f}s] {segment.text.strip()}")

Note that model.transcribe() returns a generator — segments stream as they are decoded. If you need the full text as a string:

full_text = " ".join(segment.text.strip() for segment in segments)

Run on GPU if available:

model = WhisperModel("large-v3", device="cuda", compute_type="float16")

On Apple Silicon, use device="cpu" with compute_type="int8" — it will use MPS automatically on supported builds. (For Mac-native Whisper acceleration, mlx_whisper with the mlx-community/whisper-large-v3-turbo model is another strong option.)

faster-whisper vs openai-whisper — quick decision

openai-whisper faster-whisper
Install simplicity pip install openai-whisper pip install faster-whisper
Speed (CPU) Baseline ~4× faster
API style result["segments"] generator of segment objects
Accuracy Same underlying models Same or slightly better
Best for One-off scripts, GPU servers Batch pipelines, CPU servers

When to Skip Whisper Entirely and Pull Existing Captions

Short answer: If the video already has captions — auto-generated or manually added — pulling them is 100× faster and free. Use youtube-transcript-api in Python or yt-dlp's subtitle flags. Only run Whisper when captions are missing, wrong, or too noisy to use.

Most YouTube videos do have captions. Before you spin up a Whisper model, check:

Option A — youtube-transcript-api (Python)

from youtube_transcript_api import YouTubeTranscriptApi

api = YouTubeTranscriptApi()
transcript = api.fetch("VIDEO_ID")   # pass the ID, not the full URL

for entry in transcript:
    print(f"[{entry.start:.1f}s] {entry.text}")

# Full text
full_text = " ".join(entry.text for entry in transcript)

This uses the v1.x API: instantiate the class, call .fetch() with the video ID, and access .text, .start, and .duration as attributes on each FetchedTranscriptSnippet object.

See the complete youtube-transcript-api guide for language selection, list-available, and error handling.

Option B — yt-dlp subtitle download

yt-dlp can download subtitles without touching the audio:

# Download auto-generated English subs as VTT
yt-dlp --skip-download --write-auto-subs --sub-langs "en" "https://www.youtube.com/watch?v=VIDEO_ID"

# Download manually uploaded subs (not auto)
yt-dlp --skip-download --write-subs --sub-langs "en" "https://www.youtube.com/watch?v=VIDEO_ID"

Note --sub-langs (plural) is the correct current flag. The output is a .vtt or .srt file you can parse directly.

The full yt-dlp subtitle workflow — including format conversion and batch downloads — is covered in the yt-dlp YouTube subtitles guide.

The decision tree

Does the video have captions?
├── Yes, and they are accurate → use youtube-transcript-api or yt-dlp subs (fast, free)
├── Yes, but auto-captions are wrong or noisy → run Whisper on the audio
└── No captions at all → run Whisper on the audio

For more detail on the caption-pull side, see how to download a YouTube transcript and how to extract a YouTube transcript programmatically.


When You Need Meaning, Not Just Text

Short answer: Whisper gives you a transcript — raw text, no comprehension. If what you actually want is a summary, key points, or the ability to ask questions about a video, that is a different tool category.

The pipeline above solves a real problem: you need accurate, timestamped text from a video with no usable captions. Build it, use it, it works.

But the reason most people want a YouTube transcript is not the text itself — it is the ideas inside the video. If you are trying to understand a 90-minute conference talk, review a tutorial before buying a course, or get the core argument from a three-hour podcast, you do not want to read a wall of transcribed text. You want a summary, and you want to ask follow-up questions.

SkipTheWatch is built for that case. Paste any YouTube URL, and it returns a structured summary with the key points extracted — no local model to install, no ffmpeg dependency, no GPU required. You can also ask questions about the video after it is processed.

It is not a transcript tool. It is the step after the transcript — when you want to understand what was said, not just read it.

Plans start at $9/month after a 7-day free trial. A card is required at sign-up. Cancel anytime in the trial for $0.


Frequently Asked Questions

Does Whisper work on YouTube videos without any captions? Yes. Whisper transcribes directly from audio, so it does not depend on YouTube's caption system at all. Download the audio with yt-dlp -x --audio-format mp3, then pass the MP3 to Whisper. The only requirement is that the video has audible speech.

What is the difference between openai-whisper and faster-whisper? Both use the same underlying Whisper model weights. faster-whisper reimplements the inference engine with CTranslate2, which makes it roughly 4× faster on CPU and uses less memory. The API is slightly different — faster-whisper returns a generator of segment objects rather than a dict. For most production use cases, faster-whisper is the better choice. For quick one-off scripts, either works fine.

How accurate is Whisper on technical or domain-specific content? The base and small models handle clear spoken English well but can stumble on acronyms, proper nouns, and heavy jargon. For technical content — conference talks, engineering tutorials, medical lectures — use medium or large. You can also post-process the output with a domain-specific word list to fix common substitutions.

Can I transcribe a YouTube video without downloading the audio file? Not with Whisper — it needs an audio file as input. However, if the video has captions, you can pull them without any download using youtube-transcript-api or yt-dlp's --write-auto-subs flag. Those approaches are documented in the youtube-transcript-api guide.

How do I get SRT or VTT output from Whisper? openai-whisper includes a CLI with format options:

whisper audio.mp3 --output_format srt --language en

This writes audio.srt directly. Supported formats are txt, vtt, srt, tsv, and json. For faster-whisper, iterate the segments generator and write SRT manually, or use a helper library like stable-ts.

Skip the watch. Get the insight.

AI summaries of any YouTube video in seconds — key insights, timestamps, structured breakdowns. Start free — no credit card. Pro is $9/month for 500 summaries with a 7-day free trial, cancel anytime.

Get my free summaries

Free to start · No credit card · Upgrade anytime

Related Articles