TechEarl

yt-dlp Cheat Sheet: Download Video, Audio, and Subtitles From the Command Line

A scannable yt-dlp reference: install and update, format selection, audio extraction, subtitles, playlists and channels, cookies and auth, rate limiting, output templates, and post-processing. The free, maintained youtube-dl successor.

Ishan Karunaratne⏱️ 6 min readUpdated
Share thisCopied
yt-dlp cheat sheet: install and update, list and select formats, extract audio to M4A, write subtitles, download playlists and channels with an archive file, pass browser cookies, rate-limit politely, and post-process with SponsorBlock. The free youtube-dl successor.

yt-dlp is the free, open-source command-line YouTube downloader I reach for whenever I need video, audio, or subtitles off the command line. It is the maintained community fork of youtube-dl, costs nothing, ships no ads or watermarks, and runs entirely on your own machine. This page is the reference I keep open: every flag worth knowing, grouped by what you are actually trying to do. Build a command first, then scroll for the detail.

Build your yt-dlp command

Paste a YouTube URL, choose what to grab, and copy the command. It updates as you change the options.

Resolution is a maximum, not a guarantee. yt-dlp grabs the best quality at or below your pick, capped by what was actually uploaded. Choose 8K on a 720p video and you get 720p, not an error and not an upscale.

Your command
bash
yt-dlp --merge-output-format mp4 "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

If you searched for youtube-dl, a free YouTube downloader, or a youtube downloader command line tool, this is the page. youtube-dl (originally written by Ricardo García, "rg3") still exists, but it is no longer actively maintained and routinely breaks when YouTube changes its player. yt-dlp is the actively maintained successor: a faster release cadence, far more extractors, and the same command syntax, so every youtube-dl command runs as yt-dlp with better results. When people say "YT download" tool in 2026, this is almost always what they mean.

Download only what you have the right to. Saving your own uploads, Creative Commons material, or content the rights holder permits is one thing; redistributing copyrighted video, or bulk-downloading in a way that violates YouTube's (or any site's) Terms of Service, is another. This reference is for the legitimate cases. What you do with the file is on you.

A note that runs through the whole sheet: install ffmpeg. yt-dlp needs it to merge the separate video and audio streams modern YouTube serves, and to extract or convert audio. The single most common "it only gave me 720p" or "audio extraction failed" complaint is a missing ffmpeg.

The cheat sheet

Everything below is grouped the way I think about a download: get it installed, grab something, then refine quality, audio, subtitles, scale to playlists, and clean up the output.

yt-dlp Cheat Sheet

The yt-dlp commands I actually use: install and update, format selection, audio, subtitles, playlists, cookies, rate limiting, output templates, and post-processing. ffmpeg is required for merging and audio extraction.

Install & update

brew install yt-dlp ffmpegmacOS (Homebrew). Installs ffmpeg too, which yt-dlp needs to merge streams and extract audio.
pipx install yt-dlpCross-platform and always current. Install ffmpeg separately via your package manager.
winget install yt-dlp.yt-dlpWindows. Also run winget install Gyan.FFmpeg for ffmpeg.
yt-dlp -USelf-update the standalone binary in place. First thing to try when a download suddenly fails.
pipx upgrade yt-dlpUpdate a pipx install. With Homebrew use brew upgrade yt-dlp.

Basic download

yt-dlp "URL"Best video + best audio, downloaded separately and merged into one file. The default does the whole job for most people.
yt-dlp -a urls.txtBatch download from a text file, one URL per line. Blank lines and # comments are ignored.
yt-dlp --no-playlist "URL"Download just the single video when a URL also carries a playlist (the &list= case).

Format selection

yt-dlp -F "URL"List every available format with its ID, resolution, codec, and size. Run this first when in doubt.
yt-dlp -f "bv*[height<=1080]+ba/b" "URL"Best video up to 1080p plus best audio, merged; fall back to the best single file if that fails.
avoid -f bestIt only matches a single muxed file, which YouTube caps at ~720p. Use the bv*+ba selector instead.
--merge-output-format mp4Force the merged container to MP4 instead of whatever yt-dlp picks (often MKV/WebM).

Audio

yt-dlp -x --audio-format m4a --audio-quality 0 "URL"Extract audio to M4A at best quality. M4A is the AAC track YouTube already serves, so no quality-losing re-encode. Recommended.
--audio-format opusExtract to Opus, YouTube's other native audio codec. Small and high quality.
--audio-format mp3Legacy MP3 for old players. This re-encodes, so it loses a little quality. Avoid unless you need MP3.
--embed-thumbnail --embed-metadataEmbed the cover art and the title/artist/date tags into the audio file.
--split-chaptersSplit a long video into one file per chapter using the video's chapter markers.

Subtitles / transcript

yt-dlp --list-subs "URL"List the subtitle and auto-caption languages available for a video.
yt-dlp --skip-download --write-subs --write-auto-subs --sub-langs en --convert-subs srt "URL"Grab English subtitles (manual and auto), convert to SRT, and download no video.

Playlists & channels

yt-dlp "PLAYLIST_URL"Download every video in a playlist. Point it at a playlist URL and let it run.
yt-dlp "https://www.youtube.com/@handle"Download a channel's videos by its @handle URL.
--download-archive archive.txtRecord each downloaded ID so re-runs skip what you already have. Essential for resumable channel grabs.
--playlist-items 1-10Limit to a range (or a comma list like 1,3,5-8) instead of the whole playlist.
-o "%(playlist_index)s - %(title)s.%(ext)s"Number files by their position in the playlist so they sort in order.

Cookies & auth

--cookies-from-browser firefoxUse your logged-in Firefox session. Use Firefox, NOT Chrome (see below). Unlocks members-only and age-restricted videos you have access to.
--cookies cookies.txtPass a Netscape-format cookies file exported from a browser extension.

Politeness / rate limit

-r 3MCap the download rate at 3 MB/s (alias for --limit-rate).
--sleep-requests 1Sleep 1 second between requests. Eases off on bulk jobs so you do not trip the bot wall.
--limit-rate 2MThrottle to 2 MB/s. The long form of -r.

Output templates

-o "%(title)s.%(ext)s"Readable filename from the video title and extension instead of the raw video ID.
-o "%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"Sort into per-uploader folders, prefixed with the upload date.

Post-processing

--embed-subsEmbed subtitles into the video file (pair with --write-subs to fetch them).
--embed-chaptersWrite the video's chapter markers into the file so players show them.
--sponsorblock-mark allMark sponsor/intro/outro segments as chapters using the SponsorBlock database. Use --sponsorblock-remove to cut them out.
--remux-video mp4Remux into MP4 without re-encoding when the streams are already compatible. Fast and lossless.

Install and keep it current

Pick the line for your platform from the install block above. The non-negotiable extra is ffmpeg: Homebrew (brew install yt-dlp ffmpeg) bundles it in one command; on Linux install it with apt/dnf/pacman; on Windows run winget install Gyan.FFmpeg alongside yt-dlp.

Keeping yt-dlp current is not optional with this tool. YouTube changes its player often enough that a stale build simply stops working, and updating is the first thing to try when a download breaks. The standalone binary self-updates with yt-dlp -U; a pipx install updates with pipx upgrade yt-dlp; Homebrew uses brew upgrade yt-dlp. Distro packages (the apt one in particular) lag badly, which is why I prefer pipx for a cross-platform install.

Picking the quality

Run yt-dlp -F "URL" to see what a video actually offers: a table of format IDs, resolutions, codecs, and sizes. Then select with -f. The selector I use almost always is bv*[height<=1080]+ba/b, which reads as "best video at or below 1080p, plus best audio, or fall back to the best single file." Change 1080 to whatever ceiling you want; the [height<=N] filter is a ceiling, not a request, so you only get 4K if the creator uploaded 4K.

The trap to avoid is -f best. On modern YouTube the high resolutions are served as separate video-only and audio-only streams, and best only matches a single already-combined (muxed) file, which YouTube caps at around 720p. So -f best quietly hands you 720p and people conclude yt-dlp "can't do 1080p." The bv*+ba selector plus ffmpeg is the fix. For the full walkthrough, including Shorts and the bot check, see how to download a YouTube video in any quality.

Audio only

-x (extract audio) strips the sound without downloading and re-muxing the video by hand. My default is yt-dlp -x --audio-format m4a --audio-quality 0 "URL": M4A is the AAC track YouTube already serves, so there is no quality-losing re-encode. Opus (--audio-format opus) is the other native codec and an excellent choice; MP3 (--audio-format mp3) re-encodes and exists only for ancient players. Add --embed-thumbnail --embed-metadata to bake cover art and tags into the file. The complete flow with chapter splitting is in download YouTube audio to MP3, M4A, or Opus.

Subtitles and transcripts

yt-dlp --list-subs "URL" shows which languages a video has, including auto-generated captions. To pull the text without the video, combine --skip-download with --write-subs --write-auto-subs --sub-langs en --convert-subs srt. That writes an SRT file (or VTT if you skip the conversion) and nothing else, which is exactly what you want when feeding a summarizer or taking notes. For converting captions to clean plain text, see extract a YouTube video's transcript or captions.

Playlists, channels, and archives

Point yt-dlp at a playlist URL or a channel @handle URL and it downloads the lot. Two flags make bulk jobs sane. --download-archive archive.txt records every video ID it finishes, so re-running the same command skips what you already have, which turns a one-shot grab into something you can run weekly. --playlist-items 1-10 (or a comma list) limits the range. An output template like -o "%(playlist_index)s - %(title)s.%(ext)s" numbers the files so they sort in playlist order. The full resumable channel workflow, with rate limiting, is in download a YouTube playlist or channel.

Cookies, auth, and the Chrome gotcha

When YouTube interrupts a download with "Sign in to confirm you're not a bot," or when a video is members-only, age-restricted, or region-locked and you have legitimate access, hand yt-dlp your browser cookies:

bash
yt-dlp --cookies-from-browser firefox "URL"

Use Firefox, not Chrome. Since around July 2024, Chrome encrypts its cookie store with app-bound encryption, and external tools (yt-dlp included) can no longer read Chrome cookies on a running profile. Firefox's cookie store is still readable, so --cookies-from-browser firefox is the one that reliably works in 2026. The alternative is exporting a Netscape-format cookies.txt with a browser extension and passing --cookies cookies.txt.

Being polite to the server

For anything beyond a single video, throttle yourself. --sleep-requests 1 puts a second between requests; -r 3M (or its long form --limit-rate 2M) caps the download rate. This is partly courtesy and partly self-preservation: hammering a site is the fastest way to trip its bot detection and get your IP rate-limited. The same etiquette applies to every extractor, including TikTok video downloads and Facebook video downloads.

Output templates

By default yt-dlp bakes the video ID into the filename. An output template (-o) fixes that. -o "%(title)s.%(ext)s" gives a readable name; -o "%(uploader)s/%(upload_date)s - %(title)s.%(ext)s" builds a per-uploader folder tree dated by upload. There are dozens of fields (uploader, resolution, id, playlist_index); the percent-paren-s syntax is the standard output-template form documented in the yt-dlp README.

Post-processing

The post-processors run after the download finishes. --embed-subs (with --write-subs) and --embed-chapters fold subtitles and chapter markers into the file. --remux-video mp4 repackages into MP4 without re-encoding when the codecs are already compatible, which is fast and lossless. --sponsorblock-mark all uses the community SponsorBlock database to mark sponsor, intro, and outro segments as chapters; swap mark for remove to physically cut them out. These compose with everything above, so a single command can download at 1080p, embed subtitles, and strip sponsor segments in one pass.

FAQ

See also

Sources

Authoritative references this article was fact-checked against.

Tagsyt-dlpyoutube-dlYouTubefree youtube downloaderCLIffmpegyoutube downloader command line

Found this useful? Pass it on.

Copied

Ishan Karunaratne

Tech Architect · Software Engineer · AI/DevOps

Tech architect and software engineer with 20+ years building software, Linux systems, and DevOps infrastructure, and lately working AI into the stack. Currently Chief Technology Officer at a healthcare tech startup, which is where most of these field notes come from.

Keep reading

Related posts

AWS S3 cp and sync Cheat Sheet: Copy, Move, and Sync Files with the CLI

A scannable AWS S3 CLI reference: aws s3 cp, sync, mv, rm, ls; recursive uploads and downloads; --exclude / --include filters; storage classes (STANDARD_IA, GLACIER, INTELLIGENT_TIERING); SSE encryption (AES256, aws:kms); --dryrun safety; the trailing-slash gotcha; concurrency tuning via max_concurrent_requests and multipart_chunksize; cross-account profiles.