mp3check


latest version is 1.6.

mp3check is a perl script that examines a set of MP3 files for CD-burning suitability. I wrote this for use with my Aiwa CDC-MP3 car player.

Basically, you run the thing: mp3check [list of files...], and it'll check important things:

mp3check can dig through subdirectories, too, with the --recurse option. For example, let's say you've got a whole volume of music in /opt/mp3 that you want to check. Just point mp3check at it as such:

mp3check --recurse /opt/mp3

The other really handy option, responsible for the bulk of the script's code, is the --interactive switch. The script will check as usual for problems in your MP3s, but when it finds one, it prompts you to change it on the spot. This is, when covering gigs of MP3s, much faster than manually mv'ing every file that needs a track number or whatnot. Better still, interactive mode tries to take all the labor out of the process; it will attempt to construct the best human-readable song title from the file name and the most legible 31-character filename. It will remember the last artist and album you specified, and it will let you tag directories at a time with this information. It won't do anything destructive without your explicit approval everytime. It will bake the freshest cookies and monitor for signs of extra-terrestial intelligence in the universe.

Basically, it's a huge help. Depending on how much you trust the program, you can just blindly keep hitting enter to have it fix everything (except track numbers) without any conscious input or effort from you. There's even a "--force-defaults" option that can let the program try to autocorrect things if you're the gambling type.

Other important command line options:
--verbose to print more output to stdout.
--ignore-fnsize if you aren't concerned with a 31-char filename limit.
--ignore-playlists if you don't want to be alerted to playlist existance.
--help, which will give you the rest of the multitude of options that I'm too lazy to list here.

Please note that this script requires a program called id3tool to be in your path. mp3check uses this to check and alter ID3 tags in the MP3 files. You can get id3tool here.

Actually, id3tool is no longer required, and there's a command line to disable its use in version 1.1, but the script is MUCH less valuable without it. Another utility used in version 1.1 is mp3_check (no relation, I swear.) This is less important than id3tool, but still very handy. mp3_check can be found here. This is for checking the internal consistency of the MP3 files. It's use can also be disabled by command line.

As of version 1.5, you can use LAME to reencode MP3s to a certain bitrate/samplerate. LAME can be found here.

If you're sick of all these command lines, you can fill them into a file so you won't have to type them every time: ~/.mp3check. As of version 1.1, that is.

This script is licensed under the GNU General Public License. A copy of the GPL is available here. If you can not abide by these terms, do not download the script. Then again, it's pretty hard to violate the GPL when there's no compiled form of the code, huh? Regardless, it's a good idea. Or something. If nothing else, please reread the section that has the words NO WARRANTY in big letters. Thanks.

It's also important to note that this is the first serious perl I've written, and it shows; some things are not as efficient as they can be, and some are working, but aren't "good perl." In fact, the whole thing reeks of a Perl script written by a C coder. It works for me, though, and I welcome pointers on and taunts about my style.

Patches, thoughts, complaints, and warm, moist love can be sent to ryan.

Enough chitchat; the script is here.

FreeBSD users: Apparently, you can get mp3check through the Ports system. Being a Linux weenie, I've never tried it, but I'm sure this will be handy for the FreeBSD crowd. To install, just do this:

pkg_add -r mp3check

or this:

cd /usr/ports/audio/mp3check ; make install

Thanks to Mark Pulford for maintaining that package.


Revision history:


--ryan c. gordon. (icculus@icculus.org)