yt-dlp

Related articles
mpv
FFmpeg
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
.
Note
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
AUR
; 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
AUR
and
yt-dlg-git
AUR
.
You can also install
yt-dlp-drop-in
AUR
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/best
See
[1]
for more information.
A custom configuration file can also be specified with:
$ yt-dlp
URL
--config-locations
PATH
Usage
See
yt-dlp(1)
for the manual.
$ yt-dlp [OPTIONS]
URL
Tip
In 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
URL
To select a specific one to download:
$ yt-dlp -f
format
URL
Extract audio
Use
-x
for audio-only downloads (requires
FFmpeg
):
$ yt-dlp -x -f bestaudio
URL
Depending 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
URL
Subtitles
To see which languages are available:
$ yt-dlp --list-subs
URL
To download a video with selected subtitles (comma separated):
$ yt-dlp --write-sub --sub-lang
LANG
URL
For auto-generated subtitles:
$ yt-dlp --write-auto-sub --sub-lang
LANG
URL
Add
--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
URL
Tips 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'
URL
Playlist
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
URL
This 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.