Library to get audio metadata from large sets of files

I don't know if this forum is the right place to ask this question as this is more related to the ecosystem than the language itself, so feel free to remove this topic if it doesn't belong here.

I'm currently building a media server for audio streaming, and the part where I'm struggling is the index building. I need to get the metadata (title, album, artists, composer, release year, cover, lyrics, etc.) from dozens of thousands of local files, which can be in very various formats (MP3, OGG, WAV, FLAC, ALAC, etc.). My initial goal is to support just MP3 and FLAC, then M4A WEBM and OGG, and then less-used formats such as ALAC or DSD.

The problem is that I can't find any library that does the job for that. For MP3 only there is the excellent id3 crate which does what almost everything I want, but for FLAC there's only the metaflac crate which is almost unmaintained (~ 10 commits in the past 2 years) and which only allows to get raw tags, it doesn't have a compatibility layer like id3 which would allow to do .title(), .album() etc.

Also, these crates don't allow to get the duration of the track, which AFAIK needs to read more informations in the file to determine it as it's usually not stored as a tag. I only found audio-duration which is unmaintained anymore.

I've tried running shell commands like ExifTool but it has a lot of problems like variable types in the JSON output, and some weird conversions (an album's title named True will be converted to the true boolean, meaning we lose the name's case).

So, do you know any library / command-line tool with proper JSON interface / ... which could do the job? I've looked for quite a bit of time but I can't seem to find any...

Thanks in advance for your help!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.