Recently I discovered many articles on How to download Youtube videos on a Raspberry Pi with Raspbian operating system installed in it or other Linux based operating systems like Ubuntu, etc.

Not got a single article which shows how it works, although I tried 6 to 7 times (approx.) following the steps of certain articles and GitHub’s but didn’t work for me.

But somehow I got this cracked and while assuming that most of you have suffered from same difficulties or may have got certain errors or are willing to be able to download videos from several websites on your credit card sized computer (Raspberry Pi) or other Linux based systems, I am going to show you What is the correct way to install youtube-dl on your system.

youtube-dl is a small command-line program to download videos from and other sites that don’t provide direct links to the videos served.

youtube-dl allows the user, among other things, to choose a specific video quality to download (if available) or let the program automatically determine the best (or worst) quality video to grab. It supports downloading entire playlists and all videos from a given user.

If you want to know more about the supported sites, formats, and features. Check this Link to Debian

You can easily download videos of all formats and sizes at your desired quality using Youtube-dl.

Windows users can download a .exe file and place it in any location on their PATH except for %SYSTEMROOT%System32(e.g. do not put in C:WindowsSystem32).

To install it right away for all UNIX users (Linux, OS X, etc.), type:

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

If you do not have curl, you can alternatively use a recent wget:

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

You can also use pip:

sudo -H pip install --upgrade youtube-dl

This command will update youtube-dl if you have already installed it. See the PyPI page for more information.

macOS users can install youtube-dl with Homebrew:

brew install youtube-dl

Or with MacPorts:

sudo port install youtube-dl

This command will update youtube-dl if you have already installed it.

To check the signature, type:

sudo wget -O youtube-dl.sig
gpg --verify youtube-dl.sig /usr/local/bin/youtube-dl
rm youtube-dl.sig

After installing this you can download the video

youtube-dl <youtube URL>

If you want to download in mp4 or any specific format then  use the following option

format code extension resolution  note 
171         webm      audio only  DASH webm audio , audio@ 48k (worst)
140         m4a       audio only  DASH audio , audio@128k
160         mp4       192p        DASH video 
133         mp4       240p        DASH video 
134         mp4       360p        DASH video 
135         mp4       480p        DASH video 
136         mp4       720p        DASH video 
137         mp4       1080p       DASH video 
17          3gp       176x144     
36          3gp       320x240     
5           flv       400x240     
43          webm      640x360     
18          mp4       640x360     
22          mp4       1280x720    (best)


I have installed youtube-dl using apt-get on Raspbian:
$ sudo apt-get install youtube-dl

The version is rather old (2012.02.27), so I decided to update it:

$ sudo youtube-dl --update
Updating to latest version...
Updated youtube-dl. Restart youtube-dl to use the new version.

Though it appears to have been a success, the result is this:

$ youtube-dl --version
/usr/bin/youtube-dl: line 1: Not: command not found

Turns out, the contents of /usr/bin/youtube-dl have been rendered rather useless during the update:

$ cat /usr/bin/youtube-dl
Not Found

The solution is quite simple for this error:

Which is to find – uninstall – and reinstall, but this time it must be in a different way.

Use the following commands to update:

sudo rm /usr/bin/youtube-dl  # or apt-get remove -y youtube-dl
sudo wget -O /usr/local/bin/youtube-dl
sudo chmod a+x /usr/local/bin/youtube-dl
hash -r

Later you can enjoy downloading the videos by simply adding a few lines of codes as mentioned above.

Also, you can bundle download more than one video by copying their links to a .txt file and saving it, suppose xyz.txt name. For bulk download process you need to write:

youtube-dl -f 18 -a xyz.txt

You may also like: Introduction to Raspberry Pi

Like it? Share with your friends!


What's Your Reaction?

hate hate
confused confused
fail fail
fun fun
geeky geeky
love love
lol lol
omg omg
win win


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

Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Voting to make decisions or determine opinions
Formatted Text with Embeds and Visuals
The Classic Internet Listicles
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Upload your own images to make custom memes
Youtube, Vimeo or Vine Embeds
Soundcloud or Mixcloud Embeds
Photo or GIF
GIF format