Linux command
yt-dlp 命令
网络
需要网络或远程资源。
常用示例
Download a video
yt-dlp [https://youtube.com/watch?v=VIDEO_ID]
Download audio only
yt-dlp -x [url]
Download audio as MP3
yt-dlp -x --audio-format mp3 [url]
List available formats
yt-dlp -F [url]
Download specific format
yt-dlp -f [format_code] [url]
Download best video + audio
yt-dlp -f "bestvideo+bestaudio" [url]
Download entire playlist
yt-dlp [playlist_url]
Download with subtitles
yt-dlp --write-subs --sub-lang en [url]
Download with custom filename
yt-dlp -o "%(title)s.%(ext)s" [url]
说明
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, bestheight<=720 limits quality, and specific format codes from -F select exact streams. Configuration can be stored in ~/.config/yt-dlp/config for default options.
参数
- -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)
- --cookies-from-browser _BROWSER_
- Extract cookies from browser (chrome, firefox, edge, safari, etc.)
- --limit-rate _RATE_
- Limit download speed (e.g., 50K, 4.2M)
- --sponsorblock-mark _CATS_
- Mark SponsorBlock categories in video chapters (sponsor, intro, outro, etc.)
- -U, --update
- Update yt-dlp
FAQ
What is the yt-dlp command used for?
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, bestheight<=720 limits quality, and specific format codes from -F select exact streams. Configuration can be stored in ~/.config/yt-dlp/config for default options.
How do I run a basic yt-dlp example?
Run `yt-dlp [https://youtube.com/watch?v=VIDEO_ID]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -F, --list-formats do in yt-dlp?
List available formats