Skip to content

Instantly share code, notes, and snippets.

@vargheseraphy
Last active August 29, 2015 14:15
Show Gist options
  • Save vargheseraphy/825cf423f9f533b14c07 to your computer and use it in GitHub Desktop.
Save vargheseraphy/825cf423f9f533b14c07 to your computer and use it in GitHub Desktop.
download youtube videos from terminal in linux

Install you tube Downloader from linux terminal

sudo apt-get install youtube-dl youtube-dl

youtube-dl -cit http.....(paste the link) youtube-dl http://www.youtube.com/watch?v=_z-hEyVQDRA

You can also specify other options

-b            Best quality
-m            Mobile version
-d            High Definition
-g            Don’t download, just show the url
-c            Resume download of a video which was interrupted before
-w            Don’t overwrite existing file
For complete list of switches execute man youtube-dl in terminal.

Information from http://www.absolutelytech.com/2010/06/26/howto-download-youtube-video-from-command-line-ubuntu/

Converting to mp3

Now install ffmpeg from the official repo.

sudo apt-get install ffmpeg

Next have a look to make sure the flv file has downloaded from youtube by typing

ls *flv This will list all the flv files you have. What you should see is a flv file with the same name as the 'v' component of the youtube url you downloaded.

E.g if you downloaded http://www.youtube.com/watch?v=_z-hEyVQDRA then you should have a file called _z-hEyVQDRA.flv

Next you need to copy that file name and then put it in an ffmpg command like

ffmpeg -i .flv -acodec liblamemp3 .mp3

So for this example you would type

ffmpeg -i _z-hEyVQDRA.flv -acodec liblamemp3 MasterOfPuppets.mp3

Once this has successfully completed you will now have the mp3 file you were after.

Note For cleanup you may want to type rm _z-hEyVQDRA.flv to get rid of the flv file that you no longer need.

Information from http://ubuntuforums.org/showthread.php?t=855433

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment