LinuxCommandLibrary

yt-dlp

TLDR

Download a video

$ yt-dlp [https://youtube.com/watch?v=VIDEO_ID]
copy
Download audio only (best quality)
$ yt-dlp -x [url]
copy
Download audio as MP3
$ yt-dlp -x --audio-format mp3 [url]
copy
List available formats
$ yt-dlp -F [url]
copy
Download specific format
$ yt-dlp -f [format_code] [url]
copy
Download best video + audio
$ yt-dlp -f "bestvideo+bestaudio" [url]
copy
Download entire playlist
$ yt-dlp [playlist_url]
copy
Download with subtitles
$ yt-dlp --write-subs --sub-lang en [url]
copy
Download with custom filename
$ yt-dlp -o "%(title)s.%(ext)s" [url]
copy

SYNOPSIS

yt-dlp [options] URL...

DESCRIPTION

yt-dlp is a feature-rich command-line program to download videos from YouTube and many other sites. It's a fork of youtube-dl with additional features and active maintenance.
The tool supports thousands of sites, not just YouTube. Use --list-extractors to see all supported sites.
Format selection is powerful: bestvideo+bestaudio merges separate streams, best[height<=720] limits quality, and specific format codes from -F select exact streams.
Configuration can be stored in ~/.config/yt-dlp/config for default options.

PARAMETERS

-F, --list-formats

List available formats
-f FORMAT
Select format by code or quality selector
-x, --extract-audio
Extract audio only
--audio-format FORMAT
Convert audio to format (mp3, aac, wav, etc.)
--audio-quality QUALITY
Audio quality (0=best, 9=worst)
-o TEMPLATE
Output filename template
--write-subs
Download subtitles
--sub-lang LANGS
Subtitle languages (comma-separated)
--embed-subs
Embed subtitles in video
--embed-thumbnail
Embed thumbnail in audio
-P PATH
Download to specified directory
--no-playlist
Download only the video if URL refers to playlist
--playlist-items ITEMS
Playlist items to download (e.g., 1,3,5-10)
-U, --update
Update yt-dlp

FILENAME TEMPLATE

%(title)s: Video title
%(id)s: Video ID
%(ext)s: File extension
%(uploader)s: Channel name
%(upload_date)s: Upload date (YYYYMMDD)
%(playlist_index)s: Playlist position

CAVEATS

Site support depends on extractor updates. When sites change, extractors may break until updated. Run yt-dlp -U regularly.
Some sites require authentication. Use --cookies-from-browser or --cookies to provide login cookies.
Downloaded content may be subject to copyright. Respect content creators' rights and terms of service.
Merging formats requires ffmpeg to be installed for proper video/audio combination.

SEE ALSO

ffmpeg(1), youtube-dl(1), aria2c(1), wget(1)

Copied to clipboard