rasmuslos / AmpFin

Native Jellyfin music player for iOS & iPadOS
Other
107 stars 10 forks source link

Display FLAC audio quality and/or bitrate - Quality of Life improvement #39

Closed jechosu closed 2 months ago

jechosu commented 2 months ago

While AAC and MP3 files display bitrate in the now playing screen, playing FLACs does not display the bitrate nor the sample rate/bit-depth. Is there a way to get that information in the future, possibly from the properties of the track on Jellyfin?

Svrfqce commented 2 months ago

I too would love this

Something like having the option to just display for example: 24 - 96, 16 - 44.1 would also be a great qol addition!

rasmuslos commented 2 months ago

The reason why the bitrate is not displayed when playing flac files is AVPlayer (the audio player provided by apple). I use track?.load(.estimatedDataRate) to load the bitrate, but it just doesn't work correctly when playing flac files. But fetching the data from the Jellyfin server might work

jechosu commented 2 months ago

image

The properties of the track give pretty good insight assuming that metadata exists there

gnattu commented 2 months ago

This is going to be impossible for future version of Jellyfin or you just want to lie to your users, if you ever display the bitrate for lossless codecs.

Music streaming may also have transcoding happening and in future version of Jellyfin the Music transcoding can support VBR and lossless transcoding as well, and the bitrate cannot be accurately predicted for those codecs anyway.

For now you can try to get the original file metadata but that could be different from what the actual audio the server is streaming for your user.

I think only the Sample rate and Bit depth ever matters for a lossless codec anyway, we can just remove the bitrate for all lossless codecs.

Remember: for a lossless codec, more bitrate does not mean better quality. It only means it is compressed worse.

gnattu commented 2 months ago

For the actual file data, it is located in the /Users/{userId}/Items/{itemId} endpoint, and you can get everything you want in the MediaSources property. There will be multiple entries in the MediaStreams under MediaSources, pick the audio one(Type == Audio) and BitRate, BitDepth and SampleRate will be available there.

rasmuslos commented 2 months ago

I kind of forgot that flac is a lossless codec, so it does make sense that it does not provide bitrate data. Using the metadata from Jellyfin is a good idea and the player could fallback to the data provided by AVPlayer (for example when offline).

Svrfqce commented 2 months ago

Any possibility to have the option to just see the sample rate and bit depth instead of the codec?

rasmuslos commented 2 months ago

Yes, and I think it's reasonable to show them, instead of the Bitrate, by default when playing a lossless codec.

rasmuslos commented 2 months ago

https://github.com/rasmuslos/AmpFin/assets/49640416/d08315d3-75dc-44b2-94aa-99574f996680