Download And Convert Youtube Videos: The Linux Way

March 11, 2010 at 11:16 pm | LINUX | 1 comment

youtube

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

To Install youtube-dl do this:

$ sudo apt-get install youtube-dl

To download the flv video do this :

$ youtube-dl http://www.youtube.com/watch?v=siQgD9qOhRs -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
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Reddit
  • StumbleUpon
  • Technorati
  • Yahoo! Bookmarks
  • Twitter
  • Blogosphere News
  • FriendFeed
  • FSDaily
  • Yahoo! Buzz

No related posts.

One Response to “Download And Convert Youtube Videos: The Linux Way”

  1. VasiaUVI says:

    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.

Leave a Reply

Sponsors