Extracting Audio From Video

I recently came across some some excellent concert footage. I wanted to have the performance available on my mp3 player but I didn’t want to re-encode the audio. Ffmpeg came to the rescue.

Using ffmpeg you can split out the audio and video components of any video stream it understands. In fact you can tell ffmpeg to transcode the audio as well. In my case the audio was already in mp3 format so I didn’t want to transcode. Ffmpeg allows you to specify “copy” as an output format in which case it doesn’t modify the audio stream in any way.

To extract the audio I ran the following. The -vn switch instructs ffmpeg to omit the video stream. The default behavior would be to output a video stream as well as audio streams. The -acodev switch tells ffmpeg what format you want the audio stream to be output as. In my case I didn’t want it transcoded so I specified “copy.”

$ ffmpeg -i slayer-rock-am-ring-2007.avi -vn -acodec copy slayer-rock-am-ring-2007.mp3

Now I just need to find a tool to break mp3s into audio tracks without re-encoding.


This entry was posted in Geek, Tips. Bookmark the permalink.

2 Responses to Extracting Audio From Video

  1. Does using -acodec copy save disk space or only processing time?

  2. greg says:

    -acodec copy saves processing since it just strips the audio from the video file without doing any processing. The other benefit to that is that you don’t lose any audio quality due to re-encoding.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s