Tuesday, June 1, 2010

How to extract the audio from a Youtube video?

Did you ever encounter a Youtube video you really like the audio part? I'm sure you wonder now how you can extract the audio from your favorite Youtube video. Here is how you can do it for free in three easy steps.

a) Download the Youtube video
First, you have to download the Youtube video.

b) Extract the audio from the video
You have to install mplayer (on Ubuntu: sudo apt-get install mplayer)
$ mplayer -quiet youtubeVideo.MP4 -ao pcm:fast:file=audio.wav -vc dummy -vo null -channels 2

This will extract the audio from the file youtubeVideo.MP4 and will convert it to a WAV file called audio.wav.

c) Convert the WAV file to an MP3 file
The last step is to convert the WAV file to an MP3 file which is a lot smaller and allows you to save space. For this we are using "lame" (on Ubuntu: sudo apt-get install lame):

$ lame audio.wav audio.mp3

This will take the audio.wav file and save it as audio.mp3. That's it. The file audio.mp3 contains the audio part of the Youtube video.

No comments:

Post a Comment