Monday, May 02, 2011

Extracting music from YouTube

DISCLAIMER: I am not fully aware of the legality of this. I am assuming that it is OK since I am not doing any hacking or breaking of cryptography, but your mileage may vary.

Below are the high-level steps I used to download music from YouTube and then burn to a CD. I performed these steps on Ubuntu 10.4
  1. Create a folder to hold the video and audio files
  2. Find the music you wish to download and copy the URLs to a temp file
    1. Such as http://www.youtube.com/watch?v=t_bLwrcdJgA
  3. Using get_flash_videos, download the files
    1. get_flash_videos http://www.youtube.com/watch?v=t_bLwrcdJgA
  4. Use mplayer to extract the WAV data
    1. for i in `ls *.mp4`; do mplayer $i -ao pcm:file=$i.wav; done
  5. Use normalize-audio to make all the music the same volume
    1. normalize-audio -m -v  *.wav
  6. Finally, use your favorite CD burning software to create the disk.
You can research the commands individually to get more information on what they are and how they work.

No comments: