mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #1583] Spotify lossless will not be supported #721
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#721
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kingosticks on GitHub (Sep 15, 2025).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/1583
Discussed in https://github.com/librespot-org/librespot/discussions/1578
Originally posted by michaelherger September 10, 2025
https://newsroom.spotify.com/2025-09-10/lossless-listening-arrives-on-spotify-premium-with-a-richer-more-detailed-listening-experience/
(no pressure 😂)
I'm focusing on a few other things now, but depending on how Spotify implemented this it may actually not be difficult.
Clearly removing the bitrate command line limitations won't work, but some years ago (yeah) I already took care to pave the way for FLAC support in the decoder and audio file selection. If the FLACs and its decryption keys are served over the same way as the Ogg Vorbis files, then that could be quick work... any takers?
Originally posted by @roderickvd in https://github.com/librespot-org/librespot/discussions/1578#discussioncomment-14377362
It would be nice to have real files to check if there is anything to take into account, like with ogg (header) https://github.com/librespot-org/librespot/blob/dev/playback/src/player.rs#L1050 but yeah, it should be a pretty quick work
Originally posted by @SuisChan in https://github.com/librespot-org/librespot/discussions/1578#discussioncomment-14377540
@roderickvd commented on GitHub (Sep 18, 2025):
Appreciate all the offers for help, but please stick to the Spotify ToS: no sharing of files or accounts.
We'll need someone with time and access to lossless capabilities to propose a PR.
@heinzgruber commented on GitHub (Sep 19, 2025):
Maybe this is possible when librespot can play lossless:
https://community.spotify.com/t5/Live-Ideas/Add-Bit-Perfect-Playback-WASAPI-Exclusive-Mode-on-Windows/idi-p/7125179
@guredora403 commented on GitHub (Sep 21, 2025):
Hello! I think this is truly an amazing project. I'm currently using Spotify's Windows desktop client and am successfully achieving lossless playback, so I'd love to contribute. However, I've been unable to figure out how to read the encrypted communication in the control plane. My apologies for that. Once I know that, I could observe the communication flow during normal playback versus FLAC playback.
@clepdn commented on GitHub (Sep 25, 2025):
i have lossless working and enabled for my account
the devtools for my desktop client show an AAC_24 (24-bit?) file format from a GET
spclient.wg.spotify.com/metadata/4/track/{TRACK_GID}?market=from_tokenhere's the request response with a bit of junk and uuids removed.
my devtools don't show me any actually useful information, like if it's fetching the actual audio data differently from the way it fetches other audio qualities. i maybe need a proxy or some mitm to get what the local backend is fetching?
@roderickvd commented on GitHub (Sep 25, 2025):
For the
AAC_24part, probably it’s just the protobufs that need an update to map toFLAC_FLACor similar.Yes you can run a proxy to see where the desktop client is getting its files from.
@kingosticks commented on GitHub (Sep 25, 2025):
When you say "desktop client" do you mean desktop client or do you mean web browser? We want to know what the former is doing, not the latter.
@clepdn commented on GitHub (Sep 27, 2025):
it’s the desktop application for windows, since that’s the only way I can stream lossless right now
@SuisChan commented on GitHub (Sep 29, 2025):
Hey, just a quick update on lossless.
AES-128-CTR, as is theIV(72e067fbddc...).0xA7byte header).Bitrate? Up to 24-bit (in my case, some files are up to 1800 kbps, if anyone's interested).
So, if there's a way to obtain keys through shannon, it would be easy to implement.
The other issue is that this won't be available to everyone, so some checks is needed to determine if the user is lossless-eligible (since this is a server-side restriction, different markets, etc.).
@kingosticks commented on GitHub (Sep 29, 2025):
It became available on my account today but I couldn't find where the fileid my desktop app is using is actually coming from. I see requests to https://gew1-spclient.spotify.com/storage-resolve/v2/files/audio/interactive_prefetch/16/d66a44eea7819cbce00e9c9e2abbe7f373bc60ed and then https://audio-fa-l.spotifycdn.com/audio/d66a44eea7819cbce00e9c9e2abbe7f373bc60ed but I don't see
fileidd66a44eea7819cbce00e9c9e2abbe7f373bc60ed anywhere in the response from https://spclient.wg.spotify.com/metadata/4/track/fb24dfb1ea0043f9afdd8633a3b75e1b Am I being dense?@SuisChan commented on GitHub (Sep 29, 2025):
Must be from the
extended-metadataresponse @AUDIO_FILES, here it is, haven't seen it anywhere elseIf you link the track URI, I can check it now
edit: In fact, the app might not have had to make a request just now to get the
file_id, since it might already be cached in their database, it caches a lot of things, including protobuf responses.@vemsom commented on GitHub (Sep 29, 2025):
Wouldn't this be part of the configuration?
The player is configured for a specific bit rate already (for ex. BITRATE="320")
@kingosticks commented on GitHub (Sep 29, 2025):
@SuisChan track fb24dfb1ea0043f9afdd8633a3b75e1b
I had deleted the cache so i don't think it's that, I see it doing all the other requests.
@SuisChan commented on GitHub (Sep 29, 2025):
Oh okay, but I can confirm that the
AUDIO_FILESresponse contains thatfile_id.Let MebyAnxiousspotify:track:7L77eB8vi2vpuqniEHqdzl, right?Someone might try to enable lossless without even knowing whether it's available, so... idk
@SuisChan commented on GitHub (Sep 29, 2025):
huh! Even better,
head-fafiles are just a chunk of the original, they are identical down to the last bit@SuisChan commented on GitHub (Sep 29, 2025):
Not so good news, on my end the keys to lossless don't work via shannon, someone needs to check and confirm or prove me wrong...
@kingosticks commented on GitHub (Sep 29, 2025):
Yep, thanks. I see this now. I didn't realise there were different kinds of extended metadata requests.
@Fletcher-Alderton commented on GitHub (Oct 1, 2025):
Hey, I have Spotify lossless on all my devices and would love to get it on Librespot. Is there anyway I can help?
@AmilieDev commented on GitHub (Oct 1, 2025):
Is there any specific documentation on this with Shannon? If so I'll toy around myself and see if this is just a you issue or a completely new hurdle. Would be appreciated for a link. ^-^
@SuisChan commented on GitHub (Oct 1, 2025):
@AmilieCoding, nothing special, just use the function to request keys with the correct
track_idandfile_id. You can easily get thefile_id(lossless) using dev-tools (spicetify enable-devtools, thenctrl+shift+Din the application), and you'll find everything you need in theplaybackwindow. I just used a slightly modified play example. https://github.com/librespot-org/librespot/blob/dev/examples/play.rsIf it works, you'll get a key. If not... well, either lossless won't be supported, or significant changes might be required...
example
@Lustyn commented on GitHub (Oct 2, 2025):
I have yet to figure out keys, but I can confirm that the current format values (16 and 22) for FLAC and FLAC_24 respectively are correct. It seems the API we are currently using for retrieving audio files does not support FLAC but whatever
spotify.playback_esperanto.proto.PlaybackService/GetFilesis using receives it.@pickpocket commented on GitHub (Oct 2, 2025):
My account has lossless. I tested this and got err @ Service unavailable { audio key error }
I have a strong feeling this is because the session config needs to be updated.
@SuisChan commented on GitHub (Oct 2, 2025):
Or maybe spotify intentionally locked lossless behind playplay drm. I'm monitoring several repos, and based on the issues I see, there are some changes recently. For example, now when using a free account with the old protocol (shannon), you can't request keys in most cases. It seems this now only works with a premium sub.
@kingosticks commented on GitHub (Oct 2, 2025):
I did see the desktop app doing requests to playplay for keys. Isn't that their DRM-based system? But it seemed to be doing that for both lossless and lossy audio quality modes.
@SuisChan commented on GitHub (Oct 2, 2025):
That's exactly it
@AmilieDev commented on GitHub (Oct 2, 2025):
I haven't been able to personally get this working - but that's just because I'm a god awful programmer.
I did manage to take a look though and I did see something about DRM keys as mentioned above by @kingosticks . Would be worth taking a look into.
@SuisChan commented on GitHub (Oct 3, 2025):
Uhhh, I'm not entirely sure about that.
Spotify doesn't even want to think about anyone else using playplay DRM.
I'd say that as soon as something is revealed, it will be removed due to DMCA. They even added it to their bug bounty scope list.
It's an interesting opportunity tbh, but they didn't provide enough information or criteria to be considered an acceptable bug report.
@Laxii-null commented on GitHub (Oct 3, 2025):
so are we actually close to the implemention of the lossless in the librespot? 🤔
@AmilieDev commented on GitHub (Oct 4, 2025):
I see okay, so DRM is something to avoid as a whole from what I'm seeing? Got it. 👍
@SuisChan commented on GitHub (Oct 4, 2025):
Just saying don't be surprised if all your efforts go to waste, which is what will most likely happen
@roderickvd commented on GitHub (Oct 5, 2025):
I think most efforts to crack the new decryption have been from decompiling or some other white box approach. The best chance we have is by taking a black box approach: develop a decryption algorithm ourselves without looking at any protected code.
@roderickvd commented on GitHub (Oct 5, 2025):
To clarify a bit more on the output rather than on the process: this should result in a human-readable, pure Rust implementation with semantic names of functions, variables and such.
@Lustyn commented on GitHub (Oct 5, 2025):
I don't believe what @roderickvd is describing is possible if the only means to acquire keys for these files is to use PlayPlay. From what I understand that DRM scheme, very similarly to Widevine, does white-box cryptography. That means even if we reimplement the license request scheme the keys remain encrypted unless we use Spotify's code or otherwise recover the key from it.
So unless other means to acquire the keys are discovered (perhaps Shannon can provide them and we're just missing something) or Spotify graciously changes these restrictions at a later time, this issue is at a dead end. My guess would be that the PlayPlay restriction for lossless is very much intentional and Spotify only keeps Shannon around to allow librespot and others to continue to function out of goodwill.
@roderickvd commented on GitHub (Oct 5, 2025):
We can try using the private key. I mean, we’ve had keymaster keys in the codebase since the start. No guarantees for the future, but we can try.
Problem seems that so far, regardless of key, I’ve not seen a clean implementation.
@photovoltex commented on GitHub (Oct 5, 2025):
That's less a good will and more a necessity I would assume. As @SuisChan pointed out before, there are other devices who still use the old way of communicating. Mostly devices with spotify connect integration like receivers. They can't just update the firmware of these devices as with the clients. So those will probably never get lossless support unless the firmware of the device is updated.
I guess it would be interesting to know if anyone with lossless access and a receiver with connect integration could validate if lossless on the receiver would work.
@peteralm80 commented on GitHub (Oct 6, 2025):
The Marantz/Denon built-in HeOS player currently supports lossless.
@d3xter-dev commented on GitHub (Oct 6, 2025):
Lossless via Spotify Connect works fine on my Denon AVR-X4500H, using HEOS.
But my Onkyo TX-NR575E does not support Lossless via Spotify Connect.
@drobotk commented on GitHub (Oct 6, 2025):
FYI, the
is-pigeonproduct state attribute seems to be what enables lossless on my phone@drobotk commented on GitHub (Oct 6, 2025):
How does it know?
Also, the quality selection menu for librespot doesn't actually work, librespot plays what it wants
@miholobolo commented on GitHub (Oct 6, 2025):
I have access to lossless in the andorid app. My NAD C338 amp supports spotify connect and chromecast, but it does not work with lossless. I can select the lossless option when playing on the amp in both modes, it shows that i'ts playing but keeps skipping after a couple of seconds without playing a sound.
@photovoltex commented on GitHub (Oct 6, 2025):
Yeah, I think we could look into adding support for external quality adjustment support. It shouldn't be to hard from the connect side, but I'm not so sure if our player supports switching the quality on the fly. But that's a different topic for now.
@justinerickson commented on GitHub (Oct 9, 2025):
Anybody know how Chromecast Audio works? I wonder if enough people upvote this request to compel Spotify to support lossless with Chromecast Audio that might unstick other third-party Spotify devices too: https://community.spotify.com/t5/Live-Ideas/Allow-lossless-playback-to-Chromecast-Audio-device/idi-p/7138979
@roderickvd commented on GitHub (Oct 10, 2025):
Chromecast devices need to have a public key that can only be signed by Google’s private key. Unless that private key leaks into the public, no chance to find it.
@cshin1213 commented on GitHub (Oct 23, 2025):
HI everyone:
I noticed this issue for several days. I found it may be difficult for librespot to support spotify lossless.
Is this issue end? Or there is still a possibility to achieve this problem?
@AmilieDev commented on GitHub (Oct 23, 2025):
I believe the main issue currently is actually making proper human readable code, in a way which actually works with the project. As stated above by @SuisChan , it's not getting it to work - it's getting human readable code while it works
@KernelFreeze commented on GitHub (Oct 28, 2025):
The main problem with PlayPlay is that it requires a private key to be provided to the decryption module, and Spotify invalidates any key they find published in any GitHub repository, then sends a DMCA to the repository. So even if we get a custom implementation of the decryption system, we would also need a way to distribute a key without risking a DMCA. Maybe it could be downloaded and extracted from an official binary when a user runs librespot, but I think that's still a big risk.
@roderickvd commented on GitHub (Nov 6, 2025):
We've redacted this discussion to ensure librespot's continued existence, and are now locking it. We've received communication from Spotify that makes it clear we cannot pursue development that circumvents their technical protections. We appreciate your understanding.
@sashahilton00 commented on GitHub (Nov 9, 2025):
This is a distinct possibility. What I would say is that it's possible that librespot needs to update some of it's client parameters to something more recent - it wouldn't be the first time we missed stuff because the version header we were sending was too old for a feature gate on the server side, or the proto requests we send are missing now required fields.
I think the first step would be to update the protobuf definitions to something a bit newer, though this will involve a fair bit of work as proto requests are all over the place. Once one then has a client that is more aligned with current spotify clients, I suspect it will become easier to inspect behaviour and improve functionality.
It would not surprise me if it were possible to retrieve lossless keys over shannon somehow - as many have pointed out Spotify don't want people poking around with their playplay DRM, and the best way to ensure that's the case is to have a means to pull the keys via shannon. Failing that I imagine that as more and more people want lossless, we'll see more hatchety approaches that have already been done, such as extracting the keys/compiled code and feeding the black box for decryption keys.