Access MP3 audio data independently of ID3 tags?
this is a 2 part question. First off, is it possible to access the audio data in an MP3 independently of the ID3 tags, and secondly, is there any way to do so using available libraries?
I recently consolidated my music collection from 3 computers and ended up with songs which had changed ID3 tags, but the audio data itself was unmodified. Running a search for duplicate files failed because the file changed with the ID3 tag change, but I think it should be possible to identify duplicate files if I just run a deduplication using the audio data for comparison.
I know that it's possible to seek to a particular position past the ID3 header in the file, and d开发者_Go百科irectly read the data, but was wondering if there's a library that would expose the audio data so I could just extract the data, run a checksum on it, and store the computed result somewhere, then look for identical checksums. (Also, I'd probably have to use some kind of library when you take into account variable length headers.)
Coincidentally I wanted to do something similar the other day.
Here is a Ruby script that I whipped up:
http://code.google.com/p/kodebucket/source/browse/trunk/bin/mp3dump.rb
It dumps mpeg frames to stdout, so one could grab a checksum like so:
# mp3dump.rb file.mp3 | md5sum
精彩评论