Difference between revisions of "Youtube-dl"
(move #Configuration) |
m (→Configuration: add generic dash just in case) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
The system-wide configuration file is {{ic|/etc/youtube-dl.conf}} and the user-specific configuration file is {{ic|~/.config/youtube-dl/config}}. The syntax is simply one command-line option per line. Example configuration: | The system-wide configuration file is {{ic|/etc/youtube-dl.conf}} and the user-specific configuration file is {{ic|~/.config/youtube-dl/config}}. The syntax is simply one command-line option per line. Example configuration: | ||
− | + | --ignore-errors | |
− | # Save in ~/Videos | + | |
− | -o ~/Videos/%(title)s.%(ext)s | + | # Save in ~/Videos |
− | + | -o ~/Videos/%(title)s.%(ext)s | |
− | # Prefer 1080p or lower resolutions | + | |
− | -f | + | # Prefer 1080p or lower resolutions |
− | + | -f bestvideo[ext=mp4][height<1200]+bestaudio[ext=m4a]/bestvideo[ext=webm][height<1200]+bestaudio[ext=webm]/bestvideo[height<1200]+bestaudio/best[height<1200]/best | |
See [https://github.com/rg3/youtube-dl/blob/master/README.md#configuration] for more information. | See [https://github.com/rg3/youtube-dl/blob/master/README.md#configuration] for more information. |
Revision as of 06:09, 3 December 2018
youtube-dl 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.
Contents
Installation
Install the youtube-dl package, or youtube-dl-gitAUR for the development version. It is recommended to also install FFmpeg as it is used for muxing for some sites.
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:
--ignore-errors # Save in ~/Videos -o ~/Videos/%(title)s.%(ext)s # Prefer 1080p or lower resolutions -f bestvideo[ext=mp4][height<1200]+bestaudio[ext=m4a]/bestvideo[ext=webm][height<1200]+bestaudio[ext=webm]/bestvideo[height<1200]+bestaudio/best[height<1200]/best
See [1] for more information.
Usage
See youtube-dl(1).
$ youtube-dl [OPTIONS] URL
Format selection
In cases where multiple formats of a video are available, youtube-dl will download the best ones by default.
To select a specific one to download, first get a list of the available formats:
$ youtube-dl -F URL
Note the code of the format you want, then run:
$ youtube-dl -f format URL
Extract audio
Use -x
for audio-only downloads (requires FFmpeg).
$ youtube-dl -x -f bestaudio URL
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
Tips and tricks
Faster downloads
Some websites throttle transfer speeds. You can often get around this 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
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
, -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.