beetbox / pyacoustid

Python bindings for Chromaprint acoustic fingerprinting and the Acoustid Web service
MIT License
325 stars 66 forks source link

Error in getting raw fingerprint #27

Closed vinothini22 closed 9 years ago

vinothini22 commented 9 years ago

I am trying to get raw fingerprint using pyacoustid as following, python fpcalc.py -raw a2002011001-e02.wav

But getting error chromaprint.FingerprintError in the line File "fpcalc.py", line 51, in main raw_fp = chromaprint.decode_fingerprint(fp)[0]

What is the reason here? Am I doing anything wrong?

sampsyo commented 9 years ago

Thanks for reporting. Do you have the full traceback for the exception?

lalinsky commented 9 years ago

There was a bug in chromaprint, where the chromaprint_decode_fingerprint function returned 0 instead of 1 on success. I think that's the most likely cause. Upgrading chromaprint should fix the problem.

vinothini22 commented 9 years ago

Here is the full traceback

Traceback (most recent call last):
  File "fpcalc.py", line 61, in <module>
    main()
  File "fpcalc.py", line 51, in main
    raw_fp = chromaprint.decode_fingerprint(fp)[0]
  File "/home/projects/pyacoustid/chromaprint.py", line 143, in decode_fingerprint
    ctypes.byref(algorithm), 1 if base64 else 0
  File "/home/projects/pyacoustid/chromaprint.py", line 89, in _check
    raise FingerprintError()
chromaprint.FingerprintError

@lalinsky Thanks. will try upgrading chromaprint.

vinothini22 commented 9 years ago

I tried compiling chromaprint latest version from source,but getting this error

Linking CXX shared library libchromaprint.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(dct.o): relocation R_X86_64_32S against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [src/libchromaprint.so.0.2.3] Error 1
make[1]: *** [src/CMakeFiles/chromaprint.dir/all] Error 2
make: *** [all] Error 2

Whereas sudo apt-get install libchromaprint-dev works but it installs version 0.6-1

I tried installing via debian dsc package also,

dpkg-source -x chromaprint_1.1-1.dsc 
cd chromaprint-1.1
dpkg-buildpackage -rfakeroot -b

Still no use,

dpkg-buildpackage: source package chromaprint
dpkg-buildpackage: source version 1.1-1
dpkg-buildpackage: source changed by Simon Chopin <chopin.simon@gmail.com>
dpkg-buildpackage: host architecture amd64
 dpkg-source --before-build chromaprint-1.1
dpkg-checkbuilddeps: Unmet build dependencies: libavcodec-dev libavformat-dev libavresample-dev libgtest-dev
dpkg-buildpackage: warning: Build dependencies/conflicts unsatisfied; aborting.
dpkg-buildpackage: warning: (Use -d flag to override.)

Unable to install those dependencies too :(

@lalinsky Please could anyone tell me the procedure to install latest chromaprint version and its dependencies properly?. It is taking so long time, still couldn't get pass the installation to try out the library.

lalinsky commented 9 years ago

Well, you have a static build of FFmpeg in /usr/local and you can't use that to build a shared library. The debian package should build if you install the dependencies it mentions.

Based on the version, I guess you are using ubuntu 12.04? If that's the case, the simplest option would be to use this package: http://build.oxygene.sk/job/package-deb-chromaprint/label=precise64/ I'm building those for myself, so they do not use the standard versioning or naming, but that's the latest version.

Otherwise, my best suggestion is to use fpcalc -raw directly and download the compiled binary from https://acoustid.org/chromaprint

vinothini22 commented 9 years ago

Yes I am using ubuntu 12.04. Thanks a lot that latest version build worked. I can get raw fingerprint now. @lalinsky I didn't get your last point.Just curious to know. could you elaborate more on how to use that? By directly you meant fpcalc -raw command line utility?. and after downloading compiled binary form where to go from there?

lalinsky commented 9 years ago

Well, if the package works for you, then I'd use that.

What I meant is to not use pyacoustid, but simply execute fpcalc -raw file.mp3 and parse the output.

vinothini22 commented 9 years ago

Fine. Thank you for helping me out.