finamp icon indicating copy to clipboard operation
finamp copied to clipboard

Download transcoded files

Open endervad opened this issue 3 years ago • 2 comments

I see that this feature was mentioned to be added in the future if possible in 0.3.0 changelog but I still wanted to highlight as an issue since it turned out to be a dealbreaker for me. Feel free to delete this issue if it's already on roadmap :) My library consists of very fat FLACs where some of the albums take up to 9Gb. While I have enough space on my phone for songs that I might want to have at the moment (not everyone would), sometimes I want to download some more on the road.

endervad avatar Apr 12 '22 00:04 endervad

Related to #213.

axelsimon avatar May 06 '22 13:05 axelsimon

I have the same request. Over the last few years I've been buying fat FLACs but I don't really want them on my phone which means I can download some albums but not others, and even the 320kbps MP3s are a bit bulky really. (My phone's a reliable old clunker.) Transcoding downloads would be the ideal solution.

I've read the notes on issue 213. If there's anything I can do to help, please let me know.

jeremyswright avatar Aug 23 '22 07:08 jeremyswright

I've been working on this, and have a pretty good first implementation. On Android, files are downloaded with OPUS, on iOS it's a bit messier:

The main issue I've run into here are some bugs in Jellyfin's audio transcoding. Basically, most file formats won't be correctly sent by Jellyfin as when transcoding, ffmpeg (the underlying tool used for transcoding) "goes back" to write header data that is required to play the files. For some formats, there are flags that you can give to fix this behaviour. I have submitted fixes to Jellyfin for M4A/AAC files: https://github.com/jellyfin/jellyfin/pull/9249

There was also an issue where specifying a codec didn't actually apply, which I fixed at https://github.com/jellyfin/jellyfin/pull/9192

Luckily, both of these issues are irrelevant for Android, since OGG doesn't have any weird header stuff (as noted in #151), and .opus is a valid file name extension, so we can still ask Jellyfin for an OPUS encoded OGG file (I think ffmpeg defaults to Vorbis for OGG).

On iOS, those two fixes will be required for transcoding to M4A/AAC. M4A/AAC is fine, but there's one last fix I want to make to get CAF/OPUS working. CAF is Apple's own container that can carry OPUS - they don't support OGG/OPUS like everyone else. This will need my audio codec fix, as CAF defaults to PCM with ffmpeg. The fix is basically "add an option to wait for ffmpeg to end", which hopefully shouldn't be too hard to add.

Depending on how long it takes to get these fixes released by Jellyfin, I may release transcoded downloads for Android first, and iOS later (maybe as a hidden switch - I doubt many people want to start compiling their own Jellyfin and I don't want to encourage people to brick their servers by running unstable software).

Anyway, here's a screenshot :)

Screenshot showing the new transcoded download options

TL;DR: It's basically done, I'm just cleaning it up a bit and waiting on some required Jellyfin fixes to be put in a release

jmshrv avatar Feb 09 '23 10:02 jmshrv

This looks very cool, thanks @jmshrv both for the work and the explanation!

axelsimon avatar Feb 09 '23 14:02 axelsimon

ETA on this? Looks like Jellyfin released an update yesterday

TheGloriousDuck avatar Apr 24 '23 20:04 TheGloriousDuck

That release didn't include my changes, they'll be in 10.9:

Screenshot of message from Anthony Lavado: New Feature? Next "major" release. After a main tag goes out, only fixes go to that tag. So your PR would be 10.9

I could release the current implementation for Android since that can play .opus files, which aren't affected by the fixed issues.

My number one priority right now is the new download implementation (#213), as the current implementation is very janky.

jmshrv avatar Apr 24 '23 23:04 jmshrv

Depending on how long it takes to get these fixes released by Jellyfin, I may release transcoded downloads for Android first, and iOS later (maybe as a hidden switch - I doubt many people want to start compiling their own Jellyfin and I don't want to encourage people to brick their servers by running unstable software).

Since it's been close to a year and 10.9 is still not out, is there a chance this could be rolled out at least for Android? I have lots of FLACs in my library and can't listen to them offline :(

TheGloriousDuck avatar Feb 08 '24 01:02 TheGloriousDuck

We have a new downloading system currently being finalized, once that is done we can probably add the transcoded downloads on top. There is a draft PR for trancoded downloads using the old system which is almost done, so it hopefully shouldn't be too much work.

But it will be part of the redesign beta for now, not part of the stable version.

Chaphasilor avatar Feb 08 '24 21:02 Chaphasilor

What would be the ETA of the redesign beta?

TheGloriousDuck avatar Feb 08 '24 21:02 TheGloriousDuck

It's currently soon™, but it should be ready by the end of this month if all goes well. The downloads rewrite and Android Auto PRs need to be merged in first, and then we can submit to Google Play and Testflight for review :)

Chaphasilor avatar Feb 08 '24 23:02 Chaphasilor

Update: Seems like @Komodo5197 overheard our conversation, because they just added support for transcoded downloads in their PR a few hours ago! Already tested it and it's working well on Android :)
It will still be part of the beta, but from the start.

Chaphasilor avatar Feb 09 '24 09:02 Chaphasilor

@Chaphasilor is there a chance you would be able to send over the APK that you tested? Tried building it myself but lots of errors that I have been spending a while to fix and I kinda gave up 😂

TheGloriousDuck avatar Feb 10 '24 00:02 TheGloriousDuck

@TheGloriousDuck you can downloaded the preliminary APK from here: https://gofile.io/d/dcsOfb

You'll have to uninstall the old version first, since this new APK is signed by me instead of James, and Android will (rightfully) complain about it.

Chaphasilor avatar Feb 10 '24 12:02 Chaphasilor