You have at least once in your life have the desire to save to your computer any audio or video from the Internet? But as evil was the cherished button to Download? For such cases, and designed free cross-platform utility youtube-dl: it allows you to upload audio and video files, knowing only the address of the page where the file is located.
Today you will learn how to use youtube-dl, what does this utility, and what useful features it provided developers.
- Install youtube-dl
- The syntax and options
- How to use Youtube-dl
- 1. Download video or playlist
- 2. Download multiple videos
- 3. Download audio only
- 4. View available audio and video formats
- 5. Download videos of a certain format and quality
On Ubuntu installing youtube-dl is possible in several ways, including through the application Manager. However, to get the latest version, you should not use repositories of a particular distro and package management system pip.
If pip is already installed in your system, run in terminal the following command:
sudo -H pip install --upgrade youtube-dl
Otherwise, before you install youtube-dl pip install:
sudo apt install python-pip
The developers often release updates, so over time some functions of the utility no longer work. If you try to download a video a week later or a month after you install youtube-dl, you will probably see this error:
If this occurs, install the updated version of the utility:
sudo pip install -U youtube-dl
The syntax and options
To successfully use the utility, you must correctly record the command in the terminal. The syntax of the utility is simple:
$ youtube-dl options URL
- -U, –update — install updates;
- –dump-user-agent — view identification data sent by the utility on the web server;
- –abort-on-error — cancel the download of the next video from the list (playlist) in the case of any error;
- –list-extractors — view a list of sites where you can download files;
- –extractor-descriptions — a list of sites with notes;
- –playlist-start n — start a download of a playlist with a file number n;
- –max-downloads — stop the utility after downloading the n-th number of files.
- -i, –ignore-errors — continue downloading if utility is “stalled” because of an error (for example, another video from the playlist became unavailable);
- URL –proxy — use proxies (HTTP/HTTPS/SOCKS);
- –geo-verification-proxy URL — using proxies to create fake geolocation (required if the list of countries where the video is available for viewing, limited);
- –mark-watched — note videos (there is also the option for the opposite effect –no-mark-watched; both options valid only for youtube);
- –min-filesize SIZE, –max-filesize SIZE — not download the video if its size is less than or greater than specified;
- –date DATE — download only videos that have been posted to the server on the specified date (also there are options –datebefore DATE to download the videos that were posted before this date –dateafter DATE and to download the videos that were posted after the specified date);
- –no-playlist to just download video if the specified address is located and videos, and playlist (you also have the option –only-playlist, which in similar circumstances allows you to download only the playlist);
- –include-ads — to download videos with is;
- -r, –limit-rate — limit the download speed;
- –buffer-size — sets the size of the fragments that are written to the buffer;
- –playlist-reverse — start downloading the video from the end of the playlist;
- –playlist-random — download videos from the playlist in random order;
- –id — to use as the title of the video it id;
- -w, –no-overwrites — does not overwrite files;
- -c, –continue — –no-continue;
- –write-description — keep the description of the video to a file .description;
- –no-warnings — ignore the warnings.
- –no-check-certificate — do not check if a valid security certificate for the specified site;
- –F, –list-formats — show all available file formats for a given video or playlist;
- –write-sub — save the file with subtitles.
A full list of options can be found by running in a terminal one of the following commands:
How to use Youtube-dl
1. Download video or playlist
To download videos, you can simply run in a terminal the following command:
Note — the utility does not work with all sites. To see a list of available Internet resources, using the command:
Pre-configure in the terminal, the infinite scroll buffer, otherwise you’ll see only part of the list.
Utility youtube-dl saves the video to disk, assigning it the name specified on the Internet page. Option-o allows you to name the file the way you want:
youtube-dl-o 'another video from YouTube which after 5 minutes will go in the basket' https://www.youtube.com/watch?v=dkmjCAjAQug
By default, all files downloaded with youtube-dl, are placed in the root folder. To save video to another folder by typing the path to it using the same the-o option:
youtube-dl-o '~/Downloads/another video from YouTube which after 5 minutes will go in the basket' https://www.youtube.com/watch?v=dkmjCAjAQug
Do not forget to enclose the text in single quotes, otherwise it will be misinterpreted utilite, and it will return the error message.
2. Download multiple videos
To download several scattered video enough to register their addresses, separated by a space:
youtube-dl URL-adress-1 URL-adress-2 URL-adress-3
Or copy the addresses in a text file and save it in the root folder. In this case, the command looks like this:
youtube-dl -a filename.txt
3. Download audio only
There are options for youtube-dl allows you to download the entire video and only the audio track from it. Use -x if you need music or voice recording without image:
4. View available audio and video formats
Sometimes, the download of the video there is a need to know in which formats it is available. This information is easy to obtain by using the option –list-formats. Use it for individual videos and playlists:
youtube-dl --list-formats the URL-adress
5. Download videos of a certain format and quality
By default, the utility youtube-dl downloads the video and audio in the best quality with all available options. However, when you download videos and music from YouTube you have the option to choose what quality of sound and image you want to:
- best – the best video and audio quality;
- worst – the worst-quality video and audio;
- bestvideo – the best video quality;
- worstvideo – worst video quality;
- bestaudio – best quality audio;
- worstaudio lower quality audio.
Specify the desired options in the text command after the-f option. For example, for the best quality video and audio at the same time, the entry will look like this:
youtube-dl-f best URL adress
Utility youtube-dl is useful for everyone who wants to download music and videos from sites where such a feature is not provided. She has many flexible settings and only one drawback — the lack of full graphical shell. In the Ubuntu software Manager, you can find Gydl wrapper of youtube-dl with a very cut set of features, its performance leaves much to be desired.