amperfy icon indicating copy to clipboard operation
amperfy copied to clipboard

Support requesting media in different formats (transcoding)

Open hugoghx opened this issue 1 year ago • 7 comments

Hey, just discovered this project and I find it pretty neat!

I'm using Navidrome as my music server and my songs are all .ogg. I understand AVPlayer doesn't support that format, and as expected, when trying to play my songs, none really work.

This introduces a pretty large ask for anyone who wants to use this app: Either have it in a format supported by AVPlayer, or you can't use the app.

I think it could be very helpful to have a setting in the app where we could configure what media format we request from the server. For example:

  • Original
  • MP3
  • ...

I know Navidrome in particular supports transcoding media, however I'm not entirely sure what mechanism is used to deliver that transcoded media onto the client. I do, however, know it is possible, since substreamer does this -- Perhaps it's doing transcode on-device?

Either way, I think this would allow more people to be able to use the app in an easier way :)

Edit: The Subsonic API's stream call seems to take a format parameter. This seems to be the mechanism to request a different media format from the server

hugoghx avatar Jun 10 '23 06:06 hugoghx

I'm not very well versed in Swift or iOS dev, but here's some findings.

The functions that generate the calls for stream and download would need to take in the format the user chose in the settings.

We'd have to receive a format argument and pass that into createAuthApiUrlComponent, which would have to support adding that as a new parameter, much like we already do for id.

urlComp.addQueryItem(name: "format", value: format)

I'm not sure if the response body would change if this parameter is included on a stream or download call - but since Subsonic is designed to be REST, I'd expect it to stay the same, just with the media data transcoded to be in the requested format.

Since this seems to be the lowest layer present that interacts with the API directly, from here we just need to go up the stack until we have access to the user settings objects and add/change logic on the functions that request the stream/download from a Subsonic API server.

hugoghx avatar Jun 10 '23 06:06 hugoghx

I just want to add that this would be a usefull addition. Also the same call also supports a max-bitrate setting which would come in handy for a mobile device with data-caps, limited bandwidth, storage,.. So allowing for a certain number of file format and bit-rate settings would be great. Given that specifying format and bitrate seem to work in other subsonic-api compatible apps, this should be feasible as it is part of the protocol.

stonie08 avatar Nov 12 '23 19:11 stonie08

@BLeeEZ Hi, I tried switching from Navidrome to Ampache only for the possibility to download and transcode using Amperfy.

Now Ampache brought me into a hell load of other problems and I'm not sure I want to further go down that path...

Now, I somehow suppose you are an Ampache user and download+transcode with Subsonic servers might not be on your top prios list but is there any chance you might want to look into it? It's actually the one thing preventing me from using Amperfy as my go to app for offline listening. Just here to ask :-)

JOJ0 avatar Mar 21 '24 00:03 JOJ0

I am interested in this feature and I put on the list for the next version.

BLeeEZ avatar Mar 21 '24 06:03 BLeeEZ

It is implemented in 271612662ea43c4dcbe646cd060a545c430ec902. Simulator Screenshot - iPhone 15 Pro Max - 2024-04-22 at 21 03 21

BLeeEZ avatar Apr 22 '24 19:04 BLeeEZ