Install youtube-dl to command YouTube videos to the Linux terminal
youtube-dl is a Python-based, small command-line tool that allows you to download videos from YouTube, Dailymotion, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles, and many more.
Main features of youtube-dl
This little tool has so many features that we can call it the best YouTube video download application for Linux.
- Not only from YouTube, Dailymotion, Facebook, etc. Download videos from other popular video sites.
- MP4, WebM, etc. It allows you to download videos in various video formats such as.
- You can also choose the quality of the downloaded video. If the video is available in 4K, 4K, 1080p, 720p etc.
- Automatically pause and resume video downloads.
- YouTube allows bypassing geographical restrictions
How to install Youtube-dl?
If you are using a Ubuntu-based Linux distribution, you can install it using the command below:
sudo apt install youtube-dl
For other Linux distributions, you can also install youtube-dl on your system via the command-line interface:
sudo wget //yt-dl.org/downloads/latest/youtube-dl -O/usr/local/bin/youtube-dl
After receiving the file, you need to set executable permission in the script for it to work properly.
sudo chmod a+rx /usr/local/bin/youtube-dl
Let’s use YouTube-dl to download videos:
The following command is sufficient to download the video. “VIDEO_URL” is the URL of the video you want to download.
You can also download YouTube videos in different quality and genres.
It will be enough to use the command below to see the existing formats of the Youtube video. This will show us a list of the available formats.
The output will be as follows:
Setting the language BlXaGWbFVKY:
Downloading the video web page BlXaGWbFVKY:
Downloading the video information file BlXaGWbFVKY:
Video information extraction Available formats: 37: mp4 [1080x1920] 46: webm [1080x1920] 22: mp4 [720x1280] 46: webmaster [1080x1920] 22: mp4 [720x1280] ] 44: ağ [480x854] 34: flv [360x640] 18: mp4 [360x640] 43: ağm [360x640] 5: flv [240x400] 17: mp4 [144x176]
Now we can choose the format you want. For example, if you want to download it in MP4 version and 720 pixels, it should be done as follows:
youtube-dl -f 22
Now download subtitles of videos using Youtube-dl.
First, check if there are subtitles for the video. Use the following command to list all the subsections of a video:
To download all sub videos, but to download the video:
youtube-dl --all-subs --skip-download
Download the entire YouTube playlist
Just run the command below to download a playlist. “Playlist_url” is the URL of the playlist you want to download.
Download audio from YouTube videos only
If you only want to download the audio from a YouTube video, you can use the -x option to extract the audio file from the video.
The default file format is downloaded as Ogg. You can change the file format of the audio file as follows:
youtube-dl -x --audio-format mp3
I hope it was a useful article.