Downloading YouTube Videos Using Linux

Edited by Earl on Nov-18-2015

How to Download YouTube Videos with Linux


This method works well for me with Linux Mint 12.


Install the Small command-line program youtube-dl.


VIDEO Showing How youtube-dl Works

Example of downloading video from the command line:
$ youtube-dl

Update youtube-dl

Edited November 18, 2015

Youtube-dl could no longer download videos from Updating the software fixed this. Here are the two commands I entered into a Linux terminal to upgrade youtube-dl.

$ sudo wget --no-check-certificate -O /usr/local/bin/youtube-dl

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

Useful config settings for youtube-dl


MKV files

Sometimes youtube-dl downloads the video and the audio streams separately and combines them into a MKV file. I was having trouble playing MKV video, which would usually not play on any of my computers. I found a solution and decided to share it.

To force youtube-dl to not merge video and audio into the MKV format, I edited the config file to have a single line.


To edit the config file:


$ sudo kate /etc/youtube-dl.conf

Code inserted into config file:

-f best -o "%(title)s - %(uploader)s.%(ext)s"

The code above also adds to the filename the title and uploader of the video.


For now, this option “-f best” is stopping youtube-dl from making MKV videos and now youtube-dl mostly downloads MP4 videos instead, which always play on my computers.


Comments or questions?

Your message:

If appropriate, your message may be posted to this section of the page.

Your email address (so we can reply):