finamp icon indicating copy to clipboard operation
finamp copied to clipboard

Finamp does not transcode when the song's bitrate is below the transcoding bitrate

Open rawkhopper opened this issue 3 years ago • 16 comments
trafficstars

So, I already saw that OPUS is not suported on iOS but even with transcoding on the files will not play. I can play the file on my iPhone with Jellyfin app and with Web app on Firefox and Brave without transcoding. In Finamp the files will not play with or without transcoding.

The files I have are 192kbps. Does the bitrate on the transcoding section have to be below the encoded bitrate to work?

Is there any chance that the app will use another player, instead of Apple's built in one, so that OPUS will work? If not I am starting to think it would be best to just stick with the Jellyfin app.

rawkhopper avatar Jul 12 '22 12:07 rawkhopper

Could you check your Jellyfin logs for any transcoding errors? Discussion on new players is happening here: https://github.com/UnicornsOnLSD/finamp/issues/177

jmshrv avatar Jul 12 '22 12:07 jmshrv

No errors seen.

I just switch the bitrate in the app to 160kbps and it worked. That doesn't seem like a very viable solution. I have to re-encode all my OPUS files to a higher bitrate than the bitrate I would like to listen to in order to try to avoid the artifacts generated by reencoding. If I do that I may as well switch the format so that I can use Finamp.

rawkhopper avatar Jul 12 '22 12:07 rawkhopper

I'll do some testing then, my guess is that Finamp is giving some incompatible transcoding option. Just wondering, how are you running Jellyfin? (Docker, Debian, Windows etc)

jmshrv avatar Jul 12 '22 12:07 jmshrv

I am using Docker on Ubuntu Server 22.04 LTS.

rawkhopper avatar Jul 12 '22 12:07 rawkhopper

I just tried using FLAC and it direct plays even with transcoding turned on. This could suck up some bandwidth. Any idea what I might be doing wrong?

rawkhopper avatar Jul 12 '22 16:07 rawkhopper

Is the file downloaded? I haven't heard any reports of that.

jmshrv avatar Jul 12 '22 16:07 jmshrv

No, just uploaded it to the server.

rawkhopper avatar Jul 12 '22 16:07 rawkhopper

How are you checking that the file is being direct played/transcoded?

jmshrv avatar Jul 12 '22 16:07 jmshrv

The dashboard page on the server says it is compatible and direct playing.

rawkhopper avatar Jul 12 '22 16:07 rawkhopper

I think I never really got that reporting working properly, you can check if a file is being direct played or transcoded via the test in the bottom left of the player screen.

image

jmshrv avatar Jul 12 '22 16:07 jmshrv

Bottom left of app says streaming transcode. Which one is correct?

rawkhopper avatar Jul 12 '22 16:07 rawkhopper

Finamp is correct. You can verify this by checking for a transcode log in your server's logs menu.

jmshrv avatar Jul 12 '22 16:07 jmshrv

I think I've narrowed it down to this line: https://github.com/UnicornsOnLSD/finamp/blob/1ea614d9d55f7408ae14518351b055000d0c91d5/lib/services/music_player_background_task.dart#L532

The way Finamp tells Jellyfin to transcode is to set the max bitrate to the user settings. This works for FLACs, which are usually much higher than 320kbps, but for your OPUS music it doesn't. This also explains why it works when you drop the transcoding bitrate.

A bandaid solution to this would be to set the max bitrate to the slightly below the song's bitrate when it's lower than the setting, but then you could lose out on quality as 160kbps AAC isn't great.

As far as I know, this is the only way to enable transcoding with Jellyfin. I'll have a look to see if there's any other way, and if not, I may try adding an extra parameter to force transcoding at a specific bitrate.

jmshrv avatar Jul 12 '22 17:07 jmshrv

Thanks for the help. I am sorting through trying to understand the logs. Does jellyfin store transcoded files? I see some transcode logs but they only seem to be once for each file. If I start the songs again no knew file is created. Or is it Finamp storing a cached version of the song?

rawkhopper avatar Jul 12 '22 17:07 rawkhopper

I'm pretty sure Jellyfin caches transcodes for a bit, Finamp doesn't cache songs yet.

jmshrv avatar Jul 12 '22 17:07 jmshrv

Gotcha. Thanks!

rawkhopper avatar Jul 12 '22 17:07 rawkhopper

Hey there, seconding this issue on an iOS client and a Debian-based (non-docker) server instance. Reading through this issue and 177 it seems that there's no immediate golden fix-all -- but I did wonder about something else. I'm also pretty new to the world of quality audio, so forgive me if this is a dumb question - but is there some program I could run on the actual audio files server-side to basically bump up their bitrate? This would make Finamp think the song needs to be transcoded, and do so, regardless of what I started out with for audio bitrate.

EDIT: more food for thought.

The Jellyfin official 'app' can, in fact, play my OPUS files without hesitation (I say 'app', because I think it's really just a wrapper around the web interface). When I check the Jellyfin activity dashboard, it shows that the music is being transcoded to AAC. However, when I play the same file with Finamp and it is transcoded (via setting the bitrate slider in app all the way down), the server still reports no transcoding. See attached file for what the server says about the Jellyfin client -- I wonder if it'd be possible to detect what type of file it is, and if it's not supported on platform, report that to the server? Screenshot from 2022-11-05 17-37-06

Thanks for all the work you've put into this!

mishaturnbull avatar Nov 05 '22 22:11 mishaturnbull

Fixed in 5316250

jmshrv avatar Feb 10 '23 17:02 jmshrv