yt-dlp / youtube-dl
youtube-dl is a command-line program for downloading video and audio from YouTube and thousands of other sites. The original ytdl-org/youtube-dl project is effectively unmaintained; the community fork yt-dlp (based on the also-inactive youtube-dlc) is the actively developed successor and what you should install today. It adds multi-threaded fragment downloads, sponsor-block integration, faster extractor fixes, and broader site support, while remaining flag-compatible with youtube-dl in most cases.
Install ffmpeg alongside it — yt-dlp shells out to ffmpeg for muxing separate video+audio streams, format conversion, and metadata embedding.
Common invocations
# Grab an HD MP4 (720p, or the next best LARGER size if 720p
# is unavailable).
yt-dlp \
--output "%(title)s (%(id)s).%(ext)s" \
--format "bestvideo[width<=1280][height>540][ext=mp4]+bestaudio[ext=m4a]/bestvideo[width<=1920][height>720][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
--add-metadata "$URL"
# Best quality video + audio. Often muxed into an MKV container
# rather than MP4; sometimes you'll get WEBM.
yt-dlp \
--output "%(title)s (%(id)s).%(ext)s" \
--format "bestvideo+bestaudio" \
--add-metadata "$URL"
# Best SINGLE-FILE format under 200 MB.
yt-dlp \
--output "%(title)s (%(id)s).%(ext)s" \
--format "best[filesize<200M]" \
--add-metadata "$URL"The format-selection mini-language (bestvideo[...] + bestaudio[...] / fallback) filters streams by width, height, extension, filesize, codec, and bitrate, with / separating fallbacks tried in order.
Useful resolution specs
| Name | Width | (Max) Height | Notes |
|---|---|---|---|
| 480p | 854 | 480 | DVD quality |
| 540p | 960 | 540 | ”Quarter HD”; uncommon except on VHX |
| 720p | 1280 | 720 | Usually just called “HD” |
| 1080p | 1920 | 1080 | ”Full HD” |
Keeping it current
Distro repos and even pip lag badly behind the extractor churn (sites change constantly, and YouTube breaks old extractors regularly). Practical options:
- Grab the standalone binary from the yt-dlp releases page and run
yt-dlp -Uto self-update. - Or run from source in a Python virtual environment:
virtualenv yt-dlp && cd yt-dlp && . bin/activate
git clone https://github.com/yt-dlp/yt-dlp.git
cd yt-dlp && make # build in place; run as ./yt-dlp, DON'T make installNotes
--add-metadataembeds title/description/upload date into the output file’s tags (requires ffmpeg).-Flists all available formats for a URL without downloading; combine with-f <code>+<code>to pick exact streams.