Download And Convert Youtube Videos: The Linux Way


youtube-dl is a small command-line program to download videos from

To Install youtube-dl do this:

$ sudo apt-get install youtube-dl

To download the flv video do this :

$ youtube-dl -o video.flv

Use VLC Player or MPlayer or Kaffeine to play the flash video.

Convert youtube videos:

ffmpeg is a command line tool to convert one video file format to another.

To install ffmpeg do this:

$ sudo apt-get install ffmpeg

Convert flv to mpeg:

$ ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 video.mpg

-ab : Sets the audio bitrate. Without this, it’ll be set to the default of 64kbps

-ar : Sets the audio samplerate. Default is 44100hz

-b : Sets the video bitrate. Default is 2000kbps

-s : Sets the size. Default is 160×128px

Convert flv to avi:

$ ffmpeg -i video.flv video.avi

Convert flv to mp3:

The basic command:

$ ffmpeg -i video.flv audio.mp3

By default this will create a 64 kb/s file. You can declare the audio bitrate with -ab:

$ ffmpeg -i video.flv -ab 32k audio.mp3

If the flv already has mp3 audio, then there is no need to re-encode. You can just copy the audio stream. This will preserve the audio quality and will be much quicker since there is no re-encoding:

$ ffmpeg -i video.flv -acodec copy audio.mp3

Don’t know what the audio is? Just ask ffmpeg:

$ ffmpeg -i video.flv


VasiaUVI March 13, 2010

Thanks for this info! I usually convert youtube videos in mp3 but with greasemonkey script or DownloadHelper but this method is OK and it's good to know this kind of commands.

Kitchen Canisters  October 14, 2010

youtube is very addicting, i spend 5 hours a day just watching videos on youtube”,-