TechEarl

How to Download a YouTube Video (Any Quality) with yt-dlp

Download a YouTube video free from the command line with yt-dlp: install it, grab the best quality, pick a resolution, handle Shorts, and get past the bot check. youtube-dl's free, maintained successor.

Ishan Karunaratne⏱️ 6 min readUpdated
Share thisCopied
Download any YouTube video from the command line with yt-dlp, choose the resolution, save Shorts, and work around the sign-in bot check.

The reliable, free way to download a YouTube video in 2026 is yt-dlp, a free, open-source command-line downloader, no website, no ads, no upload limits, and nothing to pay. Paste a URL below, choose whether you want the video, the audio, or the transcript, and copy the command:

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"

For most people the default is the whole job: yt-dlp picks the best video and best audio streams, downloads both, and merges them into a single MP4. The rest of this page is the detail behind those options: choosing a resolution, saving a Short, fixing the bot check, and cleaning up the filename.

If you have used youtube-dl before, yt-dlp is its actively maintained successor. youtube-dl (originally written by Ricardo García, "rg3") still exists but is effectively unmaintained and routinely breaks when YouTube changes its player; yt-dlp is the community fork that keeps up, with a faster release cadence and far more extractors. Every youtube-dl command below works as yt-dlp with better results, so if you searched for "youtube-dl" you are in the right place.

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 is another, and bulk downloading can violate YouTube's Terms of Service. This guide is for the legitimate cases. What you do with the file is on you.

Install yt-dlp (and ffmpeg)

Pick your platform. Install ffmpeg too: yt-dlp needs it to merge the separate video and audio streams (and to convert audio), and the single most common "it only downloaded 720p" or "it failed to convert" complaint is a missing ffmpeg.

Try it with your own values

Pick your OS for the install command.

bash· Linux (GNU)
# Cross-platform and always current:
pipx install yt-dlp
sudo apt install ffmpeg   # or your distro's package manager

On Ubuntu the apt package can lag behind, and YouTube changes often enough that a stale yt-dlp simply stops working. pipx install yt-dlp (then pipx upgrade yt-dlp) is the cleanest cross-platform install. If you used the standalone binary, yt-dlp -U self-updates; with Homebrew use brew upgrade yt-dlp. Keeping yt-dlp current is not optional with this tool: when a download suddenly fails, updating is the first thing to try.

You do not pick an Apple Silicon vs Intel build by hand. Homebrew, pipx, and winget all install the right binary for your machine automatically (the same brew install yt-dlp ffmpeg works on an M-series and an Intel Mac), and yt-dlp itself is Python, so it is architecture-independent. The only time the chip matters is if you download the raw standalone binary manually, which is why the package managers above are the easier path.

Choose the quality

The Resolution dropdown in the builder above caps the download for you, but it helps to know what it is doing. List what a given video actually offers, then pick:

bash
yt-dlp -F "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

That prints a table of formats with IDs, resolutions, codecs, and file sizes. To cap at a specific height, pass a format selector with -f:

bash
# 1080p or below, plus the best audio, merged
yt-dlp -f "bv*[height<=1080]+ba/b" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

The trap to avoid is -f best. On modern YouTube the highest resolutions are served as separate video-only and audio-only streams; best only matches a single already-combined (muxed) file, which YouTube caps at around 720p. So -f best quietly gives you 720p and people conclude yt-dlp "can't do 1080p." The fix is the bv*+ba (bestvideo + bestaudio) selector the builder uses, which downloads both halves and lets ffmpeg merge them. bv*[height<=1080]+ba/b reads as "best video up to 1080p plus best audio, or fall back to the best single file if that fails."

One thing to be clear about: the resolution you pick is a ceiling, not a request for a specific size. The [height<=N] filter means "the best stream at or below N." You only get 4K or 8K if the creator actually uploaded at that resolution; pick 8K on a video that tops out at 720p and yt-dlp downloads the 720p version. It does not error, and it will never upscale a low-resolution source. Run yt-dlp -F first if you want to see exactly which resolutions a given video offers before you choose.

Download a YouTube Short

A Short is just a regular video on a /shorts/ URL, so the same command works. Paste the Short's URL into the builder above, or run it directly:

bash
yt-dlp "https://www.youtube.com/shorts/VIDEO_ID"

There is no special flag for Shorts. If you ever get a playlist instead of the single clip (some Shorts URLs resolve to a feed), force a single video with --no-playlist.

"Sign in to confirm you're not a bot"

YouTube increasingly interrupts downloads with Sign in to confirm you're not a bot. The fix is to hand yt-dlp your browser's cookies so the request looks like your logged-in session:

bash
yt-dlp --cookies-from-browser firefox "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

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 same cookies trick is what unlocks members-only, age-restricted, and region-locked videos you have legitimate access to.

Save it with a clean filename

By default yt-dlp names files with the video ID baked in. An output template (-o) gives you something readable:

bash
yt-dlp -o "%(title)s.%(ext)s" "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

%(title)s and %(ext)s are output-template fields; there are dozens (%(uploader)s, %(upload_date)s, %(resolution)s) for building a folder structure that suits your library.

Just the audio, or the transcript?

Switch the builder's What to download to Audio and it extracts the sound directly (no need to download the video and strip it). The modern default is M4A (the AAC track YouTube already serves, so no quality-losing re-encode) or Opus; MP3 is there only for ancient players. See download YouTube audio for the full -x flow with cover art and metadata. If it is the words you are after (for notes or to feed a summarizer), switch to Transcript, or read extract a video's transcript or captions for converting them to plain text. For every flag in one place, the yt-dlp cheat sheet is the reference.

FAQ

See also

Sources

Authoritative references this article was fact-checked against.

Tagsyt-dlpYouTubeyoutube-dlfree youtube downloaderCLIvideo downloadffmpeg

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

How to Download a TikTok Video with yt-dlp

Download a TikTok video free from the command line with yt-dlp: no app, no sketchy site. yt-dlp pulls the source MP4 TikTok serves, follows short links, extracts audio, and uses your cookies for gated clips.

How to Download a Facebook Video with yt-dlp

Download a Facebook video free from the command line with yt-dlp: public watch links and fb.watch shorts need no cookies, private and group videos use --cookies-from-browser firefox, and you pick the resolution yourself.