5 ms·
Ask HN: How to create a small unique fingerprint of a 25h+ audio book?
I'm the author of m4b-tool (https://github.com/sandreas/m4b-tool) and I noticed, that there are not many sources for audio book chapters (especially non english ones) to tag my audio books correctly.
So i decided to create my own database for chapters, but at the moment i am struggling how to identify audio files correctly.
With ffmpeg extension chromaprint it is possible to create fingerprints of audiofiles:
ffmpeg -i "input.mp3" -f chromaprint fingerprint.txt
This works nicely, but the longer the audio file, the bigger the fingerprint (which is reasonable). Since i would like to store the fingerprint in a database, the smaller it would be, the better.
But for a 25h+ audio book the process takes extremely long and produce a ±5MB (!) fingerprint file.
I can think of three ways to solve this problem:
- Only take the first X Minutes of the audio file (fast, relatively small fingerprint storage, but inaccurate)
- Hash the full fingerprint with e.g. sha512 (small fingerprint storage, but slow and is this accurate?)
- Hash the X Minutes fingerprint (fastest, small fingerprint storage but most inaccurate)
Which would be the best way?
Are there other ways, i did not think of?
Thank you
- flatfilefan 8y agoHave you seen musicbrainz? https://musicbrainz.org https://musicbrainz.org
- sandreas 8y agoYes, thank you. MusicBrainz actually uses the same fingerprinting technique i like to use (chromaprint / AcoustID), which is open source, see https://wiki.musicbrainz.org/Fingerprinting https://wiki.musicbrainz.org/Fingerprinting. And yes, they also store audiobooks, e.g. Harry Potter and the philosopher's stone: https://musicbrainz.org/release/e2310769-2e68-462f-b54f-25ac8e3f1a21 https://musicbrainz.org/release/e2310769-2e68-462f-b54f-25ac... Unfortunately, only the most famous audio books are stored in the database. If you look for the author Jay Kristoff, you don't find anything. In the meanwhile i found a resource, where the comparison of audio fingerprints is explained: https://groups.google.com/forum/#!msg/acoustid/Uq_ASjaq3bw/kLreyQgxKmgJ https://groups.google.com/forum/#!msg/acoustid/Uq_ASjaq3bw/k... So according to this explanation it would be a very bad idea to store the sha256-hash of the fingerprint, since they do not exactly match every time they are generated. So i think that the fingerprint has to be created on the first minutes of the audiobook and stored completely. Comparing has to regard additional shift, if the fingerprint of two candidates is not starting at the same point in the audio book, e.g. when an intro has been cut of or something.
- flatfilefan 8y ago“Unfortunately, only the most famous audio books are stored in the database.“ Anyone can upload new entries there AFAIK. They also have a workflow to dedupe works manually that you’d probably need to otherwise implement yourself too. Do you think you’ll be able to add a lot of value reinventing this wheel? I’m honestly curious because I was thinking about mp3 fingerprinting in my collection as some point and went for Apple Music instead at some point (which is also less than ideal).
- sandreas 8y agoYou are right... you can add releases: https://musicbrainz.org/doc/How_to_Add_a_Release https://musicbrainz.org/doc/How_to_Add_a_Release But i did not find any documentation, how to do this programmatically / via API, which would be essential for m4b-tool. It's not like I want to criticize your proposal. You are absolutely right, yet another track / chapter database would not be very helpful in general - but the things that i could find out about musicbrainz do not really fit my needs. Especially, because musicbrainz is more for music than for audiobooks. In my opinion, the usability of the web interface, the filtering options and the api of musicbrainz are not always helpful... An example: Open musicbrainz.org and try to find "Harry Potter" with the search bar on the upper right. It's nearly impossible without further investigation. Sure... you could provide the authors name "Joanne K. Rowling" and then do a facetted search for the title, but in my opinion this could be much better. m4b-tool is able to use the music-brainz-id for loading chapters and tagging audiobooks. But another problem is, that there is a shift between the cd version, mp3 version, download version etc. of the audiobook. So chapter marks have to be matched via silence detection and best fit, which is not always 100% accurate... I am working on an audiobook database, that contains very sophisticated filtering options. It's a project just for fun and perhaps it will never be released / online :-) I could certainly do better with my time and the value is questionable, but as long as it's fun... ;)
- flatfilefan 8y agoAPI is kinda here: https://acoustid.org/webservice#submit https://acoustid.org/webservice#submit "The AcoustID web service currently supports only two operations, searching in the fingerprint database and submitting new fingerprints into the database." But I believe you can just reach out to whoever is behind MusicBrainz or Acoutstid and get some information to make a better decision.