1yt-dlp(1) yt-dlp(1)
2
3
4
6 youtube-dl - download videos from youtube.com or other video platforms
7
9 yt-dlp [OPTIONS] URL [URL...]
10
11 [IMAGE: YT-DLP (https://raw.githubusercontent.com/yt-dlp/yt-dlp/mas‐
12 ter/.github/banner.svg)]
13
14 [IMAGE: Release version (https://img.shields.io/github/v/release/yt-
15 dlp/yt-dlp?color=blue&label=&style=for-the-badge)]
16 (https://github.com/yt-dlp/yt-dlp/releases/latest) [IMAGE: CI Status
17 (https://img.shields.io/github/workflow/status/yt-dlp/yt-
18 dlp/Core%20Tests/master?label=&style=for-the-badge)]
19 (https://github.com/yt-dlp/yt-dlp/actions) [IMAGE: License: Unlicense
20 (https://img.shields.io/badge/-Unlicense-blue.svg?style=for-the-badge)]
21 [IMAGE: Donate (https://img.shields.io/badge/_-Donate-red.svg?lo‐
22 go=githubsponsors&labelColor=555555&style=for-the-badge)] [IMAGE: Sup‐
23 ported Sites (https://img.shields.io/badge/-Supported_Sites-bright‐
24 green.svg?style=for-the-badge)] [IMAGE: Discord] (https://dis‐
25 cord.gg/H5MNcFW63r) [IMAGE: Doc Status (https://readthedo‐
26 cs.org/projects/yt-dlp/badge/?version=latest&style=for-the-badge)]
27 (https://yt-dlp.readthedocs.io) [IMAGE: Commits
28 (https://img.shields.io/github/commit-activity/m/yt-dlp/yt-dlp?la‐
29 bel=commits&style=for-the-badge)] (https://github.com/yt-dlp/yt-
30 dlp/commits) [IMAGE: Last Commit (https://img.shields.io/github/last-
31 commit/yt-dlp/yt-dlp/master?label=&style=for-the-badge)]
32 (https://github.com/yt-dlp/yt-dlp/commits) [IMAGE: Downloads
33 (https://img.shields.io/github/downloads/yt-dlp/yt-dlp/total?style=for-
34 the-badge&color=blue)] (https://github.com/yt-dlp/yt-dlp/releases/lat‐
35 est) [IMAGE: PyPi Downloads (https://img.shields.io/pypi/dm/yt-dlp?la‐
36 bel=PyPi&style=for-the-badge)] (https://pypi.org/project/yt-dlp)
37
38 yt-dlp is a youtube-dl (https://github.com/ytdl-org/youtube-dl) fork
39 based on the now inactive youtube-dlc (https://github.com/black‐
40 jack4494/yt-dlc). The main focus of this project is adding new fea‐
41 tures and patches while also keeping up to date with the original
42 project
43
44 • NEW FEATURES
45
46 • Differences in default behavior
47
48 • INSTALLATION
49
50 • Update
51
52 • Release Files
53
54 • Dependencies
55
56 • Compile
57
58 • USAGE AND OPTIONS
59
60 • General Options
61
62 • Network Options
63
64 • Geo-restriction
65
66 • Video Selection
67
68 • Download Options
69
70 • Filesystem Options
71
72 • Thumbnail Options
73
74 • Internet Shortcut Options
75
76 • Verbosity and Simulation Options
77
78 • Workarounds
79
80 • Video Format Options
81
82 • Subtitle Options
83
84 • Authentication Options
85
86 • Post-processing Options
87
88 • SponsorBlock Options
89
90 • Extractor Options
91
92 • CONFIGURATION
93
94 • Authentication with .netrc file
95
96 • OUTPUT TEMPLATE
97
98 • Output template and Windows batch files
99
100 • Output template examples
101
102 • FORMAT SELECTION
103
104 • Filtering Formats
105
106 • Sorting Formats
107
108 • Format Selection examples
109
110 • MODIFYING METADATA
111
112 • Modifying metadata examples
113
114 • EXTRACTOR ARGUMENTS
115
116 • PLUGINS
117
118 • EMBEDDING YT-DLP
119
120 • DEPRECATED OPTIONS
121
122 • CONTRIBUTING
123
124 • Opening an Issue
125
126 • Developer Instructions
127
128 • MORE
129
131 The major new features from the latest release of blackjack4494/yt-dlc
132 (https://github.com/blackjack4494/yt-dlc) are:
133
134 • SponsorBlock Integration: You can mark/remove sponsor sections in
135 youtube videos by utilizing the SponsorBlock (https://spon‐
136 sor.ajay.app) API
137
138 • Format Sorting: The default format sorting options have been changed
139 so that higher resolution and better codecs will be now preferred in‐
140 stead of simply using larger bitrate. Furthermore, you can now spec‐
141 ify the sort order using -S. This allows for much easier format se‐
142 lection than what is possible by simply using --format (examples)
143
144 • Merged with youtube-dl commit/379f52a (https://github.com/ytdl-
145 org/youtube-dl/commit/379f52a4954013767219d25099cce9e0f9401961):
146 (v2021.06.06) You get all the latest features and patches of youtube-
147 dl (https://github.com/ytdl-org/youtube-dl) in addition to all the
148 features of youtube-dlc (https://github.com/blackjack4494/yt-dlc)
149
150 • Merged with animelover1984/youtube-dl: You get most of the features
151 and improvements from animelover1984/youtube-dl
152 (https://github.com/animelover1984/youtube-dl) including --write-com‐
153 ments, BiliBiliSearch, BilibiliChannel, Embedding thumbnail in
154 mp4/ogg/opus, playlist infojson etc. Note that the NicoNico improve‐
155 ments are not available. See #31 (https://github.com/yt-dlp/yt-
156 dlp/pull/31) for details.
157
158 • Youtube improvements:
159
160 • All Feeds (:ytfav, :ytwatchlater, :ytsubs, :ythistory, :ytrec) and
161 private playlists supports downloading multiple pages of content
162
163 • Search (ytsearch:, ytsearchdate:), search URLs and in-channel
164 search works
165
166 • Mixes supports downloading multiple pages of content
167
168 • Some (but not all) age-gated content can be downloaded without
169 cookies
170
171 • Fix for n-sig based throttling (https://github.com/ytdl-
172 org/youtube-dl/issues/29326)
173
174 • Redirect channel's home URL automatically to /video to preserve the
175 old behaviour
176
177 • 255kbps audio is extracted (if available) from youtube music when
178 premium cookies are given
179
180 • Youtube music Albums, channels etc can be downloaded (except self-
181 uploaded music (https://github.com/yt-dlp/yt-dlp/issues/723))
182
183 • Cookies from browser: Cookies can be automatically extracted from all
184 major web browsers using --cookies-from-browser BROWSER[:PROFILE]
185
186 • Split video by chapters: Videos can be split into multiple files
187 based on chapters using --split-chapters
188
189 • Multi-threaded fragment downloads: Download multiple fragments of
190 m3u8/mpd videos in parallel. Use --concurrent-fragments (-N) option
191 to set the number of threads used
192
193 • Aria2c with HLS/DASH: You can use aria2c as the external downloader
194 for DASH(mpd) and HLS(m3u8) formats
195
196 • New extractors: 17live, 3speak, amazonstore, animelab, audius, band‐
197 campmusic, bannedvideo, biliintl, bitwave.tv, blackboardcollaborate,
198 cam4, cgtn, chingari, ciscowebex, damtomo, discoveryplus.in, douyin,
199 epicon, euscreen, fancode, filmmodu, gab, gedi, gettr, gopro, goto‐
200 stage, gronkh, koo, manototv, mediaite, mediaklikk, mediasetshow, me‐
201 diathek, microsoftstream, mildom, mirrativ, mlsscoccer, mtv.it, mus‐
202 escore, mxplayershow, n1, nebula, nfhsnetwork, novaplay, nzherald,
203 olympics replay, on24, openrec, parlview-AU, peloton, planetmarathi,
204 pluto.tv, polsatgo, polskieradio, pornflip, projectveritas, radiko,
205 radiokapital, radlive, raiplayradio, rcs, rctiplus, saitosan, sci‐
206 encechannel, shemaroome, skynews-AU, skynews-story, sovietscloset,
207 startv, streamanity, telemundo, theta, theta, tokentube, tv2huseries,
208 ukcolumn, utreon, veo, vidiolive, vidiopremier, voicy, vupload,
209 whowatch, wim.tv, wppilot, youtube webarchive, zee5, zen.yandex
210
211 • New playlist extractors: bilibili categories, eroprofile albums, hot‐
212 star series, hungama albums, newgrounds user, niconico search/users,
213 paramountplus series, patreon user, peertube playlist/channels,
214 roosterteeth series, sonyliv series, tiktok user, trovo channels,
215 voot series
216
217 • Fixed/improved extractors: 7plus, 9now, afreecatv, akamai, aljazeera,
218 amcnetworks, animalplanet, archive.org, arte, atv, bbc, bilibili,
219 bitchute, bravotv, camtube, cbc, cda, ceskatelevize, chingari, come‐
220 dycentral, coub, crackle, crunchyroll, curiositystream, diynetwork,
221 dw, eroprofile, facebook, francetv, funimation, globo, hearthisatie,
222 hidive, hotstar, hungama, imdb, ina, instagram, iprima, itv, iwara,
223 kakao, la7, linkedinlearning, linuxacadamy, mediaset, mediasite,
224 motherless, mxplayer, nbcolympics, ndr, newgrounds, niconico, nitter,
225 nova, nrk, nuvid, oreilly, paramountplus, parliamentlive, patreon,
226 pbs, peertube, plutotv, polskieradio, pornhub, reddit, reddit, red‐
227 tube, rmcdecouverte, roosterteeth, rtp, rumble, saml verizon login,
228 skyit, sonyliv, soundcloud, southparkde, spankbang, spreaker, stream‐
229 able, tagesschau, tbs, tennistv, tenplay, tiktok, tubi, tv2, tv2hu,
230 tv5mondeplus, tvp, twitcasting, vh1, viafree, videa, vidio, vidme,
231 viewlift, viki, vimeo, viu, vk, vlive, vrt, wakanim, xhamster, yahoo
232
233 • New MSOs: Philo, Spectrum, SlingTV, Cablevision, RCN
234
235 • Subtitle extraction from manifests: Subtitles can be extracted from
236 streaming media manifests. See commit/be6202f
237 (https://github.com/yt-dlp/yt-dlp/com‐
238 mit/be6202f12b97858b9d716e608394b51065d0419f) for details
239
240 • Multiple paths and output templates: You can give different output
241 templates and download paths for different types of files. You can
242 also set a temporary path where intermediary files are downloaded to
243 using --paths (-P)
244
245 • Portable Configuration: Configuration files are automatically loaded
246 from the home and root directories. See configuration for details
247
248 • Output template improvements: Output templates can now have date-time
249 formatting, numeric offsets, object traversal etc. See output tem‐
250 plate for details. Even more advanced operations can also be done
251 with the help of --parse-metadata and --replace-in-metadata
252
253 • Other new options: --print, --sleep-requests, --convert-thumbnails,
254 --write-link, --force-download-archive, --force-overwrites, --break-
255 on-reject etc
256
257 • Improvements: Regex and other operators in --match-filter, multiple
258 --postprocessor-args and --downloader-args, faster archive checking,
259 more format selection options etc
260
261 • Plugins: Extractors and PostProcessors can be loaded from an external
262 file. See plugins for details
263
264 • Self-updater: The releases can be updated using yt-dlp -U
265
266 See changelog or commits (https://github.com/yt-dlp/yt-dlp/commits) for
267 the full list of changes
268
269 PS: Some of these changes are already in youtube-dlc, but are still un‐
270 released. See this for details
271
272 If you are coming from youtube-dl (https://github.com/ytdl-org/youtube-
273 dl), the amount of changes are very large. Compare options and sup‐
274 ported sites with youtube-dl's to get an idea of the massive number of
275 features/patches youtube-dlc (https://github.com/blackjack4494/yt-dlc)
276 has accumulated.
277
278 Differences in default behavior
279 Some of yt-dlp's default options are different from that of youtube-dl
280 and youtube-dlc:
281
282 • The options --auto-number (-A), --title (-t) and --literal (-l), no
283 longer work. See removed options for details
284
285 • avconv is not supported as as an alternative to ffmpeg
286
287 • The default output template is %(title)s [%(id)s].%(ext)s. There is
288 no real reason for this change. This was changed before yt-dlp was
289 ever made public and now there are no plans to change it back to
290 %(title)s-%(id)s.%(ext)s. Instead, you may use --compat-options
291 filename
292
293 • The default format sorting is different from youtube-dl and prefers
294 higher resolution and better codecs rather than higher bitrates. You
295 can use the --format-sort option to change this to any order you pre‐
296 fer, or use --compat-options format-sort to use youtube-dl's sorting
297 order
298
299 • The default format selector is bv*+ba/b. This means that if a com‐
300 bined video + audio format that is better than the best video-only
301 format is found, the former will be prefered. Use -f bv+ba/b or
302 --compat-options format-spec to revert this
303
304 • Unlike youtube-dlc, yt-dlp does not allow merging multiple au‐
305 dio/video streams into one file by default (since this conflicts with
306 the use of -f bv*+ba). If needed, this feature must be enabled using
307 --audio-multistreams and --video-multistreams. You can also use
308 --compat-options multistreams to enable both
309
310 • --ignore-errors is enabled by default. Use --abort-on-error or
311 --compat-options abort-on-error to abort on errors instead
312
313 • When writing metadata files such as thumbnails, description or infoj‐
314 son, the same information (if available) is also written for
315 playlists. Use --no-write-playlist-metafiles or --compat-options no-
316 playlist-metafiles to not write these files
317
318 • --add-metadata attaches the infojson to mkv files in addition to
319 writing the metadata when used with --write-infojson. Use --compat-
320 options no-attach-info-json to revert this
321
322 • playlist_index behaves differently when used with options like
323 --playlist-reverse and --playlist-items. See #302
324 (https://github.com/yt-dlp/yt-dlp/issues/302) for details. You can
325 use --compat-options playlist-index if you want to keep the earlier
326 behavior
327
328 • The output of -F is listed in a new format. Use --compat-options
329 list-formats to revert this
330
331 • All experiences of a funimation episode are considered as a single
332 video. This behavior breaks existing archives. Use --compat-options
333 seperate-video-versions to extract information from only the default
334 player
335
336 • Youtube live chat (if available) is considered as a subtitle. Use
337 --sub-langs all,-live_chat to download all subtitles except live
338 chat. You can also use --compat-options no-live-chat to prevent live
339 chat from downloading
340
341 • Youtube channel URLs are automatically redirected to /video. Append
342 a /featured to the URL to download only the videos in the home page.
343 If the channel does not have a videos tab, we try to download the
344 equivalent UU playlist instead. Also, /live URLs raise an error if
345 there are no live videos instead of silently downloading the entire
346 channel. You may use --compat-options no-youtube-channel-redirect to
347 revert all these redirections
348
349 • Unavailable videos are also listed for youtube playlists. Use --com‐
350 pat-options no-youtube-unavailable-videos to remove this
351
352 • If ffmpeg is used as the downloader, the downloading and merging of
353 formats happen in a single step when possible. Use --compat-options
354 no-direct-merge to revert this
355
356 • Thumbnail embedding in mp4 is done with mutagen if possible. Use
357 --compat-options embed-thumbnail-atomicparsley to force the use of
358 AtomicParsley instead
359
360 • Some private fields such as filenames are removed by default from the
361 infojson. Use --no-clean-infojson or --compat-options no-clean-info‐
362 json to revert this
363
364 • When --embed-subs and --write-subs are used together, the subtitles
365 are written to disk and also embedded in the media file. You can use
366 just --embed-subs to embed the subs and automatically delete the
367 seperate file. See #630 (comment) (https://github.com/yt-dlp/yt-
368 dlp/issues/630#issuecomment-893659460) for more info. --compat-op‐
369 tions no-keep-subs can be used to revert this
370
371 For ease of use, a few more compat options are available: * --compat-
372 options all: Use all compat options * --compat-options youtube-dl: Same
373 as --compat-options all,-multistreams * --compat-options youtube-dlc:
374 Same as --compat-options all,-no-live-chat,-no-youtube-channel-redirect
375
377 You can install yt-dlp using one of the following methods:
378
379 Using the release binary
380 You can simply download the correct binary file for your OS: [Windows
381 (https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe)]
382 [UNIX-like (https://github.com/yt-dlp/yt-dlp/releases/latest/down‐
383 load/yt-dlp)]
384
385 In UNIX-like OSes (MacOS, Linux, BSD), you can also install the same in
386 one of the following ways:
387
388 sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
389 sudo chmod a+rx /usr/local/bin/yt-dlp
390
391 sudo wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
392 sudo chmod a+rx /usr/local/bin/yt-dlp
393
394 sudo aria2c https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
395 sudo chmod a+rx /usr/local/bin/yt-dlp
396
397 PS: The manpages, shell completion files etc. are available in yt-
398 dlp.tar.gz (https://github.com/yt-dlp/yt-dlp/releases/latest/down‐
399 load/yt-dlp.tar.gz)
400
401 With PIP (https://pypi.org/project/pip)
402 You can install the PyPI package (https://pypi.org/project/yt-dlp)
403 with:
404
405 python3 -m pip install -U yt-dlp
406
407 You can install without any of the optional dependencies using:
408
409 python3 -m pip install --no-deps -U yt-dlp
410
411 If you want to be on the cutting edge, you can also install the master
412 branch with:
413
414 python3 -m pip3 install --force-reinstall https://github.com/yt-dlp/yt-dlp/archive/master.zip
415
416 Note that on some systems, you may need to use py or python instead of
417 python3
418
419 With Homebrew (https://brew.sh)
420 macOS or Linux users that are using Homebrew can also install it by:
421
422 brew install yt-dlp/taps/yt-dlp
423
424 UPDATE
425 You can use yt-dlp -U to update if you are using the provided release
426
427 If you installed with pip, simply re-run the same command that was used
428 to install the program
429
430 If you installed using Homebrew, run brew upgrade yt-dlp/taps/yt-dlp
431
432 RELEASE FILES
433 Recommended
434 File Description
435 ──────────────────────────────────────────────────────────────────────────
436 yt-dlp (https://github.com/yt- Platform-independant binary. Needs
437 dlp/yt-dlp/releases/latest/down‐ Python (recommended for UNIX-like
438 load/yt-dlp) systems)
439 yt-dlp.exe (https://github.com/yt- Windows (Win7 SP1+) standalone x64
440 dlp/yt-dlp/releases/latest/down‐ binary (recommended for Windows)
441 load/yt-dlp.exe)
442
443 Alternatives
444 File Description
445 ──────────────────────────────────────────────────────────────────────────
446 yt-dlp_macos MacOS (10.15+) standalone exe‐
447 (https://github.com/yt-dlp/yt- cutable
448 dlp/releases/latest/download/yt-
449 dlp_macos)
450 yt-dlp_x86.exe Windows (Vista SP2+) standalone x86
451 (https://github.com/yt-dlp/yt- (32-bit) binary
452 dlp/releases/latest/download/yt-
453 dlp_x86.exe)
454 yt-dlp_min.exe Windows (Win7 SP1+) standalone x64
455 (https://github.com/yt-dlp/yt- binary built with py2exe. Does not
456 dlp/releases/latest/download/yt- contain pycryptodomex, needs VC++14
457 dlp_min.exe)
458 yt-dlp_win.zip Unpackaged Windows executable (no
459 (https://github.com/yt-dlp/yt- auto-update)
460 dlp/releases/latest/download/yt-
461 dlp_win.zip)
462 yt-dlp_macos.zip Unpackaged MacOS (10.15+) exe‐
463 (https://github.com/yt-dlp/yt- cutable (no auto-update)
464 dlp/releases/latest/download/yt-
465 dlp_macos.zip)
466
467 Misc
468 File Description
469 ────────────────────────────────────────────────────────
470 yt-dlp.tar.gz Source tarball. Also con‐
471 (https://github.com/yt- tains manpages, comple‐
472 dlp/yt-dlp/releases/lat‐ tions, etc
473 est/download/yt-
474 dlp.tar.gz)
475
476 SHA2-512SUMS GNU-style SHA512 sums
477 (https://github.com/yt-
478 dlp/yt-dlp/releases/lat‐
479 est/download/SHA2-512SUMS)
480 SHA2-256SUMS GNU-style SHA256 sums
481 (https://github.com/yt-
482 dlp/yt-dlp/releases/lat‐
483 est/download/SHA2-256SUMS)
484
485 DEPENDENCIES
486 Python versions 3.6+ (CPython and PyPy) are supported. Other versions
487 and implementations may or may not work correctly.
488
489 While all the other dependancies are optional, ffmpeg and ffprobe are
490 highly recommended * ffmpeg and ffprobe (https://www.ffmpeg.org) - Re‐
491 quired for merging seperate video and audio files as well as for vari‐
492 ous post-processing tasks. Licence depends on the build
493 (https://www.ffmpeg.org/legal.html) * mutagen
494 (https://github.com/quodlibet/mutagen) - For embedding thumbnail in
495 certain formats. Licensed under GPLv2+ (https://github.com/quodli‐
496 bet/mutagen/blob/master/COPYING) * pycryptodomex
497 (https://github.com/Legrandin/pycryptodome) - For decrypting AES-128
498 HLS streams and various other data. Licensed under BSD2
499 (https://github.com/Legrandin/pycryptodome/blob/master/LICENSE.rst) *
500 websockets (https://github.com/aaugustin/websockets) - For downloading
501 over websocket. Licensed under BSD3 (https://github.com/aaugustin/web‐
502 sockets/blob/main/LICENSE) * keyring (https://github.com/jara‐
503 co/keyring) - For decrypting cookies of chromium-based browsers on Lin‐
504 ux. Licensed under MIT (https://github.com/jara‐
505 co/keyring/blob/main/LICENSE) * AtomicParsley
506 (https://github.com/wez/atomicparsley) - For embedding thumbnail in
507 mp4/m4a if mutagen is not present. Licensed under GPLv2+
508 (https://github.com/wez/atomicparsley/blob/master/COPYING) * rtmpdump
509 (http://rtmpdump.mplayerhq.hu) - For downloading rtmp streams. ffmpeg
510 will be used as a fallback. Licensed under GPLv2+ (http://rtmp‐
511 dump.mplayerhq.hu) * mplayer (http://mplayerhq.hu/design7/info.html) or
512 mpv (https://mpv.io) - For downloading rstp streams. ffmpeg will be
513 used as a fallback. Licensed under GPLv2+ (https://github.com/mpv-
514 player/mpv/blob/master/Copyright) * phantomjs
515 (https://github.com/ariya/phantomjs) - Used in extractors where java‐
516 script needs to be run. Licensed under BSD3
517 (https://github.com/ariya/phantomjs/blob/master/LICENSE.BSD) * spon‐
518 skrub (https://github.com/faissaloo/SponSkrub) - For using the now dep‐
519 recated sponskrub options. Licensed under GPLv3+
520 (https://github.com/faissaloo/SponSkrub/blob/master/LICENCE.md) * Any
521 external downloader that you want to use with --downloader
522
523 To use or redistribute the dependencies, you must agree to their re‐
524 spective licensing terms.
525
526 The Windows and MacOS standalone release binaries are already built
527 with the python interpreter, mutagen, pycryptodomex and websockets in‐
528 cluded.
529
530 Note: There are some regressions in newer ffmpeg versions that causes
531 various issues when used alongside yt-dlp. Since ffmpeg is such an im‐
532 portant dependancy, we provide custom builds (https://github.com/yt-
533 dlp/FFmpeg-Builds/wiki/Latest#latest-autobuilds) with patches for these
534 issues at yt-dlp/FFmpeg-Builds (https://github.com/yt-dlp/FFmpeg-
535 Builds). See the readme (https://github.com/yt-dlp/FFmpeg-
536 Builds#patches-applied) for details on the specifc issues solved by
537 these builds
538
539 COMPILE
540 For Windows: To build the Windows executable, you must have pyinstaller
541 (and optionally mutagen, pycryptodomex, websockets). Once you have all
542 the necessary dependencies installed, (optionally) build lazy extrac‐
543 tors using devscripts/make_lazy_extractors.py, and then just run
544 pyinst.py. The executable will be built for the same architecture
545 (32/64 bit) as the python used to build it.
546
547 py -m pip install -U pyinstaller -r requirements.txt
548 py devscripts/make_lazy_extractors.py
549 py pyinst.py
550
551 Note that pyinstaller does not support (https://github.com/pyin‐
552 staller/pyinstaller#requirements-and-tested-platforms) Python installed
553 from the Windows store without using a virtual environment
554
555 For Unix: You will need the required build tools: python, make (GNU),
556 pandoc, zip, pytest
557 Then simply run make. You can also run make yt-dlp instead to compile
558 only the binary without updating any of the additional files
559
560 Note: In either platform, devscripts/update-version.py can be used to
561 automatically update the version number
562
563 You can also fork the project on github and push it to a release branch
564 in your fork for the build workflow (https://github.com/yt-dlp/yt-
565 dlp/blob/master/.github/workflows/build.yml) to automatically make a
566 release for you
567
569 yt-dlp [OPTIONS] [--] URL [URL...]
570
571 Ctrl+F is your friend :D
572
573 General Options:
574 -h, --help Print this help text and exit
575 --version Print program version and exit
576 -U, --update Update this program to latest version. Make
577 sure that you have sufficient permissions
578 (run with sudo if needed)
579 -i, --ignore-errors Ignore download and postprocessing errors.
580 The download will be considered successful
581 even if the postprocessing fails
582 --no-abort-on-error Continue with next video on download
583 errors; e.g. to skip unavailable videos in
584 a playlist (default)
585 --abort-on-error Abort downloading of further videos if an
586 error occurs (Alias: --no-ignore-errors)
587 --dump-user-agent Display the current user-agent and exit
588 --list-extractors List all supported extractors and exit
589 --extractor-descriptions Output descriptions of all supported
590 extractors and exit
591 --force-generic-extractor Force extraction to use the generic
592 extractor
593 --default-search PREFIX Use this prefix for unqualified URLs. For
594 example "gvsearch2:" downloads two videos
595 from google videos for the search term
596 "large apple". Use the value "auto" to let
597 yt-dlp guess ("auto_warning" to emit a
598 warning when guessing). "error" just throws
599 an error. The default value "fixup_error"
600 repairs broken URLs, but emits an error if
601 this is not possible instead of searching
602 --ignore-config Disable loading any configuration files
603 except the one provided by --config-
604 location. When given inside a configuration
605 file, no further configuration files are
606 loaded. Additionally, (for backward
607 compatibility) if this option is found
608 inside the system configuration file, the
609 user configuration is not loaded
610 --config-location PATH Location of the main configuration file;
611 either the path to the config or its
612 containing directory
613 --flat-playlist Do not extract the videos of a playlist,
614 only list them
615 --no-flat-playlist Extract the videos of a playlist
616 --mark-watched Mark videos watched (even with --simulate).
617 Currently only supported for YouTube
618 --no-mark-watched Do not mark videos watched (default)
619 --no-colors Do not emit color codes in output
620 --compat-options OPTS Options that can help keep compatibility
621 with youtube-dl or youtube-dlc
622 configurations by reverting some of the
623 changes made in yt-dlp. See "Differences in
624 default behavior" for details
625
626 Network Options:
627 --proxy URL Use the specified HTTP/HTTPS/SOCKS proxy.
628 To enable SOCKS proxy, specify a proper
629 scheme. For example
630 socks5://127.0.0.1:1080/. Pass in an empty
631 string (--proxy "") for direct connection
632 --socket-timeout SECONDS Time to wait before giving up, in seconds
633 --source-address IP Client-side IP address to bind to
634 -4, --force-ipv4 Make all connections via IPv4
635 -6, --force-ipv6 Make all connections via IPv6
636
637 Geo-restriction:
638 --geo-verification-proxy URL Use this proxy to verify the IP address for
639 some geo-restricted sites. The default
640 proxy specified by --proxy (or none, if the
641 option is not present) is used for the
642 actual downloading
643 --geo-bypass Bypass geographic restriction via faking
644 X-Forwarded-For HTTP header
645 --no-geo-bypass Do not bypass geographic restriction via
646 faking X-Forwarded-For HTTP header
647 --geo-bypass-country CODE Force bypass geographic restriction with
648 explicitly provided two-letter ISO 3166-2
649 country code
650 --geo-bypass-ip-block IP_BLOCK Force bypass geographic restriction with
651 explicitly provided IP block in CIDR
652 notation
653
654 Video Selection:
655 --playlist-start NUMBER Playlist video to start at (default is 1)
656 --playlist-end NUMBER Playlist video to end at (default is last)
657 --playlist-items ITEM_SPEC Playlist video items to download. Specify
658 indices of the videos in the playlist
659 separated by commas like: "--playlist-items
660 1,2,5,8" if you want to download videos
661 indexed 1, 2, 5, 8 in the playlist. You can
662 specify range: "--playlist-items
663 1-3,7,10-13", it will download the videos
664 at index 1, 2, 3, 7, 10, 11, 12 and 13
665 --max-downloads NUMBER Abort after downloading NUMBER files
666 --min-filesize SIZE Do not download any videos smaller than
667 SIZE (e.g. 50k or 44.6m)
668 --max-filesize SIZE Do not download any videos larger than SIZE
669 (e.g. 50k or 44.6m)
670 --date DATE Download only videos uploaded on this date.
671 The date can be "YYYYMMDD" or in the format
672 "(now|today)[+-][0-
673 9](day|week|month|year)(s)?"
674 --datebefore DATE Download only videos uploaded on or before
675 this date. The date formats accepted is the
676 same as --date
677 --dateafter DATE Download only videos uploaded on or after
678 this date. The date formats accepted is the
679 same as --date
680 --match-filter FILTER Generic video filter. Any field (see
681 "OUTPUT TEMPLATE") can be compared with a
682 number or a string using the operators
683 defined in "Filtering formats". You can
684 also simply specify a field to match if the
685 field is present and "!field" to check if
686 the field is not present. In addition,
687 Python style regular expression matching
688 can be done using "~=", and multiple
689 filters can be checked with "&". Use a "\"
690 to escape "&" or quotes if needed. Eg:
691 --match-filter "!is_live & like_count>?100
692 & description~='(?i)\bcats \& dogs\b'"
693 matches only videos that are not live, has
694 a like count more than 100 (or the like
695 field is not available), and also has a
696 description that contains the phrase "cats
697 & dogs" (ignoring case)
698 --no-match-filter Do not use generic video filter (default)
699 --no-playlist Download only the video, if the URL refers
700 to a video and a playlist
701 --yes-playlist Download the playlist, if the URL refers to
702 a video and a playlist
703 --age-limit YEARS Download only videos suitable for the given
704 age
705 --download-archive FILE Download only videos not listed in the
706 archive file. Record the IDs of all
707 downloaded videos in it
708 --break-on-existing Stop the download process when encountering
709 a file that is in the archive
710 --break-on-reject Stop the download process when encountering
711 a file that has been filtered out
712 --skip-playlist-after-errors N Number of allowed failures until the rest
713 of the playlist is skipped
714 --no-download-archive Do not use archive file (default)
715
716 Download Options:
717 -N, --concurrent-fragments N Number of fragments of a dash/hlsnative
718 video that should be download concurrently
719 (default is 1)
720 -r, --limit-rate RATE Maximum download rate in bytes per second
721 (e.g. 50K or 4.2M)
722 --throttled-rate RATE Minimum download rate in bytes per second
723 below which throttling is assumed and the
724 video data is re-extracted (e.g. 100K)
725 -R, --retries RETRIES Number of retries (default is 10), or
726 "infinite"
727 --fragment-retries RETRIES Number of retries for a fragment (default
728 is 10), or "infinite" (DASH, hlsnative and
729 ISM)
730 --skip-unavailable-fragments Skip unavailable fragments for DASH,
731 hlsnative and ISM (default) (Alias: --no-
732 abort-on-unavailable-fragment)
733 --abort-on-unavailable-fragment Abort downloading if a fragment is
734 unavailable (Alias: --no-skip-unavailable-
735 fragments)
736 --keep-fragments Keep downloaded fragments on disk after
737 downloading is finished
738 --no-keep-fragments Delete downloaded fragments after
739 downloading is finished (default)
740 --buffer-size SIZE Size of download buffer (e.g. 1024 or 16K)
741 (default is 1024)
742 --resize-buffer The buffer size is automatically resized
743 from an initial value of --buffer-size
744 (default)
745 --no-resize-buffer Do not automatically adjust the buffer size
746 --http-chunk-size SIZE Size of a chunk for chunk-based HTTP
747 downloading (e.g. 10485760 or 10M) (default
748 is disabled). May be useful for bypassing
749 bandwidth throttling imposed by a webserver
750 (experimental)
751 --playlist-reverse Download playlist videos in reverse order
752 --no-playlist-reverse Download playlist videos in default order
753 (default)
754 --playlist-random Download playlist videos in random order
755 --xattr-set-filesize Set file xattribute ytdl.filesize with
756 expected file size
757 --hls-use-mpegts Use the mpegts container for HLS videos;
758 allowing some players to play the video
759 while downloading, and reducing the chance
760 of file corruption if download is
761 interrupted. This is enabled by default for
762 live streams
763 --no-hls-use-mpegts Do not use the mpegts container for HLS
764 videos. This is default when not
765 downloading live streams
766 --downloader [PROTO:]NAME Name or path of the external downloader to
767 use (optionally) prefixed by the protocols
768 (http, ftp, m3u8, dash, rstp, rtmp, mms) to
769 use it for. Currently supports native,
770 aria2c, avconv, axel, curl, ffmpeg, httpie,
771 wget (Recommended: aria2c). You can use
772 this option multiple times to set different
773 downloaders for different protocols. For
774 example, --downloader aria2c --downloader
775 "dash,m3u8:native" will use aria2c for
776 http/ftp downloads, and the native
777 downloader for dash/m3u8 downloads (Alias:
778 --external-downloader)
779 --downloader-args NAME:ARGS Give these arguments to the external
780 downloader. Specify the downloader name and
781 the arguments separated by a colon ":". For
782 ffmpeg, arguments can be passed to
783 different positions using the same syntax
784 as --postprocessor-args. You can use this
785 option multiple times to give different
786 arguments to different downloaders (Alias:
787 --external-downloader-args)
788
789 Filesystem Options:
790 -a, --batch-file FILE File containing URLs to download ('-' for
791 stdin), one URL per line. Lines starting
792 with '#', ';' or ']' are considered as
793 comments and ignored
794 --no-batch-file Do not read URLs from batch file (default)
795 -P, --paths [TYPES:]PATH The paths where the files should be
796 downloaded. Specify the type of file and
797 the path separated by a colon ":". All the
798 same types as --output are supported.
799 Additionally, you can also provide "home"
800 (default) and "temp" paths. All
801 intermediary files are first downloaded to
802 the temp path and then the final files are
803 moved over to the home path after download
804 is finished. This option is ignored if
805 --output is an absolute path
806 -o, --output [TYPES:]TEMPLATE Output filename template; see "OUTPUT
807 TEMPLATE" for details
808 --output-na-placeholder TEXT Placeholder value for unavailable meta
809 fields in output filename template
810 (default: "NA")
811 --restrict-filenames Restrict filenames to only ASCII
812 characters, and avoid "&" and spaces in
813 filenames
814 --no-restrict-filenames Allow Unicode characters, "&" and spaces in
815 filenames (default)
816 --windows-filenames Force filenames to be Windows-compatible
817 --no-windows-filenames Make filenames Windows-compatible only if
818 using Windows (default)
819 --trim-filenames LENGTH Limit the filename length (excluding
820 extension) to the specified number of
821 characters
822 -w, --no-overwrites Do not overwrite any files
823 --force-overwrites Overwrite all video and metadata files.
824 This option includes --no-continue
825 --no-force-overwrites Do not overwrite the video, but overwrite
826 related files (default)
827 -c, --continue Resume partially downloaded files/fragments
828 (default)
829 --no-continue Do not resume partially downloaded
830 fragments. If the file is not fragmented,
831 restart download of the entire file
832 --part Use .part files instead of writing directly
833 into output file (default)
834 --no-part Do not use .part files - write directly
835 into output file
836 --mtime Use the Last-modified header to set the
837 file modification time (default)
838 --no-mtime Do not use the Last-modified header to set
839 the file modification time
840 --write-description Write video description to a .description
841 file
842 --no-write-description Do not write video description (default)
843 --write-info-json Write video metadata to a .info.json file
844 (this may contain personal information)
845 --no-write-info-json Do not write video metadata (default)
846 --write-playlist-metafiles Write playlist metadata in addition to the
847 video metadata when using --write-info-
848 json, --write-description etc. (default)
849 --no-write-playlist-metafiles Do not write playlist metadata when using
850 --write-info-json, --write-description etc.
851 --clean-infojson Remove some private fields such as
852 filenames from the infojson. Note that it
853 could still contain some personal
854 information (default)
855 --no-clean-infojson Write all fields to the infojson
856 --write-comments Retrieve video comments to be placed in the
857 infojson. The comments are fetched even
858 without this option if the extraction is
859 known to be quick (Alias: --get-comments)
860 --no-write-comments Do not retrieve video comments unless the
861 extraction is known to be quick (Alias:
862 --no-get-comments)
863 --load-info-json FILE JSON file containing the video information
864 (created with the "--write-info-json"
865 option)
866 --cookies FILE File to read cookies from and dump cookie
867 jar in
868 --no-cookies Do not read/dump cookies from/to file
869 (default)
870 --cookies-from-browser BROWSER[:PROFILE]
871 Load cookies from a user profile of the
872 given web browser. Currently supported
873 browsers are: brave, chrome, chromium,
874 edge, firefox, opera, safari, vivaldi. You
875 can specify the user profile name or
876 directory using "BROWSER:PROFILE_NAME" or
877 "BROWSER:PROFILE_PATH". If no profile is
878 given, the most recently accessed one is
879 used
880 --no-cookies-from-browser Do not load cookies from browser (default)
881 --cache-dir DIR Location in the filesystem where youtube-dl
882 can store some downloaded information (such
883 as client ids and signatures) permanently.
884 By default $XDG_CACHE_HOME/yt-dlp or
885 ~/.cache/yt-dlp
886 --no-cache-dir Disable filesystem caching
887 --rm-cache-dir Delete all filesystem cache files
888
889 Thumbnail Options:
890 --write-thumbnail Write thumbnail image to disk
891 --no-write-thumbnail Do not write thumbnail image to disk
892 (default)
893 --write-all-thumbnails Write all thumbnail image formats to disk
894 --list-thumbnails List available thumbnails of each video.
895 Simulate unless --no-simulate is used
896
897 Internet Shortcut Options:
898 --write-link Write an internet shortcut file, depending
899 on the current platform (.url, .webloc or
900 .desktop). The URL may be cached by the OS
901 --write-url-link Write a .url Windows internet shortcut. The
902 OS caches the URL based on the file path
903 --write-webloc-link Write a .webloc macOS internet shortcut
904 --write-desktop-link Write a .desktop Linux internet shortcut
905
906 Verbosity and Simulation Options:
907 -q, --quiet Activate quiet mode. If used with
908 --verbose, print the log to stderr
909 --no-warnings Ignore warnings
910 -s, --simulate Do not download the video and do not write
911 anything to disk
912 --no-simulate Download the video even if printing/listing
913 options are used
914 --ignore-no-formats-error Ignore "No video formats" error. Useful for
915 extracting metadata even if the videos are
916 not actually available for download
917 (experimental)
918 --no-ignore-no-formats-error Throw error when no downloadable video
919 formats are found (default)
920 --skip-download Do not download the video but write all
921 related files (Alias: --no-download)
922 -O, --print TEMPLATE Quiet, but print the given fields for each
923 video. Simulate unless --no-simulate is
924 used. Either a field name or same syntax as
925 the output template can be used
926 -j, --dump-json Quiet, but print JSON information for each
927 video. Simulate unless --no-simulate is
928 used. See "OUTPUT TEMPLATE" for a
929 description of available keys
930 -J, --dump-single-json Quiet, but print JSON information for each
931 url or infojson passed. Simulate unless
932 --no-simulate is used. If the URL refers to
933 a playlist, the whole playlist information
934 is dumped in a single line
935 --force-write-archive Force download archive entries to be
936 written as far as no errors occur, even if
937 -s or another simulation option is used
938 (Alias: --force-download-archive)
939 --newline Output progress bar as new lines
940 --no-progress Do not print progress bar
941 --progress Show progress bar, even if in quiet mode
942 --console-title Display progress in console titlebar
943 --progress-template [TYPES:]TEMPLATE
944 Template for progress outputs, optionally
945 prefixed with one of "download:" (default),
946 "download-title:" (the console title),
947 "postprocess:", or "postprocess-title:".
948 The video's fields are accessible under the
949 "info" key and the progress attributes are
950 accessible under "progress" key. E.g.:
951 --console-title --progress-template
952 "download-
953 title:%(info.id)s-%(progress.eta)s"
954 -v, --verbose Print various debugging information
955 --dump-pages Print downloaded pages encoded using base64
956 to debug problems (very verbose)
957 --write-pages Write downloaded intermediary pages to
958 files in the current directory to debug
959 problems
960 --print-traffic Display sent and read HTTP traffic
961
962 Workarounds:
963 --encoding ENCODING Force the specified encoding (experimental)
964 --no-check-certificates Suppress HTTPS certificate validation
965 --prefer-insecure Use an unencrypted connection to retrieve
966 information about the video (Currently
967 supported only for YouTube)
968 --user-agent UA Specify a custom user agent
969 --referer URL Specify a custom referer, use if the video
970 access is restricted to one domain
971 --add-header FIELD:VALUE Specify a custom HTTP header and its value,
972 separated by a colon ":". You can use this
973 option multiple times
974 --bidi-workaround Work around terminals that lack
975 bidirectional text support. Requires bidiv
976 or fribidi executable in PATH
977 --sleep-requests SECONDS Number of seconds to sleep between requests
978 during data extraction
979 --sleep-interval SECONDS Number of seconds to sleep before each
980 download. This is the minimum time to sleep
981 when used along with --max-sleep-interval
982 (Alias: --min-sleep-interval)
983 --max-sleep-interval SECONDS Maximum number of seconds to sleep. Can
984 only be used along with --min-sleep-
985 interval
986 --sleep-subtitles SECONDS Number of seconds to sleep before each
987 subtitle download
988
989 Video Format Options:
990 -f, --format FORMAT Video format code, see "FORMAT SELECTION"
991 for more details
992 -S, --format-sort SORTORDER Sort the formats by the fields given, see
993 "Sorting Formats" for more details
994 --format-sort-force Force user specified sort order to have
995 precedence over all fields, see "Sorting
996 Formats" for more details
997 --no-format-sort-force Some fields have precedence over the user
998 specified sort order (default), see
999 "Sorting Formats" for more details
1000 --video-multistreams Allow multiple video streams to be merged
1001 into a single file
1002 --no-video-multistreams Only one video stream is downloaded for
1003 each output file (default)
1004 --audio-multistreams Allow multiple audio streams to be merged
1005 into a single file
1006 --no-audio-multistreams Only one audio stream is downloaded for
1007 each output file (default)
1008 --prefer-free-formats Prefer video formats with free containers
1009 over non-free ones of same quality. Use
1010 with "-S ext" to strictly prefer free
1011 containers irrespective of quality
1012 --no-prefer-free-formats Don't give any special preference to free
1013 containers (default)
1014 --check-formats Check that the selected formats are
1015 actually downloadable
1016 --check-all-formats Check all formats for whether they are
1017 actually downloadable
1018 --no-check-formats Do not check that the formats are actually
1019 downloadable
1020 -F, --list-formats List available formats of each video.
1021 Simulate unless --no-simulate is used
1022 --merge-output-format FORMAT If a merge is required (e.g.
1023 bestvideo+bestaudio), output to given
1024 container format. One of mkv, mp4, ogg,
1025 webm, flv. Ignored if no merge is required
1026
1027 Subtitle Options:
1028 --write-subs Write subtitle file
1029 --no-write-subs Do not write subtitle file (default)
1030 --write-auto-subs Write automatically generated subtitle file
1031 (Alias: --write-automatic-subs)
1032 --no-write-auto-subs Do not write auto-generated subtitles
1033 (default) (Alias: --no-write-automatic-
1034 subs)
1035 --list-subs List available subtitles of each video.
1036 Simulate unless --no-simulate is used
1037 --sub-format FORMAT Subtitle format, accepts formats
1038 preference, for example: "srt" or
1039 "ass/srt/best"
1040 --sub-langs LANGS Languages of the subtitles to download (can
1041 be regex) or "all" separated by commas.
1042 (Eg: --sub-langs "en.*,ja") You can prefix
1043 the language code with a "-" to exempt it
1044 from the requested languages. (Eg: --sub-
1045 langs all,-live_chat) Use --list-subs for a
1046 list of available language tags
1047
1048 Authentication Options:
1049 -u, --username USERNAME Login with this account ID
1050 -p, --password PASSWORD Account password. If this option is left
1051 out, yt-dlp will ask interactively
1052 -2, --twofactor TWOFACTOR Two-factor authentication code
1053 -n, --netrc Use .netrc authentication data
1054 --netrc-location PATH Location of .netrc authentication data;
1055 either the path or its containing
1056 directory. Defaults to ~/.netrc
1057 --video-password PASSWORD Video password (vimeo, youku)
1058 --ap-mso MSO Adobe Pass multiple-system operator (TV
1059 provider) identifier, use --ap-list-mso for
1060 a list of available MSOs
1061 --ap-username USERNAME Multiple-system operator account login
1062 --ap-password PASSWORD Multiple-system operator account password.
1063 If this option is left out, yt-dlp will ask
1064 interactively
1065 --ap-list-mso List all supported multiple-system
1066 operators
1067
1068 Post-Processing Options:
1069 -x, --extract-audio Convert video files to audio-only files
1070 (requires ffmpeg and ffprobe)
1071 --audio-format FORMAT Specify audio format to convert the audio
1072 to when -x is used. Currently supported
1073 formats are: best (default) or one of
1074 best|aac|flac|mp3|m4a|opus|vorbis|wav
1075 --audio-quality QUALITY Specify ffmpeg audio quality, insert a
1076 value between 0 (best) and 10 (worst) for
1077 VBR or a specific bitrate like 128K
1078 (default 5)
1079 --remux-video FORMAT Remux the video into another container if
1080 necessary (currently supported: mp4|mkv|flv
1081 |webm|mov|avi|mp3|mka|m4a|ogg|opus). If
1082 target container does not support the
1083 video/audio codec, remuxing will fail. You
1084 can specify multiple rules; Eg.
1085 "aac>m4a/mov>mp4/mkv" will remux aac to
1086 m4a, mov to mp4 and anything else to mkv.
1087 --recode-video FORMAT Re-encode the video into another format if
1088 re-encoding is necessary. The syntax and
1089 supported formats are the same as --remux-
1090 video
1091 --postprocessor-args NAME:ARGS Give these arguments to the postprocessors.
1092 Specify the postprocessor/executable name
1093 and the arguments separated by a colon ":"
1094 to give the argument to the specified
1095 postprocessor/executable. Supported PP are:
1096 Merger, ModifyChapters, SplitChapters,
1097 ExtractAudio, VideoRemuxer, VideoConvertor,
1098 Metadata, EmbedSubtitle, EmbedThumbnail,
1099 SubtitlesConvertor, ThumbnailsConvertor,
1100 FixupStretched, FixupM4a, FixupM3u8,
1101 FixupTimestamp and FixupDuration. The
1102 supported executables are: AtomicParsley,
1103 FFmpeg and FFprobe. You can also specify
1104 "PP+EXE:ARGS" to give the arguments to the
1105 specified executable only when being used
1106 by the specified postprocessor.
1107 Additionally, for ffmpeg/ffprobe, "_i"/"_o"
1108 can be appended to the prefix optionally
1109 followed by a number to pass the argument
1110 before the specified input/output file. Eg:
1111 --ppa "Merger+ffmpeg_i1:-v quiet". You can
1112 use this option multiple times to give
1113 different arguments to different
1114 postprocessors. (Alias: --ppa)
1115 -k, --keep-video Keep the intermediate video file on disk
1116 after post-processing
1117 --no-keep-video Delete the intermediate video file after
1118 post-processing (default)
1119 --post-overwrites Overwrite post-processed files (default)
1120 --no-post-overwrites Do not overwrite post-processed files
1121 --embed-subs Embed subtitles in the video (only for mp4,
1122 webm and mkv videos)
1123 --no-embed-subs Do not embed subtitles (default)
1124 --embed-thumbnail Embed thumbnail in the video as cover art
1125 --no-embed-thumbnail Do not embed thumbnail (default)
1126 --embed-metadata Embed metadata to the video file. Also adds
1127 chapters to file unless --no-add-chapters
1128 is used (Alias: --add-metadata)
1129 --no-embed-metadata Do not add metadata to file (default)
1130 (Alias: --no-add-metadata)
1131 --embed-chapters Add chapter markers to the video file
1132 (Alias: --add-chapters)
1133 --no-embed-chapters Do not add chapter markers (default)
1134 (Alias: --no-add-chapters)
1135 --parse-metadata FROM:TO Parse additional metadata like title/artist
1136 from other fields; see "MODIFYING METADATA"
1137 for details
1138 --replace-in-metadata FIELDS REGEX REPLACE
1139 Replace text in a metadata field using the
1140 given regex. This option can be used
1141 multiple times
1142 --xattrs Write metadata to the video file's xattrs
1143 (using dublin core and xdg standards)
1144 --fixup POLICY Automatically correct known faults of the
1145 file. One of never (do nothing), warn (only
1146 emit a warning), detect_or_warn (the
1147 default; fix file if we can, warn
1148 otherwise), force (try fixing even if file
1149 already exists
1150 --ffmpeg-location PATH Location of the ffmpeg binary; either the
1151 path to the binary or its containing
1152 directory
1153 --exec CMD Execute a command on the file after
1154 downloading and post-processing. Same
1155 syntax as the output template can be used
1156 to pass any field as arguments to the
1157 command. An additional field "filepath"
1158 that contains the final path of the
1159 downloaded file is also available. If no
1160 fields are passed, %(filepath)q is appended
1161 to the end of the command. This option can
1162 be used multiple times
1163 --no-exec Remove any previously defined --exec
1164 --exec-before-download CMD Execute a command before the actual
1165 download. The syntax is the same as --exec
1166 but "filepath" is not available. This
1167 option can be used multiple times
1168 --no-exec-before-download Remove any previously defined --exec-
1169 before-download
1170 --convert-subs FORMAT Convert the subtitles to another format
1171 (currently supported: srt|vtt|ass|lrc)
1172 (Alias: --convert-subtitles)
1173 --convert-thumbnails FORMAT Convert the thumbnails to another format
1174 (currently supported: jpg|png)
1175 --split-chapters Split video into multiple files based on
1176 internal chapters. The "chapter:" prefix
1177 can be used with "--paths" and "--output"
1178 to set the output filename for the split
1179 files. See "OUTPUT TEMPLATE" for details
1180 --no-split-chapters Do not split video based on chapters
1181 (default)
1182 --remove-chapters REGEX Remove chapters whose title matches the
1183 given regular expression. Time ranges
1184 prefixed by a "*" can also be used in place
1185 of chapters to remove the specified range.
1186 Eg: --remove-chapters "*10:15-15:00"
1187 --remove-chapters "intro". This option can
1188 be used multiple times
1189 --no-remove-chapters Do not remove any chapters from the file
1190 (default)
1191 --force-keyframes-at-cuts Force keyframes around the chapters before
1192 removing/splitting them. Requires a
1193 reencode and thus is very slow, but the
1194 resulting video may have fewer artifacts
1195 around the cuts
1196 --no-force-keyframes-at-cuts Do not force keyframes around the chapters
1197 when cutting/splitting (default)
1198 --use-postprocessor NAME[:ARGS] The (case sensitive) name of plugin
1199 postprocessors to be enabled, and
1200 (optionally) arguments to be passed to it,
1201 seperated by a colon ":". ARGS are a
1202 semicolon ";" delimited list of NAME=VALUE.
1203 The "when" argument determines when the
1204 postprocessor is invoked. It can be one of
1205 "pre_process" (after extraction),
1206 "before_dl" (before video download),
1207 "post_process" (after video download;
1208 default) or "after_move" (after moving file
1209 to their final locations). This option can
1210 be used multiple times to add different
1211 postprocessors
1212
1213 SponsorBlock Options:
1214 Make chapter entries for, or remove various segments (sponsor,
1215 introductions, etc.) from downloaded YouTube videos using the
1216 SponsorBlock API (https://sponsor.ajay.app)
1217
1218 --sponsorblock-mark CATS SponsorBlock categories to create chapters
1219 for, separated by commas. Available
1220 categories are all, sponsor, intro, outro,
1221 selfpromo, interaction, preview,
1222 music_offtopic. You can prefix the category
1223 with a "-" to exempt it. See https://wiki.s
1224 ponsor.ajay.app/index.php/Segment_Categorie
1225 s for description of the categories. Eg:
1226 --sponsorblock-mark all,-preview
1227 --sponsorblock-remove CATS SponsorBlock categories to be removed from
1228 the video file, separated by commas. If a
1229 category is present in both mark and
1230 remove, remove takes precedence. The syntax
1231 and available categories are the same as
1232 for --sponsorblock-mark
1233 --sponsorblock-chapter-title TEMPLATE
1234 The title template for SponsorBlock
1235 chapters created by --sponsorblock-mark.
1236 The same syntax as the output template is
1237 used, but the only available fields are
1238 start_time, end_time, category, categories,
1239 name, category_names. Defaults to
1240 "[SponsorBlock]: %(category_names)l"
1241 --no-sponsorblock Disable both --sponsorblock-mark and
1242 --sponsorblock-remove
1243 --sponsorblock-api URL SponsorBlock API location, defaults to
1244 https://sponsor.ajay.app
1245
1246 Extractor Options:
1247 --extractor-retries RETRIES Number of retries for known extractor
1248 errors (default is 3), or "infinite"
1249 --allow-dynamic-mpd Process dynamic DASH manifests (default)
1250 (Alias: --no-ignore-dynamic-mpd)
1251 --ignore-dynamic-mpd Do not process dynamic DASH manifests
1252 (Alias: --no-allow-dynamic-mpd)
1253 --hls-split-discontinuity Split HLS playlists to different formats at
1254 discontinuities such as ad breaks
1255 --no-hls-split-discontinuity Do not split HLS playlists to different
1256 formats at discontinuities such as ad
1257 breaks (default)
1258 --extractor-args KEY:ARGS Pass these arguments to the extractor. See
1259 "EXTRACTOR ARGUMENTS" for details. You can
1260 use this option multiple times to give
1261 arguments for different extractors
1262
1264 You can configure yt-dlp by placing any supported command line option
1265 to a configuration file. The configuration is loaded from the follow‐
1266 ing locations:
1267
1268 1. Main Configuration: The file given by --config-location
1269
1270 2. Portable Configuration: yt-dlp.conf in the same directory as the
1271 bundled binary. If you are running from source-code (<root
1272 dir>/yt_dlp/__main__.py), the root directory is used instead.
1273
1274 3. Home Configuration: yt-dlp.conf in the home path given by -P
1275 "home:<path>", or in the current directory if no such path is given
1276
1277 4. User Configuration:
1278
1279 • %XDG_CONFIG_HOME%/yt-dlp/config (recommended on Linux/macOS)
1280
1281 • %XDG_CONFIG_HOME%/yt-dlp.conf
1282
1283 • %APPDATA%/yt-dlp/config (recommended on Windows)
1284
1285 • %APPDATA%/yt-dlp/config.txt
1286
1287 • ~/yt-dlp.conf
1288
1289 • ~/yt-dlp.conf.txt %XDG_CONFIG_HOME% defaults to ~/.config if un‐
1290 defined. On windows, %APPDATA% generally points to
1291 (C:\Users\<user name>\AppData\Roaming) and ~ points to %HOME% if
1292 present, %USERPROFILE% (generally C:\Users\<user name>), or
1293 %HOMEDRIVE%%HOMEPATH%
1294
1295 5. System Configuration: /etc/yt-dlp.conf
1296
1297 For example, with the following configuration file yt-dlp will always
1298 extract the audio, not copy the mtime, use a proxy and save all videos
1299 under YouTube directory in your home directory:
1300
1301 # Lines starting with # are comments
1302
1303 # Always extract audio
1304 -x
1305
1306 # Do not copy the mtime
1307 --no-mtime
1308
1309 # Use this proxy
1310 --proxy 127.0.0.1:3128
1311
1312 # Save all videos under YouTube directory in your home directory
1313 -o ~/YouTube/%(title)s.%(ext)s
1314
1315 Note that options in configuration file are just the same options aka
1316 switches used in regular command line calls; thus there must be no
1317 whitespace after - or --, e.g. -o or --proxy but not - o or -- proxy.
1318
1319 You can use --ignore-config if you want to disable all configuration
1320 files for a particular yt-dlp run. If --ignore-config is found inside
1321 any configuration file, no further configuration will be loaded. For
1322 example, having the option in the portable configuration file prevents
1323 loading of home, user, and system configurations. Additionally, (for
1324 backward compatibility) if --ignore-config is found inside the system
1325 configuration file, the user configuration is not loaded.
1326
1327 Authentication with .netrc file
1328 You may also want to configure automatic credentials storage for ex‐
1329 tractors that support authentication (by providing login and password
1330 with --username and --password) in order not to pass credentials as
1331 command line arguments on every yt-dlp execution and prevent tracking
1332 plain text passwords in the shell command history. You can achieve
1333 this using a .netrc file (https://stackoverflow.com/tags/.netrc/info)
1334 on a per extractor basis. For that you will need to create a .netrc
1335 file in --netrc-location and restrict permissions to read/write by only
1336 you:
1337
1338 touch $HOME/.netrc
1339 chmod a-rwx,u+rw $HOME/.netrc
1340
1341 After that you can add credentials for an extractor in the following
1342 format, where extractor is the name of the extractor in lowercase:
1343
1344 machine <extractor> login <username> password <password>
1345
1346 For example:
1347
1348 machine youtube login myaccount@gmail.com password my_youtube_password
1349 machine twitch login my_twitch_account_name password my_twitch_password
1350
1351 To activate authentication with the .netrc file you should pass --netrc
1352 to yt-dlp or place it in the configuration file.
1353
1354 The default location of the .netrc file is $HOME (~) in UNIX. On Win‐
1355 dows, it is %HOME% if present, %USERPROFILE% (generally C:\Users\<user
1356 name>) or %HOMEDRIVE%%HOMEPATH%
1357
1359 The -o option is used to indicate a template for the output file names
1360 while -P option is used to specify the path each type of file should be
1361 saved to.
1362
1363 tl;dr: navigate me to examples.
1364
1365 The simplest usage of -o is not to set any template arguments when
1366 downloading a single file, like in yt-dlp -o funny_video.flv
1367 "https://some/video" (hard-coding file extension like this is not rec‐
1368 ommended and could break some post-processing).
1369
1370 It may however also contain special sequences that will be replaced
1371 when downloading each video. The special sequences may be formatted
1372 according to Python string formatting operations
1373 (https://docs.python.org/3/library/stdtypes.html#printf-style-string-
1374 formatting). For example, %(NAME)s or %(NAME)05d. To clarify, that is
1375 a percent symbol followed by a name in parentheses, followed by format‐
1376 ting operations.
1377
1378 The field names themselves (the part inside the parenthesis) can also
1379 have some special formatting: 1. Object traversal: The dictionaries
1380 and lists available in metadata can be traversed by using a . (dot)
1381 separator. You can also do python slicing using :. Eg: %(tags.0)s,
1382 %(subtitles.en.-1.ext)s, %(id.3:7:-1)s, %(formats.:.format_id)s. %()s
1383 refers to the entire infodict. Note that all the fields that become
1384 available using this method are not listed below. Use -j to see such
1385 fields 1. Addition: Addition and subtraction of numeric fields can be
1386 done using + and - respectively. Eg: %(playlist_index+10)03d, %(n_en‐
1387 tries+1-playlist_index)d 1. Date/time Formatting: Date/time fields can
1388 be formatted according to strftime formatting
1389 (https://docs.python.org/3/library/datetime.html#strftime-and-strptime-
1390 format-codes) by specifying it separated from the field name using a >.
1391 Eg: %(duration>%H-%M-%S)s, %(upload_date>%Y-%m-%d)s,
1392 %(epoch-3600>%H-%M-%S)s 1. Alternatives: Alternate fields can be spec‐
1393 ified seperated with a ,. Eg: %(release_date>%Y,upload_date>%Y|Un‐
1394 known)s 1. Default: A literal default value can be specified for when
1395 the field is empty using a | seperator. This overrides --output-na-
1396 template. Eg: %(uploader|Unknown)s 1. More Conversions: In addition
1397 to the normal format types diouxXeEfFgGcrs, B, j, l, q can be used for
1398 converting to Bytes, json (flag # for pretty-printing), a comma seper‐
1399 ated list (flag # for \n newline-seperated) and a string quoted for the
1400 terminal (flag # to split a list into different arguments), respective‐
1401 ly 1. Unicode normalization: The format type U can be used for NFC
1402 unicode normalization (https://docs.python.org/3/library/unicodeda‐
1403 ta.html#unicodedata.normalize). The alternate form flag (#) changes
1404 the normalization to NFD and the conversion flag + can be used for
1405 NFKC/NFKD compatibility equivalence normalization. Eg: %(title)+.100U
1406 is NFKC
1407
1408 To summarize, the general syntax for a field is:
1409
1410 %(name[.keys][addition][>strf][,alternate][|default])[flags][width][.precision][length]type
1411
1412 Additionally, you can set different output templates for the various
1413 metadata files separately from the general output template by specify‐
1414 ing the type of file followed by the template separated by a colon :.
1415 The different file types supported are subtitle, thumbnail, descrip‐
1416 tion, annotation (deprecated), infojson, link, pl_thumbnail, pl_de‐
1417 scription, pl_infojson, chapter. For example, -o '%(title)s.%(ext)s'
1418 -o 'thumbnail:%(title)s\%(title)s.%(ext)s' will put the thumbnails in a
1419 folder with the same name as the video. If any of the templates (ex‐
1420 cept default) is empty, that type of file will not be written. Eg:
1421 --write-thumbnail -o "thumbnail:" will write thumbnails only for
1422 playlists and not for video.
1423
1424 The available fields are:
1425
1426 • id (string): Video identifier
1427
1428 • title (string): Video title
1429
1430 • url (string): Video URL
1431
1432 • ext (string): Video filename extension
1433
1434 • alt_title (string): A secondary title of the video
1435
1436 • description (string): The description of the video
1437
1438 • display_id (string): An alternative identifier for the video
1439
1440 • uploader (string): Full name of the video uploader
1441
1442 • license (string): License name the video is licensed under
1443
1444 • creator (string): The creator of the video
1445
1446 • timestamp (numeric): UNIX timestamp of the moment the video became
1447 available
1448
1449 • upload_date (string): Video upload date (YYYYMMDD)
1450
1451 • release_date (string): The date (YYYYMMDD) when the video was re‐
1452 leased
1453
1454 • release_timestamp (numeric): UNIX timestamp of the moment the video
1455 was released
1456
1457 • uploader_id (string): Nickname or id of the video uploader
1458
1459 • channel (string): Full name of the channel the video is uploaded on
1460
1461 • channel_id (string): Id of the channel
1462
1463 • location (string): Physical location where the video was filmed
1464
1465 • duration (numeric): Length of the video in seconds
1466
1467 • duration_string (string): Length of the video (HH:mm:ss)
1468
1469 • view_count (numeric): How many users have watched the video on the
1470 platform
1471
1472 • like_count (numeric): Number of positive ratings of the video
1473
1474 • dislike_count (numeric): Number of negative ratings of the video
1475
1476 • repost_count (numeric): Number of reposts of the video
1477
1478 • average_rating (numeric): Average rating give by users, the scale
1479 used depends on the webpage
1480
1481 • comment_count (numeric): Number of comments on the video (For some
1482 extractors, comments are only downloaded at the end, and so this
1483 field cannot be used)
1484
1485 • age_limit (numeric): Age restriction for the video (years)
1486
1487 • live_status (string): One of 'is_live', 'was_live', 'is_upcoming',
1488 'not_live'
1489
1490 • is_live (boolean): Whether this video is a live stream or a fixed-
1491 length video
1492
1493 • was_live (boolean): Whether this video was originally a live stream
1494
1495 • playable_in_embed (string): Whether this video is allowed to play in
1496 embedded players on other sites
1497
1498 • availability (string): Whether the video is 'private', 'premium_on‐
1499 ly', 'subscriber_only', 'needs_auth', 'unlisted' or 'public'
1500
1501 • start_time (numeric): Time in seconds where the reproduction should
1502 start, as specified in the URL
1503
1504 • end_time (numeric): Time in seconds where the reproduction should
1505 end, as specified in the URL
1506
1507 • format (string): A human-readable description of the format
1508
1509 • format_id (string): Format code specified by --format
1510
1511 • format_note (string): Additional info about the format
1512
1513 • width (numeric): Width of the video
1514
1515 • height (numeric): Height of the video
1516
1517 • resolution (string): Textual description of width and height
1518
1519 • tbr (numeric): Average bitrate of audio and video in KBit/s
1520
1521 • abr (numeric): Average audio bitrate in KBit/s
1522
1523 • acodec (string): Name of the audio codec in use
1524
1525 • asr (numeric): Audio sampling rate in Hertz
1526
1527 • vbr (numeric): Average video bitrate in KBit/s
1528
1529 • fps (numeric): Frame rate
1530
1531 • dynamic_range (string): The dynamic range of the video
1532
1533 • vcodec (string): Name of the video codec in use
1534
1535 • container (string): Name of the container format
1536
1537 • filesize (numeric): The number of bytes, if known in advance
1538
1539 • filesize_approx (numeric): An estimate for the number of bytes
1540
1541 • protocol (string): The protocol that will be used for the actual
1542 download
1543
1544 • extractor (string): Name of the extractor
1545
1546 • extractor_key (string): Key name of the extractor
1547
1548 • epoch (numeric): Unix epoch when creating the file
1549
1550 • autonumber (numeric): Number that will be increased with each down‐
1551 load, starting at --autonumber-start
1552
1553 • n_entries (numeric): Total number of extracted items in the playlist
1554
1555 • playlist (string): Name or id of the playlist that contains the video
1556
1557 • playlist_index (numeric): Index of the video in the playlist padded
1558 with leading zeros according the final index
1559
1560 • playlist_autonumber (numeric): Position of the video in the playlist
1561 download queue padded with leading zeros according to the total
1562 length of the playlist
1563
1564 • playlist_id (string): Playlist identifier
1565
1566 • playlist_title (string): Playlist title
1567
1568 • playlist_uploader (string): Full name of the playlist uploader
1569
1570 • playlist_uploader_id (string): Nickname or id of the playlist upload‐
1571 er
1572
1573 • webpage_url (string): A URL to the video webpage which if given to
1574 yt-dlp should allow to get the same result again
1575
1576 • original_url (string): The URL given by the user (or same as web‐
1577 page_url for playlist entries)
1578
1579 Available for the video that belongs to some logical chapter or sec‐
1580 tion:
1581
1582 • chapter (string): Name or title of the chapter the video belongs to
1583
1584 • chapter_number (numeric): Number of the chapter the video belongs to
1585
1586 • chapter_id (string): Id of the chapter the video belongs to
1587
1588 Available for the video that is an episode of some series or programme:
1589
1590 • series (string): Title of the series or programme the video episode
1591 belongs to
1592
1593 • season (string): Title of the season the video episode belongs to
1594
1595 • season_number (numeric): Number of the season the video episode be‐
1596 longs to
1597
1598 • season_id (string): Id of the season the video episode belongs to
1599
1600 • episode (string): Title of the video episode
1601
1602 • episode_number (numeric): Number of the video episode within a season
1603
1604 • episode_id (string): Id of the video episode
1605
1606 Available for the media that is a track or a part of a music album:
1607
1608 • track (string): Title of the track
1609
1610 • track_number (numeric): Number of the track within an album or a disc
1611
1612 • track_id (string): Id of the track
1613
1614 • artist (string): Artist(s) of the track
1615
1616 • genre (string): Genre(s) of the track
1617
1618 • album (string): Title of the album the track belongs to
1619
1620 • album_type (string): Type of the album
1621
1622 • album_artist (string): List of all artists appeared on the album
1623
1624 • disc_number (numeric): Number of the disc or other physical medium
1625 the track belongs to
1626
1627 • release_year (numeric): Year (YYYY) when the album was released
1628
1629 Available for chapter: prefix when using --split-chapters for videos
1630 with internal chapters:
1631
1632 • section_title (string): Title of the chapter
1633
1634 • section_number (numeric): Number of the chapter within the file
1635
1636 • section_start (numeric): Start time of the chapter in seconds
1637
1638 • section_end (numeric): End time of the chapter in seconds
1639
1640 Available only when used in --print:
1641
1642 • urls (string): The URLs of all requested formats, one in each line
1643
1644 • filename (string): Name of the video file. Note that the actual
1645 filename may be different due to post-processing. Use --exec echo to
1646 get the name after all postprocessing is complete
1647
1648 Available only in --sponsorblock-chapter-title:
1649
1650 • start_time (numeric): Start time of the chapter in seconds
1651
1652 • end_time (numeric): End time of the chapter in seconds
1653
1654 • categories (list): The SponsorBlock categories the chapter belongs to
1655
1656 • category (string): The smallest SponsorBlock category the chapter be‐
1657 longs to
1658
1659 • category_names (list): Friendly names of the categories
1660
1661 • name (string): Friendly name of the smallest category
1662
1663 Each aforementioned sequence when referenced in an output template will
1664 be replaced by the actual value corresponding to the sequence name.
1665 For example for -o %(title)s-%(id)s.%(ext)s and an mp4 video with title
1666 yt-dlp test video and id BaW_jenozKc, this will result in a yt-dlp test
1667 video-BaW_jenozKc.mp4 file created in the current directory.
1668
1669 Note that some of the sequences are not guaranteed to be present since
1670 they depend on the metadata obtained by a particular extractor. Such
1671 sequences will be replaced with placeholder value provided with --out‐
1672 put-na-placeholder (NA by default).
1673
1674 Tip: Look at the -j output to identify which fields are available for
1675 the particular URL
1676
1677 For numeric sequences you can use numeric related formatting
1678 (https://docs.python.org/3/library/stdtypes.html#printf-style-string-
1679 formatting), for example, %(view_count)05d will result in a string with
1680 view count padded with zeros up to 5 characters, like in 00042.
1681
1682 Output templates can also contain arbitrary hierarchical path, e.g. -o
1683 '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' which will result
1684 in downloading each video in a directory corresponding to this path
1685 template. Any missing directory will be automatically created for you.
1686
1687 To use percent literals in an output template use %%. To output to
1688 stdout use -o -.
1689
1690 The current default template is %(title)s [%(id)s].%(ext)s.
1691
1692 In some cases, you don't want special characters such as 中, spaces, or
1693 &, such as when transferring the downloaded filename to a Windows sys‐
1694 tem or the filename through an 8bit-unsafe channel. In these cases,
1695 add the --restrict-filenames flag to get a shorter title:
1696
1697 Output template and Windows batch files
1698 If you are using an output template inside a Windows batch file then
1699 you must escape plain percent characters (%) by doubling, so that -o
1700 "%(title)s-%(id)s.%(ext)s" should become -o "%%(ti‐
1701 tle)s-%%(id)s.%%(ext)s". However you should not touch %'s that are not
1702 plain characters, e.g. environment variables for expansion should stay
1703 intact: -o "C:\%HOMEPATH%\Desktop\%%(title)s.%%(ext)s".
1704
1705 Output template examples
1706 Note that on Windows you need to use double quotes instead of single.
1707
1708 $ yt-dlp --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc
1709 youtube-dl test video ''_ä↭𝕐.mp4 # All kinds of weird characters
1710
1711 $ yt-dlp --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc --restrict-filenames
1712 youtube-dl_test_video_.mp4 # A simple file name
1713
1714 # Download YouTube playlist videos in separate directory indexed by video order in a playlist
1715 $ yt-dlp -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
1716
1717 # Download YouTube playlist videos in separate directories according to their uploaded year
1718 $ yt-dlp -o '%(upload_date>%Y)s/%(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
1719
1720 # Download all playlists of YouTube channel/user keeping each playlist in separate directory:
1721 $ yt-dlp -o '%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/user/TheLinuxFoundation/playlists
1722
1723 # Download Udemy course keeping each chapter in separate directory under MyVideos directory in your home
1724 $ yt-dlp -u user -p password -P '~/MyVideos' -o '%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s' https://www.udemy.com/java-tutorial/
1725
1726 # Download entire series season keeping each series and each season in separate directory under C:/MyVideos
1727 $ yt-dlp -P "C:/MyVideos" -o "%(series)s/%(season_number)s - %(season)s/%(episode_number)s - %(episode)s.%(ext)s" https://videomore.ru/kino_v_detalayah/5_sezon/367617
1728
1729 # Stream the video being downloaded to stdout
1730 $ yt-dlp -o - BaW_jenozKc
1731
1733 By default, yt-dlp tries to download the best available quality if you
1734 don't pass any options. This is generally equivalent to using -f
1735 bestvideo*+bestaudio/best. However, if multiple audiostreams is en‐
1736 abled (--audio-multistreams), the default format changes to -f
1737 bestvideo+bestaudio/best. Similarly, if ffmpeg is unavailable, or if
1738 you use yt-dlp to stream to stdout (-o -), the default becomes -f
1739 best/bestvideo+bestaudio.
1740
1741 Deprecation warning: Latest versions of yt-dlp can stream multiple for‐
1742 mats to the stdout simultaneously using ffmpeg. So, in future ver‐
1743 sions, the default for this will be set to -f bv*+ba/b similar to nor‐
1744 mal downloads. If you want to preserve the -f b/bv+ba setting, it is
1745 recommended to explicitly specify it in the configuration options.
1746
1747 The general syntax for format selection is -f FORMAT (or --format FOR‐
1748 MAT) where FORMAT is a selector expression, i.e. an expression that
1749 describes format or formats you would like to download.
1750
1751 tl;dr: navigate me to examples.
1752
1753 The simplest case is requesting a specific format, for example with -f
1754 22 you can download the format with format code equal to 22. You can
1755 get the list of available format codes for particular video using
1756 --list-formats or -F. Note that these format codes are extractor spe‐
1757 cific.
1758
1759 You can also use a file extension (currently 3gp, aac, flv, m4a, mp3,
1760 mp4, ogg, wav, webm are supported) to download the best quality format
1761 of a particular file extension served as a single file, e.g. -f webm
1762 will download the best quality format with the webm extension served as
1763 a single file.
1764
1765 You can also use special names to select particular edge case formats:
1766
1767 • all: Select all formats separately
1768
1769 • mergeall: Select and merge all formats (Must be used with --audio-
1770 multistreams, --video-multistreams or both)
1771
1772 • b*, best*: Select the best quality format that contains either a
1773 video or an audio
1774
1775 • b, best: Select the best quality format that contains both video and
1776 audio. Equivalent to best*[vcodec!=none][acodec!=none]
1777
1778 • bv, bestvideo: Select the best quality video-only format. Equivalent
1779 to best*[acodec=none]
1780
1781 • bv*, bestvideo*: Select the best quality format that contains video.
1782 It may also contain audio. Equivalent to best*[vcodec!=none]
1783
1784 • ba, bestaudio: Select the best quality audio-only format. Equivalent
1785 to best*[vcodec=none]
1786
1787 • ba*, bestaudio*: Select the best quality format that contains audio.
1788 It may also contain video. Equivalent to best*[acodec!=none]
1789
1790 • w*, worst*: Select the worst quality format that contains either a
1791 video or an audio
1792
1793 • w, worst: Select the worst quality format that contains both video
1794 and audio. Equivalent to worst*[vcodec!=none][acodec!=none]
1795
1796 • wv, worstvideo: Select the worst quality video-only format. Equiva‐
1797 lent to worst*[acodec=none]
1798
1799 • wv*, worstvideo*: Select the worst quality format that contains
1800 video. It may also contain audio. Equivalent to
1801 worst*[vcodec!=none]
1802
1803 • wa, worstaudio: Select the worst quality audio-only format. Equiva‐
1804 lent to worst*[vcodec=none]
1805
1806 • wa*, worstaudio*: Select the worst quality format that contains au‐
1807 dio. It may also contain video. Equivalent to worst*[acodec!=none]
1808
1809 For example, to download the worst quality video-only format you can
1810 use -f worstvideo. It is however recommended not to use worst and re‐
1811 lated options. When your format selector is worst, the format which is
1812 worst in all respects is selected. Most of the time, what you actually
1813 want is the video with the smallest filesize instead. So it is gener‐
1814 ally better to use -f best -S +size,+br,+res,+fps instead of -f worst.
1815 See sorting formats for more details.
1816
1817 You can select the n'th best format of a type by using best<type>.<n>.
1818 For example, best.2 will select the 2nd best combined format. Similar‐
1819 ly, bv*.3 will select the 3rd best format that contains a video stream.
1820
1821 If you want to download multiple videos and they don't have the same
1822 formats available, you can specify the order of preference using slash‐
1823 es. Note that formats on the left hand side are preferred, for example
1824 -f 22/17/18 will download format 22 if it's available, otherwise it
1825 will download format 17 if it's available, otherwise it will download
1826 format 18 if it's available, otherwise it will complain that no suit‐
1827 able formats are available for download.
1828
1829 If you want to download several formats of the same video use a comma
1830 as a separator, e.g. -f 22,17,18 will download all these three for‐
1831 mats, of course if they are available. Or a more sophisticated example
1832 combined with the precedence feature: -f
1833 136/137/mp4/bestvideo,140/m4a/bestaudio.
1834
1835 You can merge the video and audio of multiple formats into a single
1836 file using -f <format1>+<format2>+... (requires ffmpeg installed), for
1837 example -f bestvideo+bestaudio will download the best video-only for‐
1838 mat, the best audio-only format and mux them together with ffmpeg.
1839
1840 Deprecation warning: Since the below described behavior is complex and
1841 counter-intuitive, this will be removed and multistreams will be en‐
1842 abled by default in the future. A new operator will be instead added
1843 to limit formats to single audio/video
1844
1845 Unless --video-multistreams is used, all formats with a video stream
1846 except the first one are ignored. Similarly, unless --audio-multi‐
1847 streams is used, all formats with an audio stream except the first one
1848 are ignored. For example, -f bestvideo+best+bestaudio --video-multi‐
1849 streams --audio-multistreams will download and merge all 3 given for‐
1850 mats. The resulting file will have 2 video streams and 2 audio
1851 streams. But -f bestvideo+best+bestaudio --no-video-multistreams will
1852 download and merge only bestvideo and bestaudio. best is ignored since
1853 another format containing a video stream (bestvideo) has already been
1854 selected. The order of the formats is therefore important. -f
1855 best+bestaudio --no-audio-multistreams will download and merge both
1856 formats while -f bestaudio+best --no-audio-multistreams will ignore
1857 best and download only bestaudio.
1858
1859 Filtering Formats
1860 You can also filter the video formats by putting a condition in brack‐
1861 ets, as in -f "best[height=720]" (or -f "[filesize>10M]").
1862
1863 The following numeric meta fields can be used with comparisons <, <=,
1864 >, >=, = (equals), != (not equals):
1865
1866 • filesize: The number of bytes, if known in advance
1867
1868 • width: Width of the video, if known
1869
1870 • height: Height of the video, if known
1871
1872 • tbr: Average bitrate of audio and video in KBit/s
1873
1874 • abr: Average audio bitrate in KBit/s
1875
1876 • vbr: Average video bitrate in KBit/s
1877
1878 • asr: Audio sampling rate in Hertz
1879
1880 • fps: Frame rate
1881
1882 Also filtering work for comparisons = (equals), ^= (starts with), $=
1883 (ends with), *= (contains) and following string meta fields:
1884
1885 • ext: File extension
1886
1887 • acodec: Name of the audio codec in use
1888
1889 • vcodec: Name of the video codec in use
1890
1891 • container: Name of the container format
1892
1893 • protocol: The protocol that will be used for the actual download,
1894 lower-case (http, https, rtsp, rtmp, rtmpe, mms, f4m, ism,
1895 http_dash_segments, m3u8, or m3u8_native)
1896
1897 • format_id: A short description of the format
1898
1899 • language: Language code
1900
1901 Any string comparison may be prefixed with negation ! in order to pro‐
1902 duce an opposite comparison, e.g. !*= (does not contain).
1903
1904 Note that none of the aforementioned meta fields are guaranteed to be
1905 present since this solely depends on the metadata obtained by particu‐
1906 lar extractor, i.e. the metadata offered by the website. Any other
1907 field made available by the extractor can also be used for filtering.
1908
1909 Formats for which the value is not known are excluded unless you put a
1910 question mark (?) after the operator. You can combine format filters,
1911 so -f "[height<=?720][tbr>500]" selects up to 720p videos (or videos
1912 where the height is not known) with a bitrate of at least 500 KBit/s.
1913 You can also use the filters with all to download all formats that sat‐
1914 isfy the filter. For example, -f "all[vcodec=none]" selects all audio-
1915 only formats.
1916
1917 Format selectors can also be grouped using parentheses, for example if
1918 you want to download the best mp4 and webm formats with a height lower
1919 than 480 you can use -f '(mp4,webm)[height<480]'.
1920
1921 Sorting Formats
1922 You can change the criteria for being considered the best by using -S
1923 (--format-sort). The general format for this is --format-sort
1924 field1,field2....
1925
1926 The available fields are:
1927
1928 • hasvid: Gives priority to formats that has a video stream
1929
1930 • hasaud: Gives priority to formats that has a audio stream
1931
1932 • ie_pref: The format preference as given by the extractor
1933
1934 • lang: Language preference as given by the extractor
1935
1936 • quality: The quality of the format as given by the extractor
1937
1938 • source: Preference of the source as given by the extractor
1939
1940 • proto: Protocol used for download (https/ftps > http/ftp > m3u8_na‐
1941 tive/m3u8 > http_dash_segments> websocket_frag > other > mms/rtsp >
1942 unknown > f4f/f4m)
1943
1944 • vcodec: Video Codec (av01 > vp9.2 > vp9 > h265 > h264 > vp8 > h263 >
1945 theora > other > unknown)
1946
1947 • acodec: Audio Codec (opus > vorbis > aac > mp4a > mp3 > eac3 > ac3 >
1948 dts > other > unknown)
1949
1950 • codec: Equivalent to vcodec,acodec
1951
1952 • vext: Video Extension (mp4 > webm > flv > other > unknown). If
1953 --prefer-free-formats is used, webm is prefered.
1954
1955 • aext: Audio Extension (m4a > aac > mp3 > ogg > opus > webm > other >
1956 unknown). If --prefer-free-formats is used, the order changes to
1957 opus > ogg > webm > m4a > mp3 > aac.
1958
1959 • ext: Equivalent to vext,aext
1960
1961 • filesize: Exact filesize, if known in advance
1962
1963 • fs_approx: Approximate filesize calculated from the manifests
1964
1965 • size: Exact filesize if available, otherwise approximate filesize
1966
1967 • height: Height of video
1968
1969 • width: Width of video
1970
1971 • res: Video resolution, calculated as the smallest dimension.
1972
1973 • fps: Framerate of video
1974
1975 • hdr: The dynamic range of the video (DV > HDR12 > HDR10+ > HDR10 >
1976 HLG > SDR)
1977
1978 • tbr: Total average bitrate in KBit/s
1979
1980 • vbr: Average video bitrate in KBit/s
1981
1982 • abr: Average audio bitrate in KBit/s
1983
1984 • br: Equivalent to using tbr,vbr,abr
1985
1986 • asr: Audio sample rate in Hz
1987
1988 Deprecation warning: Many of these fields have (currently undocumented)
1989 aliases, that may be removed in a future version. It is recommended to
1990 use only the documented field names.
1991
1992 All fields, unless specified otherwise, are sorted in descending order.
1993 To reverse this, prefix the field with a +. Eg: +res prefers format
1994 with the smallest resolution. Additionally, you can suffix a preferred
1995 value for the fields, separated by a :. Eg: res:720 prefers larger
1996 videos, but no larger than 720p and the smallest video if there are no
1997 videos less than 720p. For codec and ext, you can provide two pre‐
1998 ferred values, the first for video and the second for audio. Eg:
1999 +codec:avc:m4a (equivalent to +vcodec:avc,+acodec:m4a) sets the video
2000 codec preference to h264 > h265 > vp9 > vp9.2 > av01 > vp8 > h263 >
2001 theora and audio codec preference to mp4a > aac > vorbis > opus > mp3 >
2002 ac3 > dts. You can also make the sorting prefer the nearest values to
2003 the provided by using ~ as the delimiter. Eg: filesize~1G prefers the
2004 format with filesize closest to 1 GiB.
2005
2006 The fields hasvid and ie_pref are always given highest priority in
2007 sorting, irrespective of the user-defined order. This behaviour can be
2008 changed by using --format-sort-force. Apart from these, the default
2009 order used is: lang,quality,res,fps,hdr:12,codec:vp9.2,size,br,asr,pro‐
2010 to,ext,hasaud,source,id. The extractors may override this default or‐
2011 der, but they cannot override the user-provided order.
2012
2013 Note that the default has codec:vp9.2; i.e. av1 is not prefered. Sim‐
2014 ilarly, the default for hdr is hdr:12; i.e. dolby vision is not pref‐
2015 ered. These choices are made since DV and AV1 formats are not yet ful‐
2016 ly compatible with most devices. This may be changed in the future as
2017 more devices become capable of smoothly playing back these formats.
2018
2019 If your format selector is worst, the last item is selected after sort‐
2020 ing. This means it will select the format that is worst in all re‐
2021 spects. Most of the time, what you actually want is the video with the
2022 smallest filesize instead. So it is generally better to use -f best -S
2023 +size,+br,+res,+fps.
2024
2025 Tip: You can use the -v -F to see how the formats have been sorted
2026 (worst to best).
2027
2028 Format Selection examples
2029 Note that on Windows you may need to use double quotes instead of sin‐
2030 gle.
2031
2032 # Download and merge the best video-only format and the best audio-only format,
2033 # or download the best combined format if video-only format is not available
2034 $ yt-dlp -f 'bv+ba/b'
2035
2036 # Download best format that contains video,
2037 # and if it doesn't already have an audio stream, merge it with best audio-only format
2038 $ yt-dlp -f 'bv*+ba/b'
2039
2040 # Same as above
2041 $ yt-dlp
2042
2043 # Download the best video-only format and the best audio-only format without merging them
2044 # For this case, an output template should be used since
2045 # by default, bestvideo and bestaudio will have the same file name.
2046 $ yt-dlp -f 'bv,ba' -o '%(title)s.f%(format_id)s.%(ext)s'
2047
2048 # Download and merge the best format that has a video stream,
2049 # and all audio-only formats into one file
2050 $ yt-dlp -f 'bv*+mergeall[vcodec=none]' --audio-multistreams
2051
2052 # Download and merge the best format that has a video stream,
2053 # and the best 2 audio-only formats into one file
2054 $ yt-dlp -f 'bv*+ba+ba.2' --audio-multistreams
2055
2056
2057 # The following examples show the old method (without -S) of format selection
2058 # and how to use -S to achieve a similar but (generally) better result
2059
2060 # Download the worst video available (old method)
2061 $ yt-dlp -f 'wv*+wa/w'
2062
2063 # Download the best video available but with the smallest resolution
2064 $ yt-dlp -S '+res'
2065
2066 # Download the smallest video available
2067 $ yt-dlp -S '+size,+br'
2068
2069
2070
2071 # Download the best mp4 video available, or the best video if no mp4 available
2072 $ yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b'
2073
2074 # Download the best video with the best extension
2075 # (For video, mp4 > webm > flv. For audio, m4a > aac > mp3 ...)
2076 $ yt-dlp -S 'ext'
2077
2078
2079
2080 # Download the best video available but no better than 480p,
2081 # or the worst video if there is no video under 480p
2082 $ yt-dlp -f 'bv*[height<=480]+ba/b[height<=480] / wv*+ba/w'
2083
2084 # Download the best video available with the largest height but no better than 480p,
2085 # or the best video with the smallest resolution if there is no video under 480p
2086 $ yt-dlp -S 'height:480'
2087
2088 # Download the best video available with the largest resolution but no better than 480p,
2089 # or the best video with the smallest resolution if there is no video under 480p
2090 # Resolution is determined by using the smallest dimension.
2091 # So this works correctly for vertical videos as well
2092 $ yt-dlp -S 'res:480'
2093
2094
2095
2096 # Download the best video (that also has audio) but no bigger than 50 MB,
2097 # or the worst video (that also has audio) if there is no video under 50 MB
2098 $ yt-dlp -f 'b[filesize<50M] / w'
2099
2100 # Download largest video (that also has audio) but no bigger than 50 MB,
2101 # or the smallest video (that also has audio) if there is no video under 50 MB
2102 $ yt-dlp -f 'b' -S 'filesize:50M'
2103
2104 # Download best video (that also has audio) that is closest in size to 50 MB
2105 $ yt-dlp -f 'b' -S 'filesize~50M'
2106
2107
2108
2109 # Download best video available via direct link over HTTP/HTTPS protocol,
2110 # or the best video available via any protocol if there is no such video
2111 $ yt-dlp -f '(bv*+ba/b)[protocol^=http][protocol!*=dash] / (bv*+ba/b)'
2112
2113 # Download best video available via the best protocol
2114 # (https/ftps > http/ftp > m3u8_native > m3u8 > http_dash_segments ...)
2115 $ yt-dlp -S 'proto'
2116
2117
2118
2119 # Download the best video with h264 codec, or the best video if there is no such video
2120 $ yt-dlp -f '(bv*+ba/b)[vcodec^=avc1] / (bv*+ba/b)'
2121
2122 # Download the best video with best codec no better than h264,
2123 # or the best video with worst codec if there is no such video
2124 $ yt-dlp -S 'codec:h264'
2125
2126 # Download the best video with worst codec no worse than h264,
2127 # or the best video with best codec if there is no such video
2128 $ yt-dlp -S '+codec:h264'
2129
2130
2131
2132 # More complex examples
2133
2134 # Download the best video no better than 720p preferring framerate greater than 30,
2135 # or the worst video (still preferring framerate greater than 30) if there is no such video
2136 $ yt-dlp -f '((bv*[fps>30]/bv*)[height<=720]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=720]/(w[fps>30]/w)'
2137
2138 # Download the video with the largest resolution no better than 720p,
2139 # or the video with the smallest resolution available if there is no such video,
2140 # preferring larger framerate for formats with the same resolution
2141 $ yt-dlp -S 'res:720,fps'
2142
2143
2144
2145 # Download the video with smallest resolution no worse than 480p,
2146 # or the video with the largest resolution available if there is no such video,
2147 # preferring better codec and then larger total bitrate for the same resolution
2148 $ yt-dlp -S '+res:480,codec,br'
2149
2151 The metadata obtained by the extractors can be modified by using
2152 --parse-metadata and --replace-in-metadata
2153
2154 --replace-in-metadata FIELDS REGEX REPLACE is used to replace text in
2155 any metadata field using python regular expression
2156 (https://docs.python.org/3/library/re.html#regular-expression-syntax).
2157 Backreferences (https://docs.python.org/3/library/re.html?high‐
2158 light=backreferences#re.sub) can be used in the replace string for ad‐
2159 vanced use.
2160
2161 The general syntax of --parse-metadata FROM:TO is to give the name of a
2162 field or an output template to extract data from, and the format to in‐
2163 terpret it as, separated by a colon :. Either a python regular expres‐
2164 sion (https://docs.python.org/3/library/re.html#regular-expression-syn‐
2165 tax) with named capture groups or a similar syntax to the output tem‐
2166 plate (only %(field)s formatting is supported) can be used for TO. The
2167 option can be used multiple times to parse and modify various fields.
2168
2169 Note that any field created by this can be used in the output template
2170 and will also affect the media file's metadata added when using --add-
2171 metadata.
2172
2173 This option also has a few special uses: * You can download an addi‐
2174 tional URL based on the metadata of the currently downloaded video. To
2175 do this, set the field additional_urls to the URL that you want to
2176 download. Eg: --parse-metadata "description:(?P<addition‐
2177 al_urls>https?://www\.vimeo\.com/\d+) will download the first vimeo
2178 video found in the description * You can use this to change the metada‐
2179 ta that is embedded in the media file. To do this, set the value of
2180 the corresponding field with a meta_ prefix. For example, any value
2181 you set to meta_description field will be added to the description
2182 field in the file. For example, you can use this to set a different
2183 "description" and "synopsis". Any value set to the meta_ field will
2184 overwrite all default values.
2185
2186 For reference, these are the fields yt-dlp adds by default to the file
2187 metadata:
2188
2189 Metadata fields From
2190 ─────────────────────────────────────────────────────
2191 title track or title
2192 date upload_date
2193 description, synopsis description
2194 purl, comment webpage_url
2195 track track_number
2196 artist artist, creator, uploader
2197 or uploader_id
2198 genre genre
2199
2200 album album
2201 album_artist album_artist
2202 disc disc_number
2203 show series
2204 season_number season_number
2205 episode_id episode or episode_id
2206 episode_sort episode_number
2207 language of each stream From the format's language
2208
2209 Note: The file format may not support some of these fields
2210
2211 Modifying metadata examples
2212 Note that on Windows you may need to use double quotes instead of sin‐
2213 gle.
2214
2215 # Interpret the title as "Artist - Title"
2216 $ yt-dlp --parse-metadata 'title:%(artist)s - %(title)s'
2217
2218 # Regex example
2219 $ yt-dlp --parse-metadata 'description:Artist - (?P<artist>.+)'
2220
2221 # Set title as "Series name S01E05"
2222 $ yt-dlp --parse-metadata '%(series)s S%(season_number)02dE%(episode_number)02d:%(title)s'
2223
2224 # Set "comment" field in video metadata using description instead of webpage_url
2225 $ yt-dlp --parse-metadata 'description:(?s)(?P<meta_comment>.+)' --add-metadata
2226
2227 # Remove "formats" field from the infojson by setting it to an empty string
2228 $ yt-dlp --parse-metadata ':(?P<formats>)' -j
2229
2230 # Replace all spaces and "_" in title and uploader with a `-`
2231 $ yt-dlp --replace-in-metadata 'title,uploader' '[ _]' '-'
2232
2234 Some extractors accept additional arguments which can be passed using
2235 --extractor-args KEY:ARGS. ARGS is a ; (semicolon) separated string of
2236 ARG=VAL1,VAL2. Eg: --extractor-args "youtube:player-client=an‐
2237 droid_agegate,web;include_live_dash" --extractor-args "funimation:ver‐
2238 sion=uncut"
2239
2240 The following extractors use this feature:
2241
2242 youtube
2243 • skip: hls or dash (or both) to skip download of the respective mani‐
2244 fests
2245
2246 • player_client: Clients to extract video data from. The main clients
2247 are web, android, ios, mweb. These also have _music, _embedded,
2248 _agegate, and _creator variants (Eg: web_embedded) (mweb has only
2249 _agegate). By default, android,web is used, but the agegate and cre‐
2250 ator variants are added as required for age-gated videos. Similarly
2251 the music variants are added for music.youtube.com urls. You can al‐
2252 so use all to use all the clients
2253
2254 • player_skip: Skip some network requests that are generally needed for
2255 robust extraction. One or more of configs (skip client configs),
2256 webpage (skip initial webpage), js (skip js player). While these op‐
2257 tions can help reduce the number of requests needed or avoid some
2258 rate-limiting, they could cause some issues. See #860
2259 (https://github.com/yt-dlp/yt-dlp/pull/860) for more details
2260
2261 • include_live_dash: Include live dash formats (These formats don't
2262 download properly)
2263
2264 • comment_sort: top or new (default) - choose comment sorting mode (on
2265 YouTube's side)
2266
2267 • max_comments: Maximum amount of comments to download (default all)
2268
2269 • max_comment_depth: Maximum depth for nested comments. YouTube sup‐
2270 ports depths 1 or 2 (default)
2271
2272 youtubetab (YouTube playlists, channels, feeds, etc.)
2273 • skip: One or more of webpage (skip initial webpage download), au‐
2274 thcheck (allow the download of playlists requiring authentication
2275 when no initial webpage is downloaded. This may cause unwanted be‐
2276 havior, see #1122 (https://github.com/yt-dlp/yt-dlp/pull/1122) for
2277 more details)
2278
2279 funimation
2280 • language: Languages to extract. Eg: funimation:language=english,ja‐
2281 panese
2282
2283 • version: The video version to extract - uncut or simulcast
2284
2285 crunchyroll
2286 • language: Languages to extract. Eg: crunchyroll:language=jaJp
2287
2288 • hardsub: Which hard-sub versions to extract. Eg: crunchyroll:hard‐
2289 sub=None,enUS
2290
2291 vikichannel
2292 • video_types: Types of videos to download - one or more of episodes,
2293 movies, clips, trailers
2294
2295 NOTE: These options may be changed/removed in the future without con‐
2296 cern for backward compatibility
2297
2299 Plugins are loaded from <root-dir>/ytdlp_plugins/<type>/__init__.py;
2300 where <root-dir> is the directory of the binary (<root-dir>/yt-dlp), or
2301 the root directory of the module if you are running directly from
2302 source-code (<root dir>/yt_dlp/__main__.py). Plugins are currently not
2303 supported for the pip version
2304
2305 Plugins can be of <type>s extractor or postprocessor. Extractor plug‐
2306 ins do not need to be enabled from the CLI and are automatically in‐
2307 voked when the input URL is suitable for it. Postprocessor plugins can
2308 be invoked using --use-postprocessor NAME.
2309
2310 See ytdlp_plugins for example plugins.
2311
2312 Note that all plugins are imported even if not invoked, and that there
2313 are no checks performed on plugin code. Use plugins at your own risk
2314 and only if you trust the code
2315
2316 If you are a plugin author, add ytdlp-plugins (https://github.com/top‐
2317 ics/ytdlp-plugins) as a topic to your repository for discoverability
2318
2320 yt-dlp makes the best effort to be a good command-line program, and
2321 thus should be callable from any programming language.
2322
2323 Your program should avoid parsing the normal stdout since they may
2324 change in future versions. Instead they should use options such as -J,
2325 --print, --progress-template, --exec etc to create console output that
2326 you can reliably reproduce and parse.
2327
2328 From a Python program, you can embed yt-dlp in a more powerful fashion,
2329 like this:
2330
2331 from yt_dlp import YoutubeDL
2332
2333 ydl_opts = {}
2334 with YoutubeDL(ydl_opts) as ydl:
2335 ydl.download(['https://www.youtube.com/watch?v=BaW_jenozKc'])
2336
2337 Most likely, you'll want to use various options. For a list of options
2338 available, have a look at yt_dlp/YoutubeDL.py.
2339
2340 Here's a more complete example of a program that outputs only errors
2341 (and a short message after the download is finished), converts the
2342 video to an mp3 file, implements a custom postprocessor and prints the
2343 final info_dict as json:
2344
2345 import json
2346 import yt_dlp
2347
2348
2349 class MyLogger:
2350 def debug(self, msg):
2351 # For compatability with youtube-dl, both debug and info are passed into debug
2352 # You can distinguish them by the prefix '[debug] '
2353 if msg.startswith('[debug] '):
2354 pass
2355 else:
2356 self.info(msg)
2357
2358 def info(self, msg):
2359 pass
2360
2361 def warning(self, msg):
2362 pass
2363
2364 def error(self, msg):
2365 print(msg)
2366
2367
2368 class MyCustomPP(yt_dlp.postprocessor.PostProcessor):
2369 def run(self, info):
2370 self.to_screen('Doing stuff')
2371 return [], info
2372
2373
2374 def my_hook(d):
2375 if d['status'] == 'finished':
2376 print('Done downloading, now converting ...')
2377
2378
2379 ydl_opts = {
2380 'format': 'bestaudio/best',
2381 'postprocessors': [{
2382 'key': 'FFmpegExtractAudio',
2383 'preferredcodec': 'mp3',
2384 'preferredquality': '192',
2385 }],
2386 'logger': MyLogger(),
2387 'progress_hooks': [my_hook],
2388 }
2389
2390
2391 # Add custom headers
2392 yt_dlp.utils.std_headers.update({'Referer': 'https://www.google.com'})
2393
2394 with yt_dlp.YoutubeDL(ydl_opts) as ydl:
2395 ydl.add_post_processor(MyCustomPP())
2396 info = ydl.extract_info('https://www.youtube.com/watch?v=BaW_jenozKc')
2397 print(json.dumps(ydl.sanitize_info(info)))
2398
2399 See the public functions in yt_dlp/YoutubeDL.py for other available
2400 functions. Eg: ydl.download, ydl.download_with_info_file
2401
2402 Tip: If you are porting your code from youtube-dl to yt-dlp, one impor‐
2403 tant point to look out for is that we do not guarantee the return value
2404 of YoutubeDL.extract_info to be json serializable, or even be a dictio‐
2405 nary. It will be dictionary-like, but if you want to ensure it is a
2406 serializable dictionary, pass it through YoutubeDL.sanitize_info as
2407 shown in the example above
2408
2410 These are all the deprecated options and the current alternative to
2411 achieve the same effect
2412
2413 Redundant options
2414 While these options are redundant, they are still expected to be used
2415 due to their ease of use
2416
2417 --get-description --print description
2418 --get-duration --print duration_string
2419 --get-filename --print filename
2420 --get-format --print format
2421 --get-id --print id
2422 --get-thumbnail --print thumbnail
2423 -e, --get-title --print title
2424 -g, --get-url --print urls
2425 -j, --dump-json --print "%()j"
2426 --match-title REGEX --match-filter "title ~= (?i)REGEX"
2427 --reject-title REGEX --match-filter "title !~= (?i)REGEX"
2428 --min-views COUNT --match-filter "view_count >=? COUNT"
2429 --max-views COUNT --match-filter "view_count <=? COUNT"
2430
2431 Not recommended
2432 While these options still work, their use is not recommended since
2433 there are other alternatives to achieve the same
2434
2435 --all-formats -f all
2436 --all-subs --sub-langs all --write-subs
2437 --print-json -j --no-simulate
2438 --autonumber-size NUMBER Use string formatting. Eg: %(autonumber)03d
2439 --autonumber-start NUMBER Use internal field formatting like %(autonumber+NUMBER)s
2440 --id -o "%(id)s.%(ext)s"
2441 --metadata-from-title FORMAT --parse-metadata "%(title)s:FORMAT"
2442 --hls-prefer-native --downloader "m3u8:native"
2443 --hls-prefer-ffmpeg --downloader "m3u8:ffmpeg"
2444 --list-formats-old --compat-options list-formats (Alias: --no-list-formats-as-table)
2445 --list-formats-as-table --compat-options -list-formats [Default] (Alias: --no-list-formats-old)
2446 --youtube-skip-dash-manifest --extractor-args "youtube:skip=dash" (Alias: --no-youtube-include-dash-manifest)
2447 --youtube-skip-hls-manifest --extractor-args "youtube:skip=hls" (Alias: --no-youtube-include-hls-manifest)
2448 --youtube-include-dash-manifest Default (Alias: --no-youtube-skip-dash-manifest)
2449 --youtube-include-hls-manifest Default (Alias: --no-youtube-skip-hls-manifest)
2450
2451 Developer options
2452 These options are not intended to be used by the end-user
2453
2454 --test Download only part of video for testing extractors
2455 --youtube-print-sig-code For testing youtube signatures
2456 --allow-unplayable-formats List unplayable formats also
2457 --no-allow-unplayable-formats Default
2458
2459 Old aliases
2460 These are aliases that are no longer documented for various reasons
2461
2462 --avconv-location --ffmpeg-location
2463 --cn-verification-proxy URL --geo-verification-proxy URL
2464 --dump-headers --print-traffic
2465 --dump-intermediate-pages --dump-pages
2466 --force-write-download-archive --force-write-archive
2467 --load-info --load-info-json
2468 --no-split-tracks --no-split-chapters
2469 --no-write-srt --no-write-subs
2470 --prefer-unsecure --prefer-insecure
2471 --rate-limit RATE --limit-rate RATE
2472 --split-tracks --split-chapters
2473 --srt-lang LANGS --sub-langs LANGS
2474 --trim-file-names LENGTH --trim-filenames LENGTH
2475 --write-srt --write-subs
2476 --yes-overwrites --force-overwrites
2477
2478 Sponskrub Options
2479 Support for SponSkrub (https://github.com/faissaloo/SponSkrub) has been
2480 deprecated in favor of --sponsorblock
2481
2482 --sponskrub --sponsorblock-mark all
2483 --no-sponskrub --no-sponsorblock
2484 --sponskrub-cut --sponsorblock-remove all
2485 --no-sponskrub-cut --sponsorblock-remove -all
2486 --sponskrub-force Not applicable
2487 --no-sponskrub-force Not applicable
2488 --sponskrub-location Not applicable
2489 --sponskrub-args Not applicable
2490
2491 No longer supported
2492 These options may no longer work as intended
2493
2494 --prefer-avconv avconv is not officially supported by yt-dlp (Alias: --no-prefer-ffmpeg)
2495 --prefer-ffmpeg Default (Alias: --no-prefer-avconv)
2496 -C, --call-home Not implemented
2497 --no-call-home Default
2498 --include-ads No longer supported
2499 --no-include-ads Default
2500 --write-annotations No supported site has annotations now
2501 --no-write-annotations Default
2502
2503 Removed
2504 These options were deprecated since 2014 and have now been entirely re‐
2505 moved
2506
2507 -A, --auto-number -o "%(autonumber)s-%(id)s.%(ext)s"
2508 -t, --title -o "%(title)s-%(id)s.%(ext)s"
2509 -l, --literal -o accepts literal names
2510
2512 See CONTRIBUTING.md for instructions on Opening an Issue and Contribut‐
2513 ing code to the project
2514
2516 For FAQ see the youtube-dl README (https://github.com/ytdl-org/youtube-
2517 dl#faq)
2518
2519
2520
2521 yt-dlp(1)