不能不用的下载工具
- 2026-11-18 02:06:24
不能不用的下载工具
还在为看中的视频无法下载而烦恼?yt-dlp 可以帮你解决这个痛点。作为一款主流且功能强大的开源下载内核,它拥有丰富的适配能力,支持大量网站的音视频解析、下载,还能自定义格式、分辨率、字幕等参数。市面上绝大多数易用的图形化视频下载工具,本质上都是对 yt-dlp 进行二次封装,简化命令行操作,方便普通用户直接使用。

安装与更新 基础用法 参数详解 - 3.1 通用选项 General - 3.2 网络选项 Network - 3.3 地区限制 Geo-restriction - 3.4 视频筛选 Video Selection - 3.5 下载控制 Download - 3.6 文件输出 Filesystem - 3.7 封面选项 Thumbnail - 3.8 调试与模拟 Verbosity - 3.9 兼容绕过 Workarounds - 3.10 画质格式 Video Format - 3.11 字幕选项 Subtitle - 3.12 账号认证 Authentication - 3.13 后处理 Post-Processing - 3.14 SponsorBlock - 3.15 解析器选项 Extractor - 3.16 内置预设 Preset Alias 常用场景速查 配置文件模板 常见报错排查 输出模板变量表
一、安装与更新
方式 1:独立二进制
从 GitHub Releases 下载 yt-dlp.exe下载 ffmpeg.exe,与yt-dlp.exe放在同一目录该目录加入系统环境变量 PATH
方式 2:scoop 安装(推荐)
scoop install yt-dlp二、基础用法
# 最简单:自动选最高画质下载yt-dlp "视频链接"# 查看所有可用格式(必用)yt-dlp -F "视频链接"# 指定格式 ID 下载(137=视频流,140=音频流,+ 表示合并)yt-dlp -f 137+140 "视频链接"# 按语法筛选:不超过 1080p,优先 mp4 + m4ayt-dlp -f "bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best" "视频链接"# 简写:最佳视频 + 最佳音频,失败回退到合并流yt-dlp -f "bv*+ba/b" "视频链接"
三、参数详解
3.1 通用选项 General Options
-h, --help | |
--version | |
-U, --update | |
--no-update | |
--update-to [CHANNEL]@[TAG] | stable 稳定、nightly 夜间、master 开发版 |
-i, --ignore-errors | |
--no-abort-on-error | |
--abort-on-error | --no-ignore-errors) |
--list-extractors | |
--extractor-descriptions | |
--use-extractors NAMES--ies) | all、default;-名称 表示排除 |
--default-search PREFIX | auto 自动猜测、error 直接报错 |
--ignore-config--no-config) | |
--no-config-locations | |
--config-locations PATH | |
--plugin-dirs DIR | default 为默认目录 |
--no-plugin-dirs | |
--js-runtimes RUNTIME[:PATH] | deno / node / quickjs / bun;默认 deno 优先级最高,多站点解析依赖 JS |
--no-js-runtimes | |
--remote-components COMPONENT | ejs:npm / ejs:github),官方 exe 一般无需使用 |
--no-remote-components | |
--flat-playlist | |
--no-flat-playlist | |
--live-from-start | |
--no-live-from-start | |
--wait-for-video MIN[-MAX] | |
--no-wait-for-video | |
--mark-watched--no-mark-watched | |
--color [STREAM:]POLICY | always / auto / never / no_color |
--compat-options OPTS | |
--alias ALIASES OPTIONS | |
-t, --preset-alias PRESET | mp3 / aac / mp4 / mkv / sleep |
3.2 网络选项 Network Options
--proxy URL | http / https / socks5://user:pass@host:port;--proxy "" 表示直连 |
--socket-timeout SECONDS | |
--source-address IP | |
--impersonate CLIENT[:OS] | chrome、chrome-126:windows-11、chrome:macos-14 |
--list-impersonate-targets | |
-4, --force-ipv4 | |
-6, --force-ipv6 | |
--enable-file-urls | file:// 本地链接(默认关闭,安全原因) |
3.3 地区限制 Geo-restriction
--geo-verification-proxy URL | |
--xff VALUE | X-Forwarded-For 绕过地区限制;可选 default / never / CIDR 网段 / 两位国家码 |
3.4 视频筛选 Video Selection
-I, --playlist-items ITEM_SPEC | 1:3,7,-5::2,支持 [START]:[STOP][:STEP]、负数倒序 |
--min-filesize SIZE | 50k / 44.6M) |
--max-filesize SIZE | |
--date DATE | YYYYMMDD 或 today-2weeks |
--datebefore DATE | |
--dateafter DATE | |
--match-filters FILTER | |
--break-match-filters FILTER | --match-filters,但命中拒绝条件时终止整个任务 |
--no-playlist | |
--yes-playlist | |
--age-limit YEARS | |
--download-archive FILE | |
--max-downloads NUMBER | |
--break-on-existing | |
--break-per-input | --max-downloads--break-on-existing 按每个链接单独计数 |
--skip-playlist-after-errors N |
3.5 下载控制 Download Options
-N, --concurrent-fragments N | |
-r, --limit-rate RATE | 2M、500K |
--throttled-rate RATE | |
-R, --retries RETRIES | infinite |
--file-access-retries RETRIES | |
--fragment-retries RETRIES | |
--retry-sleep [TYPE:]EXPR | linear=START[:END[:STEP]]、exp=START[:END[:BASE]] |
--skip-unavailable-fragments | |
--abort-on-unavailable-fragments | |
--keep-fragments | |
--buffer-size SIZE | |
--resize-buffer--no-resize-buffer | |
--http-chunk-size SIZE | |
--playlist-random | |
--lazy-playlist | |
--hls-use-mpegts | |
--download-sections REGEX | *10:15-inf、intro、*from-url;需 ffmpeg |
--downloader [PROTO:]NAME | native / aria2c / axel / curl / ffmpeg / wget,可按协议区分 |
--downloader-args NAME:ARGS | aria2c:-x 16 -s 16 |
3.6 文件输出 Filesystem Options
-a, --batch-file FILE | #、;、] 开头为注释;- 表示标准输入 |
--no-batch-file | |
-P, --paths [TYPES:]PATH | home、temp、video、audio、subtitle、thumbnail 等 |
-o, --output [TYPES:]TEMPLATE | |
--output-na-placeholder TEXT | NA) |
--restrict-filenames | & 与空格 |
--windows-filenames | |
--trim-filenames LENGTH | |
-w, --no-overwrites | |
--force-overwrites | --no-continue) |
-c, --continue | |
--no-continue | |
--part | .part 后缀,完成后改名(默认) |
--mtime | Last-modified 设置文件修改时间 |
--write-description | .description |
--write-info-json | |
--write-comments--get-comments) | |
--load-info-json FILE | |
--cookies FILE | cookies.txt(会员视频必备) |
--cookies-from-browser BROWSER | brave / chrome / chromium / edge / firefox / opera / safari / vivaldi / whale |
--cache-dir DIR | |
--no-cache-dir--rm-cache-dir |
3.7 封面选项 Thumbnail Options
--write-thumbnail | |
--write-all-thumbnails | |
--list-thumbnails |
3.8 调试与模拟 Verbosity & Simulation
-q, --quiet | |
--no-warnings | |
-s, --simulate | |
--no-simulate | |
--ignore-no-formats-error | |
--skip-download--no-download) | |
-O, --print [WHEN:]TEMPLATE | |
--print-to-file TEMPLATE FILE | |
-j, --dump-json | |
-J, --dump-single-json | |
--newline | |
--no-progress | |
--console-title | |
--progress-template [TYPES:]TEMPLATE | download / download-title / postprocess / postprocess-title |
-v, --verbose | |
--dump-pages | |
--write-pages | |
--print-traffic |
3.9 兼容与绕过 Workarounds
--encoding ENCODING | |
--legacy-server-connect | |
--no-check-certificates | |
--prefer-insecure | |
--add-headers FIELD:VALUE | |
--bidi-workaround | bidiv / fribidi |
--sleep-requests SECONDS | |
--sleep-interval SECONDS--min-sleep-interval) | |
--max-sleep-interval SECONDS | --min-sleep-interval) |
--sleep-subtitles SECONDS |
3.10 画质格式选择 Video Format Options
-f, --format FORMAT | |
-S, --format-sort SORTORDER | vcodec / acodec / res / fps / hdr:12 / lang / quality |
--format-sort-reset | |
--format-sort-force--S-force) | |
--video-multistreams--audio-multistreams | |
--prefer-free-formats | |
--check-formats | |
--check-all-formats | |
-F, --list-formats | |
--merge-output-format FORMAT | avi / flv / mkv / mov / mp4 / webm |
3.11 字幕选项 Subtitle Options
--write-subs | |
--write-auto-subs--write-automatic-subs) | |
--list-subs | |
--sub-format FORMAT | srt、ass/srt/best |
--sub-langs LANGS | zh,en、en.*(正则)、all,-live_chat(排除) |
--convert-subs FORMAT--convert-subtitles) | ass / lrc / srt / vtt |
3.12 账号认证 Authentication Options
-u, --username | |
-p, --password | |
-2, --twofactor | |
-n, --netrc | .netrc 认证数据 |
--netrc-location PATH | .netrc |
--netrc-cmd NETRC_CMD | |
--video-password PASSWORD | |
--ap-mso--ap-username / --ap-password / --ap-list-mso | |
--client-certificate CERTFILE | |
--client-certificate-key KEYFILE | |
--client-certificate-password PASSWORD |
3.13 后处理 Post-Processing Options
-x, --extract-audio | |
--audio-format FORMAT | best / aac / alac / flac / m4a / mp3 / opus / vorbis / wav |
--audio-quality QUALITY | 128K |
--remux-video FORMAT | |
--recode-video FORMAT | |
--postprocessor-args NAME:ARGS--ppa) | |
-k, --keep-video | |
--embed-subs | |
--embed-thumbnail | |
--embed-metadata--add-metadata) | |
--embed-chapters--add-chapters) | |
--parse-metadata [WHEN:]FROM:TO | |
--replace-in-metadata FIELDS REGEX REPLACE | |
--xattrs | |
--concat-playlist POLICY | never / always / multi_video |
--fixup POLICY | never / warn / detect_or_warn / force |
--ffmpeg-location PATH | |
--exec [WHEN:]CMD | |
--split-chapters | |
--remove-chapters REGEX | |
--force-keyframes-at-cuts | |
--use-postprocessor NAME[:ARGS] |
3.14 SponsorBlock 选项
--sponsorblock-mark CATS | sponsor / intro / outro / selfpromo / preview / filler / interaction / music_offtopic / all |
--sponsorblock-remove CATS | default 等于 all,-filler) |
--sponsorblock-chapter-title TEMPLATE | |
--sponsorblock-api URL | |
--no-sponsorblock |
3.15 解析器选项 Extractor Options
--extractor-retries RETRIES | infinite |
--allow-dynamic-mpd--ignore-dynamic-mpd | |
--hls-split-discontinuity | |
--extractor-args IE_KEY:ARGS |
3.16 内置预设 Preset Aliases
-t mp3# → -f 'ba[acodec^=mp3]/ba/b' -x --audio-format mp3-t aac# → -f 'ba[acodec^=aac]/ba[acodec^=mp4a.40.]/ba/b' -x --audio-format aac-t mp4# → --merge-output-format mp4 --remux-video mp4 -S vcodec:h264,lang,quality,res,fps,hdr:12,acodec:aac-t mkv# → --merge-output-format mkv --remux-video mkv-t sleep# → --sleep-subtitles 5 --sleep-requests 0.75 --sleep-interval 10 --max-sleep-interval 20
四、常用场景速查
只提取音频转 MP3
yt-dlp -x --audio-format mp3 --audio-quality 0 "链接"自定义输出目录与文件名
yt-dlp -o "D:\video\%(title)s.%(ext)s" "链接"下载合集并跳过已下载(追更)
yt-dlp --download-archive archive.txt "合集链接"下载字幕并嵌入视频
yt-dlp --write-subs --write-auto-subs --embed-subs "链接"只下字幕不下视频
yt-dlp --write-subs --skip-download "链接"会员视频 / 需要登录
# 方式一:导出 cookies.txt 后使用yt-dlp --cookies cookies.txt "链接"# 方式二:直接从浏览器读取 Cookie(无需导出)yt-dlp --cookies-from-browser edge "链接"yt-dlp --cookies-from-browser chrome:Profile1 "链接"
使用代理
yt-dlp --proxy socks5h://127.0.0.1:1080 ”链接”yt-dlp --proxy http://127.0.0.1:7890 ”链接”
搭配 aria2c 多线程加速
yt-dlp -f "bv*+ba/b" \--downloader aria2c \--downloader-args "aria2c:-x 16 -s 16 -k 1M" \"链接"
只下载视频某个片段
yt-dlp --download-sections "*00:05:00-00:10:30" "链接"去掉视频片头片尾广告
yt-dlp --sponsorblock-remove "intro,outro,sponsor" "链接"五、配置文件模板
配置文件路径:%APPDATA%\yt-dlp\config.txt(Windows)
# ========== 网络 ==========--proxy socks5h://127.0.0.1:1080--socket-timeout 20# ========== 输出 ==========-o D:\video\%(uploader)s\%(title)s.%(ext)s--windows-filenames--trim-filenames 120# ========== 画质 ==========-f bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best--merge-output-format mp4# ========== 元信息 ==========--embed-thumbnail--embed-metadata# ========== 字幕 ==========--write-subs--sub-langs ”zh,en”--embed-subs# ========== 稳定性 ==========-N 8-R 20--retry-sleep linear=1::2--no-mtime# ========== 防限流 ==========--sleep-requests 0.75--sleep-interval 10--max-sleep-interval 20
临时跳过配置文件:加
--ignore-config
六、常见报错排查
ffmpeg.exe 放到同目录并加入 PATH,或用 --ffmpeg-location | ||
--cookies 或 --cookies-from-browser | ||
yt-dlp -U 更新,再 -F 查看 | ||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 | ||
--trim-filenames 限制长度,缩短输出路径 | ||
-N 8,或接 aria2c | ||
-i 忽略错误继续 | ||
--download-archive archive.txt | ||
--ignore-no-formats-error 仅取元信息 | ||
--file-access-retries 5 |
七、输出模板变量表
-o 参数常用模板变量(格式为 %(字段名)s):
%(title)s | |
%(id)s | |
%(uploader)s | |
%(uploader_id)s | |
%(channel)s | |
%(upload_date)s | |
%(timestamp)s | |
%(duration)s | |
%(resolution)s | 1920x1080 |
%(ext)s | |
%(extractor)s | |
%(playlist)s | |
%(playlist_index)s | %(playlist_index)03d 补零) |
%(chapter)s | |
%(epoch)s |
常用组合示例
# 作者目录 + 标题,合集按 3 位序号补零-o "%(uploader)s/%(playlist_index)03d - %(title)s.%(ext)s"# 按上传日期分目录-o "%(upload_date)s/%(title)s.%(ext)s"# 限制标题长度,避免路径超限-o "%(uploader)s/%(title).80B.%(ext)s"
%(字段名).80B表示按 80 字节截断,比直接--trim-filenames更精细。
本文来自网友投稿或网络内容,如有侵犯您的权益请联系我们删除,联系邮箱:wyl860211@qq.com 。