Extracting audio from an AVI file

More multimedia goodness today. Now we'll look at extracting audio from an AVI file.

Why would you want to do this? A number of reasons: you might want to rip the sound from a video to remix in an audio project. That's the task at hand for me, as I'm putting together a radio ad from videos taken of the students at my music studio. (Oh, did I mention that? I "inherited" a music studio.)

Or maybe you just need to grab the audio to play it on your archaic music player.

In any case, the task is easy enough with mplayer.

Extracting the audio is a one-line command under mplayer:

mplayer -ss 01:21 -endpos 29 -vo null -ao pcm:file=myfile.wav myfile.avi

The -ss option tells mplayer to start at 1 minute and 21 seconds.

The -endpos option (since it's used in conjunction with -ss) will record up to 29 seconds.

-ao pcm:file= tells mplayer which file to save the resulting WAV file to.

Of course, the end result is a relatively large WAV file. You'll need to convert this to your desired format, the topic of a future post.