Downloading videos from Youtube to your PC comes in handy especially when you know you are going to be offline for long periods of time, for instance when you are catching a flight or a train.
What's more is that it gives you the convenience of watching your videos without interference should the internet connection suffer some degradation.
In this tutorial, we will see the different tools that you can use to download YouTube videos in Ubuntu 18.04.
Read and know how to install each on your Linux machine.
Youtube-dl supports download of videos in different file formats as well as audio from Youtube and other sites. By default, Youtube-dl will download the highest quality of the videos being downloaded but in case of a slow internet connection, a lower quality can be downloaded by passing some arguments. Some of the notable features of Youtube-dl include
- Downloading all video files from a playlist
- Ability to resume interrupted downloads
- Ability to convert video files into MP3 files
- Ability to download videos of varying resolutions e.g 4K , 1080p , 720 p
- Ability to set the maximum download rate.
There are 3 ways you can use to install Youtube-dl on your Linux system
install using apt
To install Youtube-dl using apt, log in as root and run the following command
# apt install youtube-dl
install using pip
Additionally, you can install the tool using the pip package manager. But first, let's install pip
# apt install python-pip
Once pip is installed, install Youtube-dl by running
# pip install youtube-dl
Collecting youtube-dl Downloading https://files.pythonhosted.org/packages/5e/a9/112c66ce67d03896ef2d8094715aa3c7abb1b6959021eb273af96a206433/youtube_dl-2018.9.26-py2.py3-none-any.whl (1.8MB) 100% |████████████████████████████████| 1.8MB 238kB/s Installing collected packages: youtube-dl Successfully installed youtube-dl-2018.9.26
To accomplish this run the command below
# wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
--2018-10-01 13:19:52-- https://yt-dl.org/latest/youtube-dl Resolving yt-dl.org (yt-dl.org)... 18.104.22.168, 2001:1a50:11:0:5f:8f:acaa:177 Connecting to yt-dl.org (yt-dl.org)|22.214.171.124|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://yt-dl.org/downloads/latest/youtube-dl [following] --2018-10-01 13:19:54-- https://yt-dl.org/downloads/latest/youtube-dl Connecting to yt-dl.org (yt-dl.org)|126.96.36.199|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://yt-dl.org/downloads/2018.09.26/youtube-dl [following] --2018-10-01 13:19:55-- https://yt-dl.org/downloads/2018.09.26/youtube-dl Connecting to yt-dl.org (yt-dl.org)|188.8.131.52|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://github.com/rg3/youtube-dl/releases/download/2018.09.26/youtube-dl [following] --2018-10-01 13:19:56-- https://github.com/rg3/youtube-dl/releases/download/2018.09.26/youtube-dl Resolving github.com (github.com)... 184.108.40.206, 220.127.116.11 Connecting to github.com (github.com)|18.104.22.168|:443... connected
Next, assign execute permission to the file
# chmod a+x /usr/local/bin/youtube-dl
You can always update youtube-dl to the latest release by running
# youtube-dl -U
youtube-dl is up-to-date (2018.09.26)
How to Use youtube-dl
Upon successful installation of Youtube-dl, You can now begin downloading videos. To download a video from YouTube, the syntax will be
# youtube-dl <url>
# youtube-dl https://www.youtube.com/watch?v=IcrbM1l_BoI
Checking available video formats
Youtube-dl supports a myriad of video formats, e.g Mp4, mkv, webm, FLV e.t.c. To list available video codes, use -F option. E.g
# youtube-dl -F https://www.youtube.com/watch?v=IcrbM1l_BoID
Downloading a Specific video format
After generating a list of available video formats, you can proceed to download a specific format using -f format-number. E.g
# youtube-dl -f 251 https://www.youtube.com/watch?v=IcrbM1l_BoID
You can also download audio using youtube-dl like below:
# youtube-dl --extract-audio --audio-format mp3 <url>
# youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=IcrbM1l_BoI
This will extract audio from the video and save it to disk.
Downloading a video playlist
Youtube-dl saves all videos on a playlist by default. Just copy playlist URL and pass it to youtube-dl command line tool.
# youtube-dl https://www.youtube.com/watch?v=PIh2xe4jnpk&list=RDCGyEd0aKWZE&index=2
You can also start from a specified number.
# youtube-dl --playlist-start 5 https://www.youtube.com/watch?v=PIh2xe4jnpk&list=RDCGyEd0aKWZE&index=2
Force resume of partially downloaded files
To force resume of partially downloaded files without overriding completed, use -cwi options:
# youtube-dl -cwi video-url
Installing a Graphical User Interface for Youtube-dl
If you are not keen on operating from the terminal, you can install a GUI form of youtube-dl
Run the following commands
# add-apt-repository ppa:nilarimogard/webupd8 # apt-get update && sudo apt-get install youtube-dlg
2) YouTube-DL GUI
To download a video, paste the video's URL into the URL box. Click on the Add button next to it.
After the video is added to the queue, You can add more to download videos in bulk or use the button on the bottom right to begin the download.
The video will save to whatever location is chosen in the Download Folder option in the Preferences tab.
Clipgrab is yet another useful tool that helps you download videos from Youtube and other sites such as Vimeo and Daily Motion. With just a few clicks, you simply copy the Video Url and paste it in Clipgrab, as you define the resolution then finally hit Grab this Clip button.
To install Clipgrab, use the official PPA by the Clipgrab team.
# add-apt-repository ppa:clipgrab-team/ppa
Update the System
# apt update
# apt install clipgrab
To launch Clipgrab run
4) 4K video downloader
Just like Clipgrab, 4K Video Downloader only requires you to copy the video Url and paste it on the GUI interface. To install 4K Video Downloader, first head out to the download page and download the latest Debian file for Ubuntu. Once downloaded run
dpkg -i 4kvideodownloader_4.4.10_1_amd64.deb
5) XDM (Xtreme Download Manager)
Xtreme Download manager is a powerful video downloader that lets you scale download speed by up to 500 %, thereby saving on time. You can save videos from a myriad of sites such as Youtube, Vimeo, Facebook, and Daily motion to mention a few. In addition, you can resume dead/broken downloads, schedule as well as convert downloads. This download tool easily integrates with Firefox, Google Chrome, Opera and Vivaldi.
To download the tool head out to XDM's page and scroll down to the 'downloads' section. You should be able to see a section like the one shown below that allows you to download the required tarball based on your system's architecture.
Once downloaded, extract the tarball.
# tar -xvf xdm-2018-x64.tar.xz
You will notice the existence of two files
To install XDM run
To launch XDM on a terminal run
To download a video from YouTube, click on the download button as shown below
This will pop open a window where you will paste the link of the YouTube video you desire to download. Once done, click on 'Download '.
The download will thereafter begin
In this tutorial, we have discussed a few tools you can use to download YouTube videos In Ubuntu on Terminal and using the Graphical User Interface . Give it a try and let us know your experience and advise if you know about any other tools.