Extract YouTube Subtitles with yt-dlp: The Complete CLI Guide (2026)
You've found the right tool. yt-dlp can pull YouTube subtitle files in a single command — no video download required. The commands below work. What most guides skip is what happens three months after you put this in a pipeline: bot detection, broken format flags, and the manual-vs-auto-generated subtitle disambiguation problem that remains an ongoing open issue on GitHub.
Here's the exact CLI syntax, the failure modes worth knowing about, and an honest look at what it costs to run this reliably in production.
What yt-dlp Actually Downloads When You Say "Subtitles"
The short answer: yt-dlp fetches the subtitle track directly from YouTube's CDN — the same text that powers the CC button. It does not download video audio or re-transcribe anything. You get a VTT file (or converted SRT) containing timestamped text segments. Auto-generated and human-written tracks are stored separately, and the distinction matters: human-written subtitles are accurate; auto-generated ones contain duplication artifacts and occasional transcription errors, especially on technical vocabulary.
Understanding this distinction upfront saves debugging time. When you request --write-subs, yt-dlp looks for manually uploaded subtitle tracks first. When you request --write-auto-subs, it fetches the auto-generated version. Most YouTube channels only have auto-generated tracks.
Install yt-dlp in 60 Seconds
The short answer: Two install paths — pip for Python environments, brew for macOS. Pin the version in any production requirements file; yt-dlp releases every two weeks and breaking changes arrive without deprecation warnings.
# pip (recommended for Python pipelines)
pip install yt-dlp
# brew (macOS, for CLI use)
brew install yt-dlp
# verify install
yt-dlp --version
yt-dlp releases roughly every two weeks — check the releases page before pinning to a specific version in production. With 12M+ monthly PyPI downloads, you want an explicit version pin in any requirements.txt that touches production so a breaking release doesn't silently halt your pipeline.
The Core Subtitle Commands (and What Each Flag Does)
The short answer: Four flags handle 90% of subtitle extraction work — --write-subs, --write-auto-subs, --sub-langs, and --skip-download. Always run --list-subs first on an unfamiliar channel to see what's actually available before writing a command that silently returns nothing.
# Step 1: List available subtitle tracks (do this first)
yt-dlp --list-subs "https://www.youtube.com/watch?v=VIDEO_ID"
# Download English subtitles only — no video file
yt-dlp --write-subs --sub-langs en --skip-download "VIDEO_URL"
# Fall back to auto-generated if manual subs aren't available
yt-dlp --write-subs --write-auto-subs --sub-langs en --skip-download "VIDEO_URL"
# Convert to SRT (more compatible than VTT for downstream tools)
yt-dlp --write-subs --sub-langs en --convert-subs srt --skip-download "VIDEO_URL"
# Add metadata JSON — useful for pipeline context (title, channel, duration)
yt-dlp --write-subs --write-info-json --sub-langs en --skip-download "VIDEO_URL"
The --skip-download flag is critical for transcript-only workflows. Without it, yt-dlp downloads the video file alongside the subtitle, which is expensive in bandwidth and storage.
Manual vs Auto-Generated Subtitles: Which One to Fetch
The short answer: Always prefer manual subtitles when they exist — they're accurate. Auto-generated subtitles are nearly universal but contain repeated phrases, missing punctuation on some channels, and the occasional transcription error that propagates straight into any downstream LLM summary.
The behavioral difference in yt-dlp:
--write-substargets manually uploaded subtitle tracks--write-auto-substargets auto-generated tracks- Using both flags together gives you whichever is available, but you cannot cleanly prefer manual over auto in a single command for the same language — this is an active known issue (GitHub #9371)
In most yt-dlp versions, auto-generated English subtitles are saved as VIDEO_ID.en-orig.vtt — but confirm with --list-subs on your installed version, as naming conventions have shifted across releases.
For AI summarization pipelines, auto-generated transcripts are good enough for most content. The quality drop becomes noticeable on technical channels with heavy jargon, non-standard accents, or rapid speech. When accuracy matters, filter for channels you know have human-written captions.
Cleaning the VTT Output for LLM Pipelines
The short answer: Raw VTT output is not LLM-ready. It contains timestamps on every line, overlapping duplicate segments (a VTT artifact from how YouTube encodes captions), and WEBVTT header content. Strip these in Python before passing to your summarizer — otherwise you're burning tokens on formatting noise and the LLM's output quality drops.
import re
def clean_vtt(vtt_path):
with open(vtt_path) as f:
raw = f.read()
# Remove WEBVTT header, timestamps, and blank lines
lines = [l for l in raw.splitlines()
if not re.match(r'^\d{2}:\d{2}', l)
and l.strip() not in ('', 'WEBVTT')]
# Deduplicate consecutive repeated lines (yt-dlp auto-sub artifact)
deduped = [l for i, l in enumerate(lines) if i == 0 or l != lines[i-1]]
return '\n'.join(deduped)
This gets you clean plain text suitable for passing to an LLM. For the next step — chunking and summarizing that text — see our YouTube transcript-to-summary pipeline guide, which covers MapReduce chunking for long videos and the full summarization loop in ~100 lines of Python.
If you want to understand what AI tools do with this text once they have it, how AI summarizes YouTube videos covers the full pipeline from extraction through output formatting.
What Breaks (and When): Known yt-dlp Subtitle Failures
The short answer: yt-dlp subtitle extraction has multiple active open issues as of 2026. Expect periodic breakage after YouTube updates. The three most common failure modes are bot detection blocks, format errors on json3/ttml tracks, and the manual-vs-auto preference problem. None of these have been cleanly resolved upstream.
Active known issues (GitHub):
- #13211: "Did not get any data blocks" — active subtitle download failures reported in early 2026. Root cause is YouTube's CDN response changes; workaround requires version updates or format switching.
- #15823: Cannot download subtitles to video from YouTube — open issue; affects specific video categories
_UnsafeExtensionErrorwhen downloading json3, ttml, srv1, srv2, srv3 subtitle formats — ongoing GitHub issues around this error; stick to VTT or converted SRT to avoid it.
Safe format selection:
# VTT — works reliably
yt-dlp --write-subs --sub-langs en --skip-download "VIDEO_URL"
# SRT via conversion — also reliable
yt-dlp --write-subs --sub-langs en --convert-subs srt --skip-download "VIDEO_URL"
# Avoid these formats (active breakage documented)
# --convert-subs json3
# --convert-subs ttml
When yt-dlp returns empty subtitle output without an error, the failure is often upstream at YouTube's rate limiting layer — the same infrastructure that affects other extraction approaches. Our article on youtube-transcript-api errors and rate limits covers the root cause, which applies equally here.
For rate-limit-specific strategies — IP rotation, request spacing, proxy configuration — the YouTube transcript API rate limit guide applies directly to yt-dlp production deployments as well.
The Maintenance Burden: What Running This in Production Actually Costs
The short answer: A reliable yt-dlp subtitle pipeline in production needs IP rotation or proxy pools, error handling for at least five known failure modes, and regular updates as YouTube changes its internal format. This is real infrastructure — not a one-weekend script that you set and forget.
The breakdown of ongoing maintenance work:
IP rotation / proxy pools. YouTube rate-limits subtitle requests by IP. At any meaningful volume (dozens of videos/day per IP), you'll start seeing silent failures or CAPTCHAs. This means either a residential proxy service (adds cost and operational complexity) or accepting lower throughput.
Version management. yt-dlp releases roughly every two weeks. Some releases fix subtitle extraction; some break it. You need a pinned version, a test suite that catches breakage, and a process for evaluating and applying updates. This is non-trivial in a production environment where a broken update stops your pipeline.
Post-processing. VTT output requires cleaning before it's usable. The deduplication and timestamp-stripping logic above is straightforward, but it's code you own and maintain.
Error handling. Silent failures are common. A failed subtitle download often returns no output and no error — your pipeline needs explicit checks for empty output, fallback logic, and alerting.
Channel-specific quirks. Some channels use non-standard language codes for community-submitted subtitles. Some have manual subs uploaded under unexpected language tags. --list-subs helps, but in an automated pipeline you often don't know what to expect from an unfamiliar channel.
If you're building this for your own product rather than personal use, you're signing up for ongoing infrastructure work that's unrelated to your actual product goals.
When to Use yt-dlp vs Alternatives (and When to Skip DIY Entirely)
The short answer: yt-dlp is the right choice when you need format flexibility (SRT vs VTT), want full control over the extraction environment, or are processing videos that don't have transcript API coverage (age-restricted content, some live streams). For developers who want the transcript text and nothing else, youtube-transcript-api skips the file download layer entirely — see our YouTube transcript API guide for the Python-native approach.
When yt-dlp is the right call:
- You need multiple output formats from the same pipeline
- You're processing video types that the transcript API doesn't cover
- You want the metadata JSON alongside the subtitles (for pipeline context)
- You're already in a yt-dlp workflow for video downloads and subtitles are an add-on
When the transcript API is cleaner:
- You only need the text — no video, no file download, no format conversion
- You're writing Python and want a typed API rather than shelling out to a CLI
- You need simpler error handling (typed exception classes vs exit codes)
When to skip building altogether:
If what you're actually after is summaries of YouTube videos — not a custom summarization product — yt-dlp puts the extraction work on you and the summarization work on you. SkipTheWatch abstracts the entire extraction and summarization stack: paste a URL, get a structured summary with key points and chapter breakdowns, then ask follow-up questions via persistent chat. There's nothing to install, no proxy bills, no version updates. 7-day free trial (card required, $0 charged during trial), then $9/month for 500 summaries.
The decision is straightforward: if you're building a product that needs subtitle extraction as an internal primitive, yt-dlp is worth the maintenance. If you want the summaries, the infrastructure work is a detour.
FAQ
Q: Can yt-dlp download subtitles without downloading the video?
A: Yes — the --skip-download flag tells yt-dlp to fetch only the subtitle file. Combine it with --write-subs and --sub-langs en to get English subtitles with no video file written to disk.
Q: What's the difference between --write-subs and --write-auto-subs?
A: --write-subs fetches manually uploaded subtitle tracks (higher quality, not always present). --write-auto-subs fetches YouTube's auto-generated captions (almost always present, lower accuracy). Use both flags together to get whichever is available.
Q: Why does yt-dlp sometimes return no subtitles without any error?
A: Silent failures usually mean either no subtitles exist in the requested language, YouTube's rate limiting blocked the request, or a format-specific bug was triggered. Run --list-subs first to confirm a subtitle track exists, then re-run with explicit format flags.
Q: What subtitle formats does yt-dlp support reliably?
A: VTT and SRT (via --convert-subs srt) are the most reliable as of 2026. json3, ttml, srv1, srv2, and srv3 have documented bugs around _UnsafeExtensionError — avoid them in production.
Q: How do I get clean plain text from the VTT output? A: VTT files contain timestamps and duplicate lines that need stripping before use. The Python snippet in the "Cleaning the VTT Output" section above handles this in ~10 lines. After cleaning, you have plain text ready to pass to an LLM.
Q: Does yt-dlp work for all YouTube videos? A: yt-dlp can extract subtitles from most public YouTube videos that have captions enabled. It cannot reliably access age-restricted content without authentication, and some channels disable subtitles entirely. For videos with subtitles disabled, you'd need to fall back to audio download and speech-to-text transcription.
Q: How often does yt-dlp's subtitle extraction break? A: There are multiple open GitHub issues with active breakage reports as of early 2026. Expect at least one disruption per quarter as YouTube updates its internal format. Version-pinning and a monitoring check on your pipeline output are both necessary for production use.
Q: What's the best yt-dlp alternative for transcript extraction only?
A: youtube-transcript-api (Python) is the cleanest alternative for text-only use cases — no CLI, typed exceptions, and no file cleanup required. See the YouTube transcript API guide for setup and usage.