Hackery

| | Comments (1)

So, let's say you have a bunch of DivX 5.0-encoded AVI files of a live concert. And you really like these files, and have them playing all of the time -- not so much so that you can watch, but so that you can listen to the music. Well, at that point, it sure would be a lot more convienant if these files were mp3 files, instead of DivX video files.

And let's further suppose that this very situation happened to a certain someone who owns this blog, and that he decided to hack his way out of it. This is what you might do:

ffmpeg -acodec copy -i Denali02-Blackcat-Apr2003.avi 02.mp3 -map 0.1:0

The 'ffmpeg' command is an open source project for recording, encoding, and slicing video and audio files. I had a vague notion of this program (I remembered installing the FreeBSD port as a dependency for something more interesting, like VLC I think). But a little googling brought be back to this program, and the above command line (applied to each of my video files) was exactly what I wanted.

I know that I could have used some program like "Audio Hijack" in order to get the raw audio, but then I would have had to re-compress it into mp3 format, and that would have been too lossy for my tastes. Instead, I wanted to simply demux the video files, stripping off the audio stream and saving it to a separate file. Which is exactly what the "-acode copy" flag did -- it specified that the audio codec to be used in the transcode should be a straight copy. The other bit of magic is the "-map" flag, which performs a one-to-one mapping from a stream in the input file to a stream in the output file. VLC said that the audio stream was stream #1, but according to ffmpeg, it was stream #0.1. Go figure.

But anyway, now I have my mp3 files, and they are in iTunes, and based on the lyrics, I am figuring out which song is which. Awesome!

-Andy.

1 Comments

Mark said:

Again, the rocking is not to be stopped. Not even by technical matters.

Leave a comment

About this Entry

This page contains a single entry by Andy Reitz published on April 16, 2004 12:39 AM.

Commercials was the previous entry in this blog.

Outsourced is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01