Saturday, February 23, 2008

Downloading and ripping music from YouTube videos


  • music videos

  • speeches

  • news stories

  • video podcasts

  • etc.

Ways to download YouTube videos

  • On Debian-based systems,

    sudo apt-get install youtube-dl; youtube-dl

    The best reason to use youtube-dl is so that you can automate this process to do batch downloads.

  • Use a web-based tool

  • The easiest way is to let your browser do it for you. Go to the video page, and wait until your browser downloads it. Then check /tmp on *nix systems with Firefox (not sure about other browsers) for a file like FlashXXXXX where X is an alphanumeric character. This is the downloaded FLV video.

  • Another solution for anyone using Firefox is to look in the disk cache (about:cache?device=disk) and look for an entry starting with Clicking on this entry will show you its location on disk e.g. /home/yourusername/.mozilla/firefox/xx4xmys7.default/Cache/FB999693d01. The main benefit of using this method is that Firefox will show you the direct URL of the video on the web:

  • Look through the site html and javascript and figure out the flv URL. jk :)

Ways to extract the audio from the file

  • Use Just type in the youtube URL and select mp3 from the dropdown.

  • Use ffmpeg -i youtubevid.flv youtubemusic.mp3

  • Use mplayer -dumpaudio youtubevid.flv -dumpfile youtubemusic.mp3 method [via]

FFmpeg method [via]

mplayer method [via] (also created a bash script to automate this)

No comments: