Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug found : media type is "al" #274

Closed
garfieldairlines opened this issue Dec 16, 2022 · 19 comments
Closed

Possible bug found : media type is "al" #274

garfieldairlines opened this issue Dec 16, 2022 · 19 comments

Comments

@garfieldairlines
Copy link

I am using gonic with bonob and I noticed that on 5+ minute tracks it suddenly skips and plays the next track in the list. If I am lucky enough I can see on the Android App that there is a "problem with the file encoding".

Except it isn't the case : I can use gonic + Symfonium or Sonixd without any tracks skipping or stopping.
Using airsonic-advanced with the built in sonos integration also works perfectly on the sonos system.

No extra compression or transcoding is being used in any case. Sadly it's quite hard to get logs since that system isn't really open source friendly…

@garfieldairlines
Copy link
Author

garfieldairlines commented Dec 16, 2022

I think I found something interesting,
Again the song is playable in airsonic-advanced or even VLC but I managed to snatch out a error message on another song using Sonixd (where it is impossible to play) :

<subsonic-response status="failed" version="1.15.0" type="gonic">
<error code="70" message="error finding media: media type is unknown: "al""/>
</subsonic-response>

If needed here's a sample : https://garfieldairlines.net/temporaire/In%20My%20Mind.flac

@garfieldairlines garfieldairlines changed the title Sonos + bonob + gonic : on longer tracks there is a "problem with the file encoding" and stops playing Possible bug found : media type is "al" Dec 16, 2022
@sentriz
Copy link
Owner

sentriz commented Dec 16, 2022

hm it looks like bonob is asking gonic to play an album, not a track. you should see in your logs stream.view?id=al-123 do you see that?

@garfieldairlines
Copy link
Author

I am getting that with Sonixd :

2022/12/17 08:30:40 response  206  for `/rest/stream.view?c=sonixd&id=tr-13467&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:54 response  200  for `/rest/getTopSongs.view?artist=Skeler&c=sonixd&count=100&f=json&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:54 response  200  for `/rest/getArtist.view?c=sonixd&f=json&id=ar-367&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:54 response  200  for `/rest/getArtistInfo2?c=sonixd&count=15&f=json&id=ar-367&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:57 response  200  for `/rest/getAlbum.view?c=sonixd&f=json&id=al-3414&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:57 subsonic error code 70: view not found

2022/12/17 08:30:57 response  200  for `/rest/getLyrics.view?artist=Skeler&c=sonixd&f=json&p=REDACTED&title=In+My+Mind&u=admin&v=1.13.0`

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 response  206  for `/rest/stream.view?c=sonixd&id=tr-13459&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 response  206  for `/rest/stream.view?c=sonixd&id=tr-13459&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 response  206  for `/rest/stream.view?c=sonixd&id=tr-13459&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 response  200  for `/rest/getCoverArt.view?c=sonixd&id=al-3414&p=REDACTED&u=admin&v=1.13.0`

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:57 admin requests Skeler - In My Mind from In My Mind

2022/12/17 08:30:58 response  206  for `/rest/stream.view?c=sonixd&id=tr-13459&p=REDACTED&u=admin&v=1.13.0`

I tried all links and it's the "getLyrics.view" that gives back the "view not found", which stops the music from playing in a player, else "stream.view" is working fine.

@sentriz
Copy link
Owner

sentriz commented Dec 26, 2022

ok nice, then I added an empty lyrics.view, let me know if that helps

sentriz added a commit that referenced this issue Dec 26, 2022
@garfieldairlines
Copy link
Author

Hi, I'm afraid it still doesn't work… I can't find any clues right now but I'll keep you updated if I find something…

Maybe it's because I'm getting a 206 response instead of 200 but I would be surprised that this would be the issue, I'm looking around.

@garfieldairlines
Copy link
Author

garfieldairlines commented Dec 26, 2022

Okay it's driving me nuts, it doesn't work with Sonixd, with Sonos & bonob on another track after X seconds (300?) it skips to another track, on Symfonium it tells me the encoding is incorrect but with Sublime Music it is working fine!

Edit : Removing and reinstalling Symfonium helps.
Edit 2 : Even after restarting gonic and bonob docker containers and clearing the gonic cache folders, Sonos skips the track at approx. 4:55 saying it's not properly encoded. Same track can't be opened in Sonixd directly HOWEVER picking the track before in the album and forwarding to the next track works. It absolutely drives me crazy. (see capture)
image

Here's a longer song where I got these issues btw : https://garfieldairlines.net/temporaire/3%20Let%20the%20Rhythm.flac

@sentriz
Copy link
Owner

sentriz commented Dec 26, 2022

hm, I wasn't able to reproduce it. Let the Rhythm was playing fine for me with sonixd, all the way through.

however I just made a change to master, can you try build again with that? or, if you're using docker try the ":nightly" tag when this job is done - should be about 10 minutes or so

EDIT it's built now, should be sentriz/gonic:nightly @garfieldairlines

@garfieldairlines
Copy link
Author

garfieldairlines commented Dec 26, 2022

Tried gonic nightly with a fresh new db, cleared the cache, also totally reinstalled Sonixd, for "Let the Rythm" it works but not for "In My Mind". I find nothing in the gonic logs however, trying to download the song from Sonixd gives me this link and still the same error :

/rest/download.view?id=al-3561&u=sonixd&s=ystFjlBvqkNhEXMk&t=b8f43b53a84256cae4bb4d799dc8a1b6&v=1.13.0&c=sonixd

<subsonic-response status="failed" version="1.15.0" type="gonic">
<error code="70" message="error finding media: media type is unknown: "al""/>
</subsonic-response>

Edit : hm, that error appears with every music

@sentriz
Copy link
Owner

sentriz commented Dec 26, 2022

ah, you're using the "download" feature on an album. i don't think you mentioned that. anyway that will give the "media type is unknown: "al"" error, since gonic doesn't support downloading full albums.

it shouldn't affect playback so we can ignore it for now. can you send me the "In My Mind" track has the playback issues?

@garfieldairlines
Copy link
Author

It's here : https://garfieldairlines.net/temporaire/In%20My%20Mind.flac

In between I think I found something interesting, I just did a resample of this specific song ( https://www.grimoire-command.es/2018/resample_flac_music_using_sox.html ) and now it works ! So there's definitely something in the current form of the file format that gonic does not like. I'll quickly look at the difference before and after resampling maybe I'll find something.

@garfieldairlines
Copy link
Author

The only difference that I find is that the first one is 44.1kHz and the second one 48kHz, but that's absolutely ridiculous. But I don't see anything else, putting both in the same folder, the first one works in Sonixd the other one doesn't.

@sentriz
Copy link
Owner

sentriz commented Dec 26, 2022

with the original file I ran with through ffprobe and it gave some sort of corruption error. so id say reencoding at the same samplerate will also fix it

however , Google chrome (raw, without sonixd) can also play the original file for me. so I'll so some investigation with the react audio player that sonixd uses + gonic as a raw file server

@sentriz
Copy link
Owner

sentriz commented Dec 27, 2022

hey i did some more testing, for example with works.flac and noworks.flac (let the rhythm and in my mind)

20221227_015814.mp4

it was a sort of minimal reproduction test with a simple go http fileserver that gonic uses, and react-audio-player that sonixd uses

as expected works.flac works, and noworks.flac does not work. but what's strange is while react-audio-player's onerror hook runs for noworks.flac, is doesn't print anything useful. just an error object for noworks.flac and nothing else - that i can find

the project is here if anyone is interested (just needs a go run main.go then visit http://localhost:3000/?p=/f/works.flac or http://localhost:3000/?p=/f/noworks.flac) maybe you will have better luck than me

though for the meantime @garfieldairlines I would just recommend running some sort of validator on your audio files. maybe badfiles for beets, or maybe ffprobe which shows the error:

image

(let the rhythm shows no error, while in my mind does show an error)

@garfieldairlines
Copy link
Author

Interesting, I'll just run sox through the files having a problem and it's good, I guess.

Weird bug tho…

@garfieldairlines
Copy link
Author

So, I'm doing more digging on my side, Sonos still cuts it at 5 minutes (with other albums too) saying the encoding is incorrect, even if I did things like flac → wav → flac reencoding or whatever. Surprisingly even playing it in opus_128 (or any other track of that compilation) gives that 5 minute error.
I will investigate a bit more, if I find something interesting I will tell you.

@garfieldairlines
Copy link
Author

Okay, I think I found out, and of course you can't reproduce it if you don't have a sonos system :

Basically it needs a "S1" and "S2" (I will personally need S2) flac → flac transcoder because these things are picky…
ffmpeg -i %s -af aformat=sample_fmts=s16|s32:sample_rates=8000|11025|16000|22050|24000|32000|44100|48000 -f flac -

And for S1 :
ffmpeg -i %s -af aformat=sample_fmts=s16:sample_rates=8000|11025|16000|22050|24000|32000|44100|48000 -f flac -

Tell me, I know absolutely nothing with go, do I need to recompile it in any way or can I just "on the fly" edit the transcode.go file ? I'm not a dev at all (I'm a sysadmin 😅 ) but I'm willing to give it a shot.

@sentriz
Copy link
Owner

sentriz commented Dec 27, 2022

howdy, there is an issue open for custom transcode profiles 👉 #244

but in the meantime as you mentioned, it should be possible to

  • clone the repo
  • edit transcode.go
  • docker build -t .
  • run with new instead

@garfieldairlines
Copy link
Author

Thanks for the instructions ! First time I made my own fork, uploaded it on docker compose and used it, I'm kinda proud of myself, even if it isn't a lot…

I managed to make myself some mp3 320 and opus 256 transcodes but for the life of me I can't make a proper flac transcode… I'm not that good with ffmpeg, I guess I'll wait for that feature to become available in the web interface. But again, thanks, I learned some stuff today!

@garfieldairlines
Copy link
Author

Hello, I am more than happy to tell you I found a way to fix that!
I placed a nginx reverse proxy, and it caches all flac music to redistribute it to sonos.

location ~* ^.*\.(flac)$ {
	proxy_cache public-cache;
	proxy_cache_key $host$request_uri;
       proxy_cache_valid any 15d;
	proxy_ignore_headers Set-Cookie Cache-Control Expires X-Accel-Expires;
}

Since then, no more skippings on my Sonos system ! It's not directly a fix to gonic itself, but maybe it can help you somehow in the future, if a similar case arises again.

Again, I am grateful for the existence of gonic and I want to thank you for that pretty software… and your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants