Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick
brad

Detecting equivalance of audio files

After several days of hacking on MogileFS, I decided to switch gears today and work on personal stuff. I boiled my personal problems down to:
  • getting all my DVDs ripped
  • consolidating three computers' mp3s into one unified, tagged collection
  • finishing brackup
Somehow I decided that the answer to all the above was more disk space, so I bought the Norco DS-1220 which gholam had recommended (after deciding that the Port Multiplier support in Linux was basically mature). And researched the best disks to populate it with, but can get those later (Western Digital 500GB WD-5000YS)

After all that, I remembered I had a 300 GB external drive that I could use for mp3 consolidation scratch space. So on to that project....

Previously, my canonical location for mp3s was on my home server. Then my laptop kinda became the new place (and where I had everything auto-tagged, which I wrote on an airplane). Then I have some mp3s on my desktop at home. In other words: fucking gross.

Problem statement: How to merge all my music together?

Sub-problem: How to tell if two files are the same, if their paths are different, and their checksums are different (because, say, one's been tagged)?

Answer: decode the mp3/ogg to stdout, rather than a soundcard, and checksum the audio stream! (source: audmd5)

Demo:

$ md5sum "sammy/Weezer/02 Pinkerton/01 Tired of Sex.mp3"
b0298cdf1c2135f13d788863cb221ca3
$ md5sum "laptop/Weezer/1996-Pinkerton/Weezer - Pinkerton - 01 - Tired of Sex.mp3"
aa637f841945da67c2aad1f8c2b4ce16
$ audmd5 "sammy/Weezer/02 Pinkerton/01 Tired of Sex.mp3"
8c0952de1e8d13c3ab079adc4a21a400
$ audmd5 "laptop/Weezer/1996-Pinkerton/Weezer - Pinkerton - 01 - Tired of Sex.mp3"
8c0952de1e8d13c3ab079adc4a21a400

... one more tool in my arsenal to fight my mp3 collection.
Tags: perl, tech, unix
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 38 comments