Extract Audio from YouTube and other Flash on Linux

Let the flashplayer totally download the media file. This will create a file in /tmp

cd /tmp
ls -ltr

look for a file like FlashXXIXiAWd and note the name. Substitute your actual file name in the commands below.

$ ffmpeg -i FlashXXIXiAWd

now note the audio encoding. For example you might see

Stream #0.1: Audio: aac, 44100 Hz, stereo, s16

this means the audio is aac. If this is the case, extract the audio stream with:

$ ffmpeg -i FlashXXIXiAWd -acodec copy extractedAudio.aac

You might want to convert (re-encode) this file but, I try to stop right here and not convert unless I have to. If I must re-encode I generally use mplayer/mencoder


$ mplayer -ao pcm extractedAudio.aac -ao pcm:file=extractedAudio.wav