Wednesday, August 21, 2013

MisicBrainz Picard (and FFMpeg and Chromaprint) in CentOS

I had some unidentified tracks that I wanted to identify.  I knew that there were apps that would "listen" on the microphone of a phone to a song to identify it, and that lead me to believe that there would be a webservice out there I could call with the MP3's to identify them.

A quick Google search turned up a program called "Picard", by "MusicBrainz".  They even had a "Linux" interface for it.

For those who are impatient and want to install this, there are two dependencies - ffmpeg development packages (a result of the next dependency) and chromaprint.  Here's how to install everything :

  1. Install ffmpeg by doing :
    1. Using RPMForge, follow the instructions at :
    2. Then, install ffmpeg and libraries :
      yum install ffmpeg ffmpeg-devel
  2. Install chromaprint (download, extract, and CD into the directory - remember, we installed ffmpeg to an odd directory above, tweak if this is in a normal place) :

      make install
  3. Ensure you have the libraries for chromaprint installed :
    all chromaprint (download, extract, and CD into the directory - remember, we installed ffmpeg to an odd directory above, tweak if this is in a normal place) :

      ldconfig -p|grep chroma

    If nothing shows up, add /usr/lobal/lib to /etc/ and run "ldconfig" again.
  4. Install picard by grabbing the code from, extract it, cd into it, and run :

      python install

    This should install it for you.  Run it using the command picard.
For those that want to know how I got to this point, this is how I got it installed, and tried it.

First, I grabbed it from (using the Linux source as I didn't want to deal with cross-distribution RPM's).  Pulling it down, I found it to be a python based installation (not the usual "./configure && make && make install").  I checked the INSTALL.txt and found what I needed.  Once inside the source directory, run :
    python install
This will install the code for you.  I also ran into a few issues with missing python modules.  The ones I had problems with are PyQt4.x86_64 and mutagen

So, in order to get the interface to launch, I had to run :
    yum install PyQt4.x86_64 python-mutagen.noarch
This allowed the interface to run, but I was getting :
    Fingerprint calculator failed error = No such file or directory (0)
This is a result of not having chromaprint's "fpcalc" program (the packages fingerprint calculator, which is actually sent to the web service and used to find the song information from an accoustic perspective).  In trying to get that one installed, I ran into the following error :
    FFTW3 lib not found. Set FFTW3_DIR to find it.
    CMake Error at CMakeLists.txt:114 (message):
      Neither FFmpeg with avfft.h nor FFTW3 found
Hrmmmm.  I need FFMpeg for the encoding, and it must apparently be the development.  That package starts to become a little "extreme" for a few people, but I was actually stunned that I hadn't installed it myself (it's usually one of the first things I install).  So, I had to install it.  It's a matter of following (standard instructions), and then :

yum install ffmpeg ffmpeg-devel
    yum install ffmpeg ffmpeg-devel
I had some conflict errors, so had to throw in a few "--disablerepo dag --disablerepo rpmforge" options and manually install a package, but got ffmpeg installed.  Next, I had to compile and install chromaprint :
    make install
It tossed /usr/local/bin/fpcalc onto the filesystem, and this time, we got :
    Network request error for Error downloading - server replied: BAD REQUEST (QT code 299, HTTP code 400)
    Fingerprint lookup failed: u'invalid fingerprint'
THEN I figured out the "scan" wasn't the right thing to do - invalid fingerprinting.  I was supposed to be using "locate", not "scan".  Cool!

No comments:

Post a Comment