Download videos with `yt-dlp` (and quality selection)
The successor to youtube-dl that everyone's muscle memory still gets wrong — the format expression decides whether you get 1080p or a 360p file.
Run `yt-dlp -f "bv*[height<=1080]+ba/b" URL` to download the best video up to 1080p plus best audio merged automatically.
01Command
Command
$ yt-dlp -f "bv*[height<=1080]+ba/b" "https://www.youtube.com/watch?v=VIDEO_ID"02What it does
YouTube stores video and audio as separate streams; the expression `bv*+ba/b` asks for best video plus best audio and falls back to a combined stream, and yt-dlp merges them with ffmpeg. Without a format filter you often get a low-resolution combined stream, which is why the flag matters. Frequently forgotten flags: `-x --audio-format mp3` to save audio only, `-o "%(title)s.%(ext)s"` for clean filenames, and `-F URL` to list all available formats first.
03Risk
!Warning: Sites change constantly — if downloads fail, first run `yt-dlp -U` (pip) or upgrade your distro package before assuming the tool is broken. Respect copyright and each site's terms of service.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- yt-dlp(1) — download videos from youtube.com or other video platformsEvidence: Documents -f format selection expressions (bv*+ba/b, height filters), -x audio extraction and -o output templates
- yt-dlp README — usage and format selectionEvidence: Official documentation of format selectors, quality limiting (height<=1080) and the requirement that ffmpeg be installed for merging
Last verified: 2026-09-17 · Category: Media