ArchWiki / Yt-dlp
ArchWiki / Yt-dlp
de:yt-dlp es:Yt-dlp ja:Youtube-dl pl:Youtube-dl uk:Youtube-dl zh-hans:yt-dlp
yt-dlp is a command-line program that lets you easily download videos and audio from more than a thousand websites. See the list of supported sites.
yt-dlp is a fork of youtube-dl that was created after the parent project became stagnant. The upstream youtube-dl can still be installed as youtube-dl; commands on this page should still work, but check the list of differences.
Installation
Install the yt-dlp package. See the optional dependencies, a notable one to install is FFmpeg for muxing on some sites.
There are also various graphical frontends to yt-dlp, such as tartube and yt-dlg-git.
You can also install yt-dlp-drop-in which provides a dummy /usr/bin/youtube-dl executable (that just redirects to yt-dlp) for outdated programs that still look for a youtube-dl executable.
Configuration
The system-wide configuration file is /etc/yt-dlp.conf and the user-specific configuration file is ~/.config/yt-dlp/config. The syntax is simply one command-line option per line. Example configuration:
--ignore-errors
# --no-playlist
# Save in ~/Videos
-o ~/Videos/%(title)s.%(ext)s
# Prefer 1080p or lower resolutions
-f bestvideo[height<=?1080]+bestaudio/bestSee https://github.com/yt-dlp/yt-dlp/blob/master/README.md#configuration for more information.
A custom configuration file can also be specified with:
$ yt-dlp URL --config-locations PATHUsage
See yt-dlp(1) for the manual.
$ yt-dlp [OPTIONS] URLIn some cases (like YouTube) URL can be substituted with the video ID.
Format selection
When multiple formats of a video are available, youtube-dl will download the best ones by default.
To get a list of the available formats:
$ yt-dlp -F URLTo select a specific one to download:
$ yt-dlp -f format URLTo automatically select the best video format, but exclude specific formats - for example, when the system does not support H.265:
$ yt-dlp -f "bestvideo[vcodec!=h265]+bestaudio" URLExtract audio
Use -x for audio-only downloads (requires FFmpeg):
$ yt-dlp -x -f bestaudio URLDepending on the available source streams, this will often correct the audio-only container. If an audio-only stream is not available, exclude -f bestaudio from the example above. This will download the video and copy its audio as post process. By default this will remove the downloaded video, include -k to keep it.
To also include album art (requires atomicparsley):
$ yt-dlp -x -f bestaudio[ext=m4a] --add-metadata --embed-thumbnail URLSubtitles
To see which languages are available:
$ yt-dlp --list-subs URLTo download a video with selected subtitles (comma separated):
$ yt-dlp --write-sub --sub-lang LANG URLFor auto-generated subtitles:
$ yt-dlp --write-auto-sub --sub-lang LANG URLAdd --skip-download to get only subtitles.
Cookies
To import cookies add the --cookies-from-browser <browser>
Example of importing cookies from chromium
$ yt-dlp --cookies-from-browser chromium URLTips and tricks
Faster downloads
Some websites throttle transfer speeds. You can often get around this by choosing non DASH streams or by using aria2, an external downloader which supports multi-connection downloads. For example:
$ yt-dlp --downloader aria2c --downloader-args '-c -j 3 -x 3 -s 3 -k 1M' URLPlaylist
Using youtube-dl for a playlist usually boils down to the following options:
$ yt-dlp --ignore-errors --continue --no-overwrites --download-archive progress.txt usual options URLThis set of options allow for the download to effectively continue even after interruption. If you are archiving, add the usual --write-xxx and --embed-xxx options you may have.
Trim (partial download)
Parts of videos can be downloaded by using the output of yt-dlp -g -f format URL as ffmpeg input with the -ss (for input), -t and -c copy options.
URL from clipboard
A shell alias, a desktop launcher or a keyboard shortcut can be set to download a video (or audio) of a selected (or copied) URL by outputting it from the X selection. See Clipboard#Tools.
See also
GitHub repository for documentation.