Not too long ago I was watching some YouTube videos and was wondering how to get the sound track from them. Doing some Google searching will yield tons of results, but I discovered many them were klunky to follow. Many were even obsolete, because apparently this is a problem YouTube is actively combating. This documents the way I prefer to do this on a Mac (should work on Linux as well). Though I am sure many similarly well suited options are available for Windows.
The first thing you will need is a plugin for Firefox called DownloadHelper. I believe this should work on all platforms; however, to be clear, this explanation is with Firefox 3.0.8 for Mac OS X. This will add a toolbar to your Firefox installation that can be used to rip media content from many well known websites. Of interest to us, is its ability to rip flash videos from YouTube (ie, .flv files). Simply install the plugin and visit a video you are interested in ripping on YouTube. You should see the DownloadHelper logo starting to spin next to the address bar. This indicates, as far as I can tell, that it is trying to find media that it can tap into. For best results, you will need to let your video fully load and may need to watch it in its entirety before saving off the .flv file. Once it is ready, click on the DownloadHelper logo and one of the things in the menu that shows up should be a file named after the title of the current YouTube page. Select that file and choose somewhere to save it. It is suggested to save this on a mac in a directory that has a file path that contains no special characters (ie, spaces). This will help not to complicate things later on.
The second part of this operation involves software needed to encode/decode audio and video files. The software of choice for this process is ffmpegX. This is freeware for Mac OS X that is relatively popular and very robust. Please follow the installation instructions ffmpegX 0.0.9y. From my lessons learned, this is where you should make sure to install this tool in a file path that has no special characters (ie, spaces). In order for this software to comply with some licensing, you will also need to download the mpeg2enc binary, mplayer and mencoder binaries. Please make sure to install these in a no special character file path as well. Once the binaries have been linked to with ffmpegX, you will no longer needs these files as the application should be in your Application directory and have made local copies of the binaries.
Now simply start up ffmpegX and drag and drop the .flv file downloaded earlier to the left hand side of the app. Next, choose a format to encode it with. If you want the soundtrack, simply choose “movie audio to mp3” for the target format on the right hand side. Then, click the Encode button and an mp3 should be generated. One problem I kept encountering at first was files seemed to be completing their conversions immediately. It turns out they were and generated 0Kb files. After looking for a solution for a while it turns out that sometimes the audio and video tracks are encoded differently, causing them to be in a different order (this may be done on purpose by YouTube). If this occurs, select the “Audio” tab and select “Invert Mapping,” and try again. If this still does not work, select the blue “i” next to the suspect problem for a log of the conversion process. Use the information provided to do a Google search and try to find a solution.
ffmpegX proves to be a very useful tool and one that has many other uses. I enjoy using this to convert .flv files into mp3s and videos that I can play on my iPhone, but there are many other formats to convert audio/video files to and from. Please provide any feedback or corrections you have and I will try to address them as best as I can.