Tuesday, August 28, 2007

Slicing and Dicing mp3 files

As I've likely mentioned before, one of the things I like about my new
car is the USB port right in the front panel of the stereo. I bought a
wee little Lexar Jumpdrive Firefly recently which I keep filled with various
folders of music and podcast mp3 files. I just stick it into the
stereo and it works. It's a nice, simple, and open system - no
proprietary hardware or software interface, any usb stick and plain
mp3 file will do. Heck, it doesn't even wanna play wma files which is
a good thing too! :)

But if there is one nagging thing I don't like about it, it's that the
ffwd and rewind functions are designed for music and not podcasts. So
if I'm 45 minutes into an episode of TLLTS, and my daughter wants to listen
to the Irish Rovers, I know I'll have to ffwd through 45min of TLLTS
to get back to where I was later on. That means holding the ffwd
button for about 5 minutes - not ideal.

So naturally, what I do is make a mental note of the time elapsed
before switching to a different track and then (if I remember) I bring
the track into Audacity and cut off the first 45min of it (or whatever
the elapsed time was). Still kludgy at best.

But I've found a quicker if not less-kludgy way of doing it. If you
need to chop off the beginning, the end or some portion of a given
mpeg file (mpeg2, mp3, mpeg4), then mpgtx is your tool of choice.
Available for linux or windows, this nifty command line tool sounds
like a nice tool for quick mpeg slicing and dicing. In particular to
do what I wanted, I simply used:

mpgtx -s tllts_206.mp3 [45:00-] -b cut_tllts_206

This splits (-s) the input file (tllts_206.mp3) taking the portion
starting at 45min to the end of the file, and outputs it to
cut_tllts_206.mp3. The -b flag is for the basename.. haven't figured
out that one, but you need it there for it to work.

So in a matter of 2 or 3 seconds it chops the first 45min off of the
file and gives me a new mp3. Nice!

Doing this same thing in Audacity was a chore. It would take a minute
or so for Audacity to import the mp3, I'd chop off the front 45 min
and then have to export it back out which took another minute or so.
Then, depending on the default export bitrate, I might get a bigger
mp3 file than the original (!). So in one fell swoop I cut the process
from 3 minutes to 3 seconds. Not bad.

Incidentally, what I likely *should* do, is split up longish podcast
files into 10 minute mp3 files. So if I need to find my place I can
just click through 10minutes at a time. I figured out how to do this
back in the comments of this post. Sheesh.. if only I was half as organized and prepared as I'd like to be. :)

0 comments: