epoupon / lms

Lightweight Music Server. Access your self-hosted music using a web interface.
http://lms-demo.poupon.dev
GNU General Public License v3.0
1.07k stars 59 forks source link

Subsonic transcode enabling not available #351

Closed acidzab closed 9 months ago

acidzab commented 10 months ago

Hi, i wanted to try LMS for using it with Symfonium and Supersonic because i wanted to try the first Opensubsonic implementations (multi genre and multi artist are features very important for me).

Sadly i can't disable transcoding for Subsonic, i can't see anymore the option on the settings and the transcoding cause me some problems (i have almost flacs/alacs)

image

Many thanks :)

epoupon commented 10 months ago

I guess there may be a setting in symfonium to always request the raw file? @Tolriq can tell

epoupon commented 10 months ago

And @dweymouth can tell about supersonic

acidzab commented 10 months ago

There're options on symfonium for enabling transcoding, but i've transcoding options both disabled on Symfonium and Supersonic. When i use Navidrome with both of them i can stream in flac without problems, when i switch to LMS my files are getting transcoded from LMS because i can't disable the Subsonic transcoding with the "Enable transcoding" checkbox

Tolriq commented 10 months ago

In Symfonium when you edit the host you can check the option ignore server transcoding settings.

But this is a discussion I tried to have with @epoupon and another server, some default choices from the servers are hard to grasp and force things on client side to behave as the default should be.

epoupon commented 10 months ago

But if you set format to "raw", there is no transcoding done on LMS side. This is exactly what we need here?

acidzab commented 10 months ago

@Tolriq didn't know that, enabled and now it's working :) @epoupon yes that's what i need, but i don't know how to set that

dweymouth commented 10 months ago

I will have to add the raw setting to Supersonic. I did not bother with it since the default behavior of Navidrome and Gonic and I believe Airsonic as well is to not transcode unless explicitly enabled.

Tolriq commented 10 months ago

But if you set format to "raw", there is no transcoding done on LMS side. This is exactly what we need here?

Yes but by default if you do not set transcoding on server side for a client it should not transcode either.

Raw is to ignore the server settings, but not sending anything and not having transcoding on server side should not transcode either. And in the same idea when a maxbitrate is set it must be respected or failed.

Anyway we'll need to create a proper API for OpenSubsonic. But currently not that much servers are following :(

epoupon commented 10 months ago

What do you mean by "not that much server are following"? I think the legacy API mainly annoys clients and I would rather expect clients to request for changes?

But fine, I can resurect the global default transcoding, or even make it configurable per client, as it seems that is what other servers do.

Tolriq commented 10 months ago

I mean that servers that were part of the start of OpenSubsonic also needs to implement the changes so that everyone moves together. If only 2 servers follow this will create less impact on the global thing. This is still a win for the servers and clients implementing, but I hope that more will follow to start a trend on more servers and more clients too.

epoupon commented 10 months ago

This raises several questions to me:

dweymouth commented 10 months ago

I think transcodeOffset should just seek without changing encoding format if other transcoding options are disabled. I think the maxBitrate setting is just that - a max - and an MP3 128 file should not be transcoded to MP3 192 if that's what the client is requesting. But an MP3 320 should be transcoded, and an AAC 128 should be transcoded to MP3 192 (or maybe MP3 160 at server's discretion, since AAC 128 is roughly equivalent to MP3 160 in sound quality). If maxBitrate is set then the server should fail to stream if it can't be satisfied - as Tolriq mentioned - to avoid running up mobile users' data.

Tolriq commented 10 months ago

Upscale should probably not be done but I think a few servers still do it and it's not really documented for now. It's probably easier for now to do it for the transcodeOffset anyway.

transcodeOffset only works when transcoding, but the client should also send a format and a maxbitrate anyway with it. But transcodeOffset should work if advertised by the server and the client request transcoding via format and maxbitrate. As the clients have no way to actually know if it's active or not.

Anyway there's many new things to be done for a new API but currently how it should work: Client request format / maxbitrate the server must respect it and fail if it can't. If transcodeOffset is passed it must be obeyed. Client does not request anything. Apply the server settings if there's one for that client (but server should offer a way to not transcode by default). Client send raw as format respect it.

In the future, the API will be some kind of hey I want to play song XXX I support X,Y,Z codecs and XXX containers and other constraints like sample rate,... and I want a maxbitrate of 10000) Server answers: You can play this file directly or server can transcode to a supported format with params .... or can't play directly and can't transcode to a supported format.

dweymouth commented 10 months ago

@acidzab To resolve your particular issue, I've added a setting to the Playback tab of Supersonic to disable server transcoding (sending "&format=raw" in the stream request). If you are on a Debian-based Linux or Intel mac you can download the latest build artifact from Github actions, or if you are building from source you can try it now. Otherwise it will be in the next Supersonic release.

acidzab commented 10 months ago

@dweymouth thanks Drew, i built it into my msys env and tried it, it works :) sadly trying the ignore on both clients i've noticed a really slow buffering of the stream. Anyway i appreciate your works but i won't switch to LMS, i've a very large library and Navidrome seems the one who can handle it very well, i hope Deluan or the other guys will switch to OpenSubsonic standard.

Thanks for your effort on both sides and have a nice day 👍🏻

epoupon commented 10 months ago

@acidzab Curious about the scalability issue you hit with LMS? You mean the slow buffering?

acidzab commented 10 months ago

@epoupon yup i don't know why but when i use LMS in "raw mode" without transcode both Symfonium and Supersonic struggles to buffer the track when it's playing. That dosen't happen when i don't use the ignore mode on both clients

epoupon commented 10 months ago

This is strange. I just tested on my server: using raw format is about 10MB/s, and using opus format is about 500KB/s

Tolriq commented 10 months ago

@acidzab are you sure this is not something else here? Using raw remove the actions LMS could do and leads to network issue like proxy or docker. If it works when LMS transcode (so add cpu and actions) raw mode perf should be unrelated to LMS.

acidzab commented 10 months ago

@epoupon @Tolriq updating to latest version of LMS resolved the buffering problems 👍🏻