Online video is a big thing in 2017. Wherever you look, someone is watching a video. For most people, the platform of choice is YouTube where every hour 48 hours of video content is published. Suffice it to say, there is no shortage of video content available on practically any topic. YouTube lets you download content offline on your phone, provided you’re using the official YouTube app. This feature doesn’t exist on the desktop.
If you’re a Linux user with a spotty internet connection, you don’t get the greatest experience when you watch a video on YouTube. Thankfully, there are tools out there that let you save YouTube videos on Linux so you can watch them later. In this article, we’ll be going over the most popular (and arguably the most useful) YouTube video tool; YouTube-DL. It lets you save YouTube videos on Linux and directly from YouTube in multiple formats, and even convert them to an MP3 audio file too.
YouTube-DL is a pretty popular program. As a result, nearly all major Linux distributions have it in their software sources. Open a terminal, select your Linux distribution from the list and use the command to install it.
sudo apt install youtube-dl
sudo pacman -S youtube-dl
sudo apt-get install youtube-dl
sudo dnf install youtube-dl
sudo zypper install youtube-dl
Other Linux Distributions
Like mentioned before, this program is the goto command-line tool when interacting with online videos. As a result, users will have an easy time installing it, as it’s usually available. If, for some reason the Linux distribution you use has decided not to make this program available, here’s how you can still install it.
It starts by installing python-pip. Use your Linux distribution’s package searching tool (for example, an Ubuntu user would search with apt search program name). As YouTube-DL is written in python, the python package install tool can be used to install it:
sudo pip install youtube-dl
Save A Video
Find the URL of the YouTube video you wish to save. Then, use this command:
This is the basic command that will save a YouTube video directly to your Linux desktop, straight up. However, it is also possible to (while downloading) convert this YouTube video to a more PC friendly format. In fact, YouTube-DL supports a multitude of formats; Mp4, webm, 3gp, and FLV. Using the -F command reveals all possible codecs.
youtube-dl -F https://www.youtube.com/watch?v=5GyhFsJoiYc
Look at the number next to each of the format the program lists, and remember this number. Then, place the number after the -f switch to save and convert the YouTube video as that format. For example the following command will save the YouTube video in M4A format.
youtube-dl -f 139 https://www.youtube.com/watch?v=5GyhFsJoiYc
Save A Playlist
It can get tiring manually looking for video after video to save. That’s why the developers of YouTube-DL have made it possible to save any video added to a public YouTube playlist. It doesn’t even have to be your own playlist. Search YouTube, then click “view playlist” to get the entire URL. Then use it with YouTube-DL to save every video.
Converting To MP3
Many YouTube users turn to “youtube to MP3” websites because they can take any YouTube video and save it as an audio file. This is great if you find a song by a popular YouTube user you’d like to listen to later. There are other reasons too: maybe a debate/video podcast is on YouTube and you want it as an MP3 to take it on the go.
Note: it is possible to save an entire public playlist as MP3. Just find the playlist and add it instead of a single video URL.
Here’s how to do this with YouTube-DL:
youtube-dl https://www.youtube.com/watch?v=uhBewKu80Mg -x --audio-format mp3
Other YouTube-DL Tricks
YouTube-DL is a complex and feature rich program. It has so many features that it would be incredibly tedious to go over every single one. Instead, let’s briefly go over how to access the vast help page. This help page outlines in detail the many options and features that YouTube-DL offers. Things from codec options, audio quality, file size, login options and even settings that allow users to save subtitles/language options.
To access this help page, simply run this command:
Alternatively, save the help file to a text file on your desktop for easy access any time:
youtube-dl --help >> ~/yt-dl-help.txt
YouTube-DL gives Linux YouTube users the freedom to get more out of their online video experience. With it, it is possible to save YouTube videos on Linux in multiple formats for offline viewing. That being said, it is kind of a shame that a lot of the cool features in this program aren’t simply things Google offers on their own.