Command Line for generating fingerprints

1,030 views
Skip to first unread message

ijabz

unread,
May 6, 2011, 4:08:24 AM5/6/11
to Acoustid
Could you please make a command line version of Acoustid fingerprinter
available, or even better a cut down line version that lets you pass
it a file and it returns you the fingerprint, which I could then
independently pass to the Acoustic Id using your webservice. Id prefer
this to the command line tool submitting the fingerprint itself
because then I can limit the amount of code outside my preferred
language, and it allows me to directly control how I use the
webservice, handle errors ecetera.

This would allow me to get going with integrating acousticid and
trying it out properly. I know the 'correct' way for me to do this
would be to bind directly to the C lib but this still leaves the
problem of extracting the audio and so on, since you've already solved
these issues with the fingerprinter it would save a great deal of
headaches if you could provide the command line.

thanks Paul

Lukáš Lalinský

unread,
May 6, 2011, 5:22:12 AM5/6/11
to acou...@googlegroups.com

There already is this kind of tool in the source code ("fpcollect"),
but it's not very cross-platform and depends on a number of external
libraries (FFmpeg, Boost, TagLib). I'm planning to write a more
generic tool, but I'm still not sure about the audio decoding part.
FFmpeg is the obvious choice for me, I think using CoreAudio would be
preferable on OS X.

Lukas

Randall Mason

unread,
May 6, 2011, 6:16:22 AM5/6/11
to acou...@googlegroups.com
There is also the gstreamer version of said command. If you also run
a Linux somewhere where the files are accessible you can install
gst-chromaprint and gstreamer0.10-plugins-bad (on Ubuntu), you can
run:

rmason@slate:/btrfs/randall/music$ gst-launch-0.10 -t filesrc
location=01\ Animal\ Instinct.mp3 ! decodebin ! audioconvert !
ofa ! chromaprint duration=60 ! fakesink sync=0 | grep -i fingerprint

And you will get both a chromaprint and an ofa (Open Fingerprint from
MusicIP) fingerprint:

chromaprint fingerprint: [FINGERPRINT HERE]
ofa fingerprint: [FINGERPRINT HERE]

I used it to go through my whole collection and look for duplicates in
different formats:

find . -type f -print0 | xargs -0 -n1 -P1 -I{} bash -c 'echo "***";
echo "{}"; gst-launch-0.10 -t filesrc location="{}" ! decodebin
! audioconvert ! ofa ! chromaprint duration=60 ! fakesink sync=0 |
grep -i fingerprint' > chromaprints

Once again, I think only on Linux, but I don't know much about the
possibility of gst on Mac.

Randall Mason
ran...@mason.ch

2011/5/6 Lukáš Lalinský <lali...@gmail.com>:

ijabz

unread,
May 6, 2011, 6:47:48 AM5/6/11
to Acoustid
Ok that good to know, could a binary version of fpcollect be
available with any package requirements already included, i.e when you
install the fingerprinter I dont have to worry about any other libs,
it just works.

pault

unread,
May 6, 2011, 9:52:04 AM5/6/11
to Acoustid
Something for Windows would do for now

Lukáš Lalinský

unread,
May 7, 2011, 6:41:07 AM5/7/11
to acou...@googlegroups.com
On Fri, May 6, 2011 at 3:52 PM, pault <pault...@jthink.net> wrote:
> Something for Windows would do for now

I wrote a minimalistic version of the included tools, please let me
know if it works for you. Here are statically linked binaries for
Windows and OS X without any dependencies:

Windows
http://dl.dropbox.com/u/5215054/fpcalc/fpcalc.exe

OS X (Intel, probably works only on 10.6 too)
http://dl.dropbox.com/u/5215054/fpcalc/fpcalc

Source code
https://github.com/lalinsky/chromaprint/blob/master/examples/fpcalc.c

Lukas

ijabz

unread,
May 9, 2011, 7:22:05 AM5/9/11
to Acoustid


On May 7, 11:41 am, Lukáš Lalinský <lalin...@gmail.com> wrote:
> On Fri, May 6, 2011 at 3:52 PM, pault <paultay...@jthink.net> wrote:
> > Something for Windows would do for now
>
> I wrote a minimalistic version of the included tools, please let me
> know if it works for you. Here are statically linked binaries for
> Windows and OS X without any dependencies:
>
Hi both work great !

Supplementary questions, is there a minimum song length required to do
a good match (im guessing 60 seconds), should songs less than this
length not be fingerprinted ?
What are the effects of changing the length parameter ?
I have one mp3 that failed the fingerprint analysis, do you want it ?
Can we have a linux binary as well ?

Lukáš Lalinský

unread,
May 9, 2011, 7:48:12 AM5/9/11
to acou...@googlegroups.com
2011/5/9 ijabz <ija...@gmail.com>:

> Supplementary questions, is there a minimum song length required to do
> a good match (im guessing 60 seconds), should songs less than this
> length not be fingerprinted ?

The minimum length should be somewhere around 12 seconds. Songs that
are shorter than 50 seconds are treated differently and it still
attempts to match them.

> What are the effects of changing the length parameter ?

With the current settings, the server will match the query only if its
length difference compared to the database is within 7 seconds. I'm
planning to have this configurable by the application.

> I have one mp3 that failed the fingerprint analysis, do you  want it ?

Yes, definitely.

> Can we have a linux binary as well ?

Yep, I'll release a new version of Chromaprint and publish binaries
for windows/osx/linux. Btw, if you still have a PPC machine somewhere,
could you please test if http://dl.dropbox.com/u/5215054/tmp/fpcalc
works? It should work on i386 10.4+, but I'd like to verify that it
works on PPC as well.

Lukas

ijabz

unread,
May 9, 2011, 8:00:52 AM5/9/11
to Acoustid
>
> > What are the effects of changing the length parameter ?
>
> With the current settings, the server will match the query only if its
> length difference compared to the database is within 7 seconds. I'm
> planning to have this configurable by the application.
>
usage: fpcalc [OPTIONS] FILE...

Options:
-length SECS length of the audio data used for fingerprint
calculation (default 60)

Confused, I thought this was option so that you could specify how much
audio to use in the fingerprinting process but its sound like you have
to specify the actual length of the audio, so a default of 60 makes no
sense ?


>
> > I have one mp3 that failed the fingerprint analysis, do you  want it ?
>
> Yes, definitely.
>
k, Ill send you a link
> > Can we have a linux binary as well ?
> Btw, if you still have a PPC machine somewhere,
> could you please test ifhttp://dl.dropbox.com/u/5215054/tmp/fpcalc
> works? It should work on i386 10.4+, but I'd like to verify that it
> works on PPC as well.

I do have a PPC Mac Mini connected to my TV , but it died on me a week
ago, so depends upon if I can get that fixed, could be a while so you
might need to find someone else

Lukáš Lalinský

unread,
May 9, 2011, 8:07:00 AM5/9/11
to acou...@googlegroups.com
On Mon, May 9, 2011 at 2:00 PM, ijabz <ija...@gmail.com> wrote:
>>
>> > What are the effects of changing the length parameter ?
>>
>> With the current settings, the server will match the query only if its
>> length difference compared to the database is within 7 seconds. I'm
>> planning to have this configurable by the application.
>>
> usage: fpcalc [OPTIONS] FILE...
>
> Options:
>  -length SECS  length of the audio data used for fingerprint
> calculation (default 60)
>
> Confused, I thought this was option so that you could specify how much
> audio to use in the fingerprinting process but its sound like you have
> to specify the actual length of the audio, so a default of 60 makes no
> sense ?

Oh, sorry, I meant the webservice parameter. :) Yes, you are right,
this is option allows you to specify how much data to use for the
fingerprinting process. This is independent from the song length,
which you also have to send to the web service. That is, if you have a
file that has 3 minutes, you can calculate a fingerprint from the
first 60 seconds, send the fingerprint along with the information that
the complete song has 180 seconds (this is the number that has to
match +/- 7 seconds) to the webservice and get the result.

Lukas

ijabz

unread,
May 9, 2011, 8:41:56 AM5/9/11
to Acoustid

> Oh, sorry, I meant the webservice parameter. :) Yes, you are right,
> this is option allows you to specify how much data to use for the
> fingerprinting process. This is independent from the song length,
> which you also have to send to the web service. That is, if you have a
> file that has 3 minutes, you can calculate a fingerprint from the
> first 60 seconds, send the fingerprint along with the information that
> the complete song has 180 seconds (this is the number that has to
> match +/- 7 seconds) to the webservice and get the result.
>
> Lukas

Right back to the original questionif I chnage from 60 seconds to 30
seconds or 120 seconds what is the effect ?

Lukáš Lalinský

unread,
May 9, 2011, 9:46:25 AM5/9/11
to acou...@googlegroups.com

If you change it to 30 seconds, you might miss some matches. If you
change it to less than 20 (and the song is actually longer), you will
not get any matches at all. If you change it to a larger value, you
might avoid some false positive matches (e.g. if the track differs
significantly after the first minute). More than 120 seconds doesn't
make sense, because there are no fingerprints in the database with
more data currently.

Lukas

Reply all
Reply to author
Forward
0 new messages