sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.49k stars 105 forks source link

Add mka and ac3 Support #453

Closed jeffgt14 closed 5 months ago

jeffgt14 commented 5 months ago

gonic version: 0.16.2

if from docker, docker tag: Custom built from git Master if from source, git tag/branch: Master

Would it be possible to add support for these mime types? Most DVD concert rips contain AC3 audio. I usually use mka as the container for it but ac3 is usually the standard container.

In previous gonic versions, I've been able to add them to mime.go and the scanner would pick them up but doesn't look like that file exists anymore. I've attempted to add them to taglib.go myself and build a docker image but I haven't been successful there so likely doing something wrong.

sentriz commented 5 months ago

what's the file extension? and are there any example files online to test?

mime inference is now delegated to go's stdlib and shared-mime-info, it should just be a matter of updating taglib.go CanRead() as you mentioned

jeffgt14 commented 5 months ago

.mka and .ac3 are the extensions.

There's samples for ac3 but not sure if there's any for mka. https://filesamples.com/formats/ac3

audio/x-matroska is the mimetype for mka https://mimetype.io/audio/x-matroska

I tried adding to https://github.com/sentriz/gonic/blob/master/tags/taglib/taglib.go#L16 but was unsuccessful.

sentriz commented 5 months ago

thanks I'll try that. can you elaborate on it being unsuccessful? did you get errors?

jeffgt14 commented 5 months ago

No errors, folder is just empty because it's not seeing any media.

sentriz commented 5 months ago

an errors in the gonic logs? if the CanRead was updated it will attempt to read tags

jeffgt14 commented 5 months ago

Ok so it looks like the issue is Gonic ignores all files without tags as I noticed this same error in the logs even for FLAC files that do not have any tags. I figured this would be an issue when browsing by tags but less so when browsing by folder structure. Navidrome has audio/x-matroska listed as a mimetype so the database sees the file and I can play it, but it cannot read tags so defaults to [Unknown Artist] [Unknown Album].

"/Music/Metallica/2003 - St. Anger Rehearsals (62853-2) [DVD]": populate track "01 - Frantic.mka": cannot process
/Music/Metallica/2003 - St. Anger Rehearsals (62853-2) [DVD]/01 - Frantic.mka: could not read tags

Mp3tag can write Matroska tags to files but doesn’t look like Taglib has the support yet. Looks like it may be a few weeks away though so perhaps I should wait and see how that plays out. Interestingly, VLC can read these tags and it supposedly uses Taglib as well. https://github.com/taglib/taglib/pull/1149

I could put AC3 audio into a MPEG-4 container but I’m not sure I want .m4a as an extension for both AAC encoded files and AC3 encoded files as my transcoding script reads the file extension to determine the transcoding parameters.

.ac3 support may be out of the mix entirely since it's a raw file and untaggable. I'm ok with that as I believe matroska should be the standard container for AC3.

sentriz commented 5 months ago

OK then sounds good to wait until taglib supports it