3
1
The LAME encoder stores a CRC16 checksum of the audio stream in the header of every MP3 it encodes. The 'actual' audio checksum can then be computed and compared to the original value at a later date to verify whether the audio has been damaged (without having to worry about ID3 tags and the like changing the computed value).
On Windows, there was a command-line utility called LameTag that was capable of computing the checksum and comparing it to the original. Unfortunately, it's abandoned and probably not easily portable to OS X, which of course is what I use. I think EncSpot is capable of doing the same, but again it is Windows-only.
My question is: Are there any utilities like this that are compatible with Mac, Linux, BSD, or similar?
There are a few I've found that can show the original CRC (like eyeD3
), but they can't compute the current one. There are also several utilities that claim to check for corruption in MP3s, but I haven't found any that actually use the MusicCRC frame — most of them seem to be using a more generic method of checking, or else they use frame CRCs (which are disabled by default in LAME and can't be relied on).
edit:
I guess i've answered my own question. In trying to research this, i stumbled across a Python script for mutagen, QuodLibet's audio meta-data library. The script is designed to read LAME's Info Tag, and although it does not deal with either of the CRC fields specifically, i was able to create something that does based off of its example. After a few hours of messing with things (i'm a terrible programmer and know absolutely nothing about Python) i finally managed to write something that, although featureless and slow, does return the original CRCs and compute the new ones:
# Known good track
kapche-lanka:test % ../mp3crc.py "10 - CLAW FINGER.mp3"
10 - CLAW FINGER.mp3:
Original MusicCRC: 8171
Computed MusicCRC: 8171
Original Info Tag CRC: AEFD
Computed Info Tag CRC: AEFD
# Known bad track
kapche-lanka:test % ../mp3crc.py "10 - Griffons Never Die.mp3"
10 - Griffons Never Die.mp3:
Original MusicCRC: 2014
Computed MusicCRC: BCF1
Original Info Tag CRC: DF02
Computed Info Tag CRC: DF02
I will update this post one more time to add a link to the script, whenever i get it working in a more serious fashion.
Thanks!
edit2:
I've added a link to my script below (see accepted answer). It's called mp3crc
and, although not expertly designed, it seems to work for the most part:
Recommend you port that tool: http://phwip.wordpress.com/home/audio/ it is unfortunately written in Pascal.
– dlamblin – 2011-11-18T20:01:45.153Sadly it is far beyond my ability to port Delphi applications (or probably any others) to UNIX. :/ – kine – 2011-11-18T20:06:21.167
Yeah I tried the Free Pascal Complier in Delphi mode and it told me it doesn't support APPTYPE on Linux and it couldn't find TnTClasses. – dlamblin – 2011-11-18T20:20:20.840
You'll probably need to remove the
– afrazier – 2011-11-18T21:34:39.880$APPTYPE
declaration, and TnTClasses is part of the TNT Unicode Controls.@afrazier well, you'd need to replace the TntSystem and TntSysUtils with something providing the same functionality. We could port this to C, D, Perl, Python, Java? Or just drop in replacements somehow. TntClasses requires Windows which isn't there, granted LameTag.dpr requires Windows too. – dlamblin – 2011-11-21T06:09:16.187
@dlamblin: I've got no familiarity with FPC, though a fair amount with Delphi, so this is all guessing on my part. I'd expect that the TnT bits could all be refactored out with similar routines from the FPC RTL (or a current Delphi RTL) relatively easily. In fact, it took me about 10 minutes with Delphi XE to strip out the TnT stuff and get a build that seems to work. All the version info stuff is broken though, since that all relied on TnT and I didn't feel like finding an implementation right now. – afrazier – 2011-11-21T15:49:26.533