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.
1) Youtube-dl
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
Output
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
Sample Output
--2018-10-01 13:19:52-- https://yt-dl.org/latest/youtube-dl Resolving yt-dl.org (yt-dl.org)... 95.143.172.170, 2001:1a50:11:0:5f:8f:acaa:177 Connecting to yt-dl.org (yt-dl.org)|95.143.172.170|: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)|95.143.172.170|: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)|95.143.172.170|: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)... 192.30.253.113, 192.30.253.112 Connecting to github.com (github.com)|192.30.253.113|:443... connected
Next, assign execute permission to the file
# chmod a+x /usr/local/bin/youtube-dl
Finally, run
hash -r
update Youtube-dl
You can always update youtube-dl to the latest release by running
# youtube-dl -U
Output
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>
For example
# 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
Download Audio
You can also download audio using youtube-dl like below:
# youtube-dl --extract-audio --audio-format mp3 <url>
For instance
# 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.
3) Clipgrab
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
Install Clipgrab
# apt install clipgrab
To launch Clipgrab run
# clipgrab
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
- install.sh
- readme.txt
To install XDM run
# ./install.sh
Output
To launch XDM on a terminal run
# xdman
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
Final thoughts
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.
Good topic. You can also add XDM (extreme downloader manager)
Thank Linkzilla for your input. For sure it's a very handy download tool and among the easiest to use. We have updated the article. Feel free to share it on your social media platforms.
Allavsoft works best to download youtube videos on Mac and Windows computer
Allavsoft also works great to download music, videos and subtitles from youtube, vimeo, dailymotion etc to mp4, mp3 on Windows and Mac.
It is easy to use. Simply copy and paste the video or music url to Allavsoft and click Download button.
Wow! These are a lot and Good to know information. I will definitely consider using some of these. So far, I used VeryUtils YouTube Downloader. So far I don't have any problems yet. I find it helpful want to try this one too. You can also search VeryUtils YouTube Downloader on google to download it easily.
Hi Frank,
Thanks for the comments and "VeryUtils" works on Linux?
Thanks, I am new to Linux, and your Article was very insightful for me. I needed to dl Tutorial vids and some of these tools will be very handy. Thanks again, very grateful.
Hi Pushkar,
Thanks for the comments. Good luck with your Linux learning.
Great article. Thanks for the information. Certainly helps the newbies like me.
I had a query with respect to youtube-dl. I can download the public videos / channels etc using youtube-dl. But when it comes to downloading private videos, I am getting errors despite having the accessibility to watch those videos. First I get a warning ("unable login : HTTP error 400 : Bad request"), then I get an error ("if the owner of thsi video has granted you access, please sign in. This video is private"). I did use youtube-dl -u -p URL command while trying to download. I updated the youtube-dl using snap / pip too.
Any help/assistance in this regard will be highly appreciated.
Thanks
MediaHuman Youtube Downloader - is a paid app, but its cheap and its Win/Mac/Linux.
Hi Cameron,
Good to know about MediaHuman and glad to see it support Linux.
allavsoft works best to download youtube vidoes on mac
If you are using youtube-dl witl Ubunto 20.04 you may need to create a system link.
sudo ln -s /usr/bin/python3 /usr/bin/python
to avoid following:
Eddy@ubuntu:/etc$ youtube-dl https://youtu.be/xxxxxxxxxxxx
/usr/bin/env: ‘python’: No such file or directory
Hi Eddy,
Thanks for the update.
ClipGrab works fine on ubuntu 20.04 ?
when i run ( # youtube-dl -U ) the output is as follows;
/usr/bin/env: ‘python’: No such file or directory
Manual,
Check your python location for example:
$ which python3
Then try:
//python3 /usr/local/bin/youtube-dl