How to Download YouTube Videos in Linux

YouTube is one of the websites with the most videos on the internet (as of writing this post, it is number one on the list). For some reason, you might need to download some videos to watch later while offline. Situations like following a tutorial playlist about a project or listening to your favorite songs while offline requires you to download some of these videos.

Whatever your reason might be, we will show you how you can download YouTube Videos on a Linux system. We will guide you through both the graphical (GUI) and the command-line way. Let’s dive in!

Download YouTube videos via a Graphical User Interface

Some of the methods that we will discuss in this section include:

  • Download using the Firefox extension/ Add-on.
  • Download using the Clipgrab application.
  • Download using 4K Video Downloader.
  • Download using Tartube (Youtube-dl Front end app).

1. Download YouTube videos using Firefox Add-on

Most Linux Desktop distributions (if not all) come pre-installed with the Mozilla Firefox browser. It will be the first tool on our list, which you can use to download YouTube Videos.

To get started, download the Video DownloadHelper add-on from the link below.

Video DownloadHelper

By clicking on the link above, you will get an option to add the extension to your Firefox browser. Please note, you are on the Mozilla Firefox browser while clicking the link.

Video DownloadHelper
Video DownloadHelper

Click on the Add to Firefox button. You might see a prompt to add the add-on, as shown in the image below. Click Add.

Add extension to Firexfox
Add the extension to Firefox

Up to this point, the Video DownloadHelper Add-on can capture any video played on your YouTube tab, as shown below. However, we need to do one more crucial thing.

Video DownloadHelper
Video DownloadHelper

From the image, you can see we even have a Download icon (downside arrow) to download your videos. However, when you click on this button, you might get a prompt like this shown in the image below.

Companion App
Companion App

Click on the Install Companion App button. A new tab will open on your browser with the option to download the companion app for Debian / Ubuntu and Other Linux distributions. In my case, I a running Ubuntu 20.04 LTS; therefore, I will proceed to download the .Deb file.

Companion App
Companion App

To install the deb file, open the Terminal and navigate to the directory containing the file. Proceed to execute the commands below:

chmod +x [file-name]
sudo apt install ./[file-name]
e.g
chmod +x net.downloadhelper.coapp-1.5.0-1_amd64.deb
sudo apt install ./net.downloadhelper.coapp-1.5.0-1_amd64.deb

Install Companion App
Install Companion App

With the companion app installed, you can now proceed to download your videos without any issues. If you don’t provide a destination directory, the downloaded videos will be stored in the dwhelper folder present in the home directory.

One amazing feature with this Firefox Add-on is that you can also download Facebook videos.

2. Download using the ClipGrab application

Clipgrab is an application used to download videos from various sites, including YouTube, Facebook, Vimeo, and Dailymotion. It is a cross-platform software package available for Linux, Windows, and macOS. It comes with an amazing user interface highly praised for its user-friendliness.

To install ClipGrab on Ubuntu, execute the commands below on the Terminal.

sudo add-apt-repository ppa:clipgrab-team/ppa
sudo apt-get update
sudo apt-get install clipgrab

However, as of writing this post, Clipgrab does not have a release file for Ubuntu 20.04 LTS. Therefore, after successfully adding the PPA and you try to run the update command, you might get an error like, “The repository ‘http://ppa.launchpad.net/clipgrab-team/ppa/ubuntu focal Release’ does not have a Release file.”

To overcome this, we will use the ClipGrab AppImage file. That will not only run on Ubuntu 20.04 but also other Linux distributions that support AppImage.

Click on the link below and select the Free Download option to download the ClipGrab AppImage file.

ClipGrab AppImage File

Now before launching the application, there are two other things that we will need to install. Avconv or FFmpeg, which is responsible for converting files and downloading 1080p videos from Youtube. The Youtube-dl, which is the tool that Clipgrab uses to download Youtube Videos.

To install FFmpeg on Ubuntu, run the commands below:

sudo apt update
sudo apt install ffmpeg

Install FFmpeg
Install FFmpeg

To install Youtube-dl, execute the commands below:

sudo apt install youtube-dl

Alternatively, you can also install it using the Python pip command.

sudo pip install youtube-dl

Install Youtube-dl
Install Youtube-dl

Once you have the two packages installed, you can proceed to open the Clipgrab AppImage file. Open the Terminal and navigate to where the AppImage is located. Make it executable with the command below:

chmod +x [file-name]
e.g
chmod +x

Once done, you can proceed to double click on the Appimage file to launch ClipGrab or run it with the command below:

./[file-name]
e.g
./ClipGrab-3.9.2-x86_64.AppImage

Run ClipGrab
Run ClipGrab

Once the ClipGrab window opens, navigate to the Downloads tab and enter the link to the Youtube video you wish to download.

ClipGrab
ClipGrab

3. 4K Video Downloader

4K Video Downloader is a multi-platform utility for downloading videos from popular sites, including YouTUbe, Vimeo, Dailymotion, Facebook, and Flickr. It supports various media formats, including MP4, MKV, OGG, MP3, and more.

Download 4K Video Downloader for Ubuntu from the link below:

Download 4K Video Downloader

Once the download completes, launch the TErminal and navigate to the download’s location. Install the DEB file with the commands below:

chmod +x 4kvideodownloader_4.13.4-1_amd64.deb
sudo apt install ./4kvideodownloader_4.13.4-1_amd64.deb

Install 4K Video Downloader
Install 4K Video Downloader

Once the installation completes, proceed to launch the 4K Video Downloader from the applications menu.

Copy the URL of the video you wish to download. On the 4k Video Downloader main window, click on the Paste Link button. It will automatically detect the link on your clipboard and search for the video together with the different available formats. Select the one you wish to download and click on the download button.

4K Video Downloader
4K Video Downloader

4. Tartube

Tartube is the front-end GUI for Youtube-dl developed using Python3. It is available for Debian based distributions like Ubuntu in a .Deb format and the RPM package for RHEL-based distros, e.g., Fedora.

Use the link below to download Tartube.

Download Tartube

For Ubuntu users, download the .deb file and install it with the commands below:

chmod +x python3-tartube_2.2.0.deb
sudo apt install ../python3-tartube_2.2.0.deb

Install TarTube
Install TarTube

If you downloaded the RPM package, install it with the command below:

sudo dnf install tartube-*.rpm

Once installed, proceed to launch Tartube from the applications menu. Click the Videos button and enter the URL of the YouTube video you wish to download.

Enetr Video URL
Enter Video URL

Click the OK button. You will see the Video listed on the All Videos tab. Click on the Download All button located at the bottom-left of the window.

Download Video
Download Video

Those are four Graphical methods you can use to download YouTube videos on your Linux system. Now let’s look at the command-line way.

Download YouTube Videos via the Command-Line

If you are obsessed with carrying out most of your tasks like me, this section will highly interest you. We will use a tool called YouTube-dl. When we looked at some of the GUI options available for downloading YouTube videos, we saw tools like ClipGrab and TarTub use Youtube-dl to download videos. Now, let’s see how Youtube-dl itself works.

Youtube-dl is a Python-based utility that enables downloading videos from popular sites like YouTube, Dailymotion, Photobucket, Facebook, Yahoo, Metacafe, and more. It supports various media formats, including MP4, WebM, etc. You can also select the video’s quality, pause and resume downloads, and bypass YouTube restrictions.

Installing YouTube-dl

You can easily install YouTube-dl via the apt command for Debian-based distributions. However, that version seems quite old from experience, and you can come across various errors while downloading videos. Therefore, I prefer installing it directly from the source repository. Additionally, this method works for most Linux distros.

Execute the commands below on your Terminal.

sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl

sudo chmod a+rx /usr/local/bin/youtube-dl

Download YouTube-dl
Download YouTube-dl

Once installed, we will need to update it. Execute the command below:

youtube-dl -U

In case you get an error like, “/usr/bin/env: ‘python’: No such file or directory,” that means you don’t have python installed, or there are conflicts between the installed versions. Maybe you have installed both Python2 and Python3.

Python Error
Python Error

To solve that, you will need to install Python3 and put it as the default Python package on your system. Our article on Switching between Python 2 and 3 versions will guide you through that whole process. Please check it out.

Using YouTube-dl to download videos

The basic syntax of using youtube-dl is:

youtube-dl <Video-URL>

To download a video with a specific quality, first, execute the command:

youtube-dl -F <Video URL>

See the image below.

Video Formats
Video Formats

From the image above, if I wanted to download the video as an mp4 format with 1080p quality, I would execute the following command:

youtube-dl -f 137<video_url>

To download an entire playlist, execute the command below:

youtube-dl -cit <playlist_url>

To download only the audio of the video, execute the command below:

youtube-dl -x <video_url>

Those are but a few of the options you can use with youtube-dl. To see all the other arguments, execute the command;

youtube-dl --help

Youtube-dl help option
Youtube-dl help option

What’s your favorite?

We have shown you five ways to use to download YouTube videos. Which of them do you like most? Do you have another method that you wish to share with our readers? Please feel free to share in the comments below.

Leave a comment

Your email address will not be published. Required fields are marked *