Extracting audio from a YouTube video
Posted by isilanes on January 7, 2008
This HowTo really has two parts:
1 – How to download a video from YouTube
2 – How to extract audio from any video
The second step is not limited to videos obtained in the first step, and the first step can obviously be made for the sake of it.
How to download a video from YouTube
When you play a video on YouTube, the contents of a FLV file are streamed to your screen. Downloading this FLV file is a bit more tricky than it should be, because there is no direct indication of the URL of this file in the code of the page of the video.
Apparently some guys got over it, and they made the software I use to do the job: a Firefox extension called DownloadHelper. Using it is so easy: a three-sphere icon appears to the right of the URL bar of Firefox. When a page contains material that can be downloaded with DownloadHelper (such as a YouTube video), the spheres in the icon are colorful and move (otherwise they are grayed-out, and still). You can then click on the icon to see a list of items to download, and choose the one you want (usually the .flv file).
How to extract audio from any video
% mplayer filename.flv -vo null -ao pcm:fast:file=filename.wav
% oggenc filename.wav -q 7 -o filename.ogg
And that’s all to it!