Youtube-Dl - ArchWiki

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

9/20/22, 11:00 AM youtube-dl - ArchWiki

youtube-dl
youtube-dl (https://yt-dl.org) is a command-line program that lets you easily Related articles
download videos and audio from more than a thousand websites. See the list (h
ttps://github.com/ytdl-org/youtube-dl/blob/master/docs/supportedsites.md) mpv
of supported sites.
FFmpeg

Contents
Installation
Configuration
Usage
Format selection
Extract audio
Subtitles
Tips and tricks
Faster downloads
Playlist
Trim (partial download)
URL from clipboard
See also

1 Installation
Install the youtube-dl (https://archlinux.org/packages/?name=youtube-dl)
package, or youtube-dl-git (https://aur.archlinux.org/packages/youtube-dl-gi
t/)AUR for the development version. It is recommended to also install FFmpeg as it is used for muxing for
some sites. See the optional dependencies.

The yt-dlp (https://archlinux.org/packages/?name=yt-dlp) fork is generally


recommended instead by many users as it contains far more features and frequent updates, in particular it
adds support for more sites, downloading comments, better format preferences, and other changes. Replace
youtube-dl with yt-dlp in the commands below when using it. There are also various graphical
frontends (https://www.reddit.com/r/youtubedl/wiki/info-guis) to youtube-dl and/or yt-dlp, such as
tartube (https://aur.archlinux.org/packages/tartube/)AUR and yt-dlg (https://gith
ub.com/oleksis/youtube-dl-gui) (youtube-dl-gui-git (https://aur.archlinux.org/pac
kages/youtube-dl-gui-git/)AUR).

2 Configuration
The system-wide configuration file is /etc/youtube-dl.conf and the user-specific configuration
file is ~/.config/youtube-dl/config . The syntax is simply one command-line option per line.
Example configuration:

https://wiki.archlinux.org/title/Youtube-dl 1/4
9/20/22, 11:00 AM youtube-dl - ArchWiki

--ignore-errors

# --no-playlist

# Save in ~/Videos

-o ~/Videos/%(title)s.%(ext)s

# Prefer 1080p or lower resolutions

-f bestvideo[ext=mp4][width<2000][height<=1200]+bestaudio[ext=m4a]/bestvideo[ext=webm][width<2000][heigh
t<=1200]+bestaudio[ext=webm]/bestvideo[width<2000][height<=1200]+bestaudio/best[width<2000][height<=120
0]/best

See [1] (https://github.com/ytdl-org/youtube-dl/blob/master/README.md#configuration) for more


information.

3 Usage
See youtube-dl(1) (https://man.archlinux.org/man/youtube-dl.1) for the manual.

$ youtube-dl [OPTIONS] URL

Tip: In some cases (like YouTube) URL can be substituted with the video ID.

3.1 Format selection


When multiple formats of a video are available, youtube-dl will download the best ones by default.

To select a specific one to download:

$ youtube-dl -f format URL

To get a list of the available formats:

$ youtube-dl -F URL

3.2 Extract audio


Use -x for audio-only downloads (requires FFmpeg):

$ youtube-dl -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 (https://archlinux.org/packages/?n


ame=atomicparsley)):

$ youtube-dl -x -f bestaudio[ext=m4a] --add-metadata --embed-thumbnail URL

https://wiki.archlinux.org/title/Youtube-dl 2/4
9/20/22, 11:00 AM youtube-dl - ArchWiki

3.3 Subtitles
To see which languages are available:

$ youtube-dl --list-subs URL

To download a video with selected subtitles (comma separated):

$ youtube-dl --write-sub --sub-lang LANG URL

For auto-generated subtitles:

$ youtube-dl --write-auto-sub --sub-lang LANG URL

Add --skip-download to get only subtitles.

4 Tips and tricks

4.1 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:

$ youtube-dl --external-downloader aria2c --external-downloader-args '-c -j 3 -x 3 -s 3 -k 1M' URL

4.2 Playlist
Using youtube-dl for a playlist usually boils down to the following options:

$ youtube-dl --ignore-errors --continue --no-overwrites --download-archive progress.txt usual options UR


L

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.

4.3 Trim (partial download)


Parts of videos can be downloaded by using the output of youtube-dl -g -f format URL as
ffmpeg input with the -ss (for input), -t and -c copy options (https://ffmpeg.org/ffmpeg.html#M
ain-options).

4.4 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.

https://wiki.archlinux.org/title/Youtube-dl 3/4
9/20/22, 11:00 AM youtube-dl - ArchWiki

5 See also
GitHub repository (https://github.com/ytdl-org/youtube-dl) for documentation.

Retrieved from "https://wiki.archlinux.org/index.php?title=Youtube-dl&oldid=739728"

This page was last edited on 2 August 2022, at 05:03.

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.

Privacy policy
About ArchWiki
Disclaimers

https://wiki.archlinux.org/title/Youtube-dl 4/4

You might also like