[Enhancement]: Force transcode for downloaded file #1633

Open
opened 2026-04-24 23:52:45 +02:00 by adam · 6 comments
Owner

Originally created by @mew1033 on GitHub (Jan 3, 2024).

Describe the feature/enhancement

I'd like to be able to optionally force a transcode of a file before downloading it for offline playback. Maybe the file is too big, or it's in a format my device doesn't recognize. Regardless, it'd be nice to be able to request an offline download of a specific type.

Originally created by @mew1033 on GitHub (Jan 3, 2024). ### Describe the feature/enhancement I'd like to be able to optionally force a transcode of a file before downloading it for offline playback. Maybe the file is too big, or it's in a format my device doesn't recognize. Regardless, it'd be nice to be able to request an offline download of a specific type.
adam added the enhancement label 2026-04-24 23:52:45 +02:00
Author
Owner

@Darkblizzard21 commented on GitHub (Jan 29, 2024):

Im currently facing a simmilar issue. I have a audiobook which spans over 98h and therefore is almost 5.5GB big M4B file.
When i try to play it back on mobile the server takes long to responde (because of the transcoding) so it would be easier to just play it locally, but android is not able to play it back.

@Darkblizzard21 commented on GitHub (Jan 29, 2024): Im currently facing a simmilar issue. I have a audiobook which spans over 98h and therefore is almost 5.5GB big M4B file. When i try to play it back on mobile the server takes long to responde (because of the transcoding) so it would be easier to just play it locally, but android is not able to play it back.
Author
Owner

@advplyr commented on GitHub (Jan 29, 2024):

@Darkblizzard21 I recommend re-encoding that M4B file because they should be able to play without requiring a transcode.

@advplyr commented on GitHub (Jan 29, 2024): @Darkblizzard21 I recommend re-encoding that M4B file because they should be able to play without requiring a transcode.
Author
Owner

@Darkblizzard21 commented on GitHub (Jan 29, 2024):

Would probalby be a nice feature regardless. Also if audiobookshelf is able to live transcode the file it should not be a big effort to implement encoding as part of the tools or as part of the download process to mobile (but i can imagin that it is way more complacted than i assume).

Now the OffTopic Part:
I already tried to transcode the file using ffmpeg but all my settings failed so i now probalb will just stick to playing it live transcoded while on wifi.

@Darkblizzard21 commented on GitHub (Jan 29, 2024): Would probalby be a nice feature regardless. Also if audiobookshelf is able to live transcode the file it should not be a big effort to implement encoding as part of the tools or as part of the download process to mobile (but i can imagin that it is way more complacted than i assume). Now the OffTopic Part: I already tried to transcode the file using ffmpeg but all my settings failed so i now probalb will just stick to playing it live transcoded while on wifi.
Author
Owner

@advplyr commented on GitHub (Jan 30, 2024):

Yeah I agree it would be a nice feature. In your case it seems like you have a poorly encoded M4B file (or something with your device) so I still recommend fixing that. It could be as simple as ffmpeg -i input.m4b -codec:a aac output.m4b

@advplyr commented on GitHub (Jan 30, 2024): Yeah I agree it would be a nice feature. In your case it seems like you have a poorly encoded M4B file (or something with your device) so I still recommend fixing that. It could be as simple as `ffmpeg -i input.m4b -codec:a aac output.m4b`
Author
Owner

@mew1033 commented on GitHub (Jan 30, 2024):

Android should definitely support m4b files. I wonder what's going on with that file? Maybe it's not getting downloaded correctly because it's so big?

@mew1033 commented on GitHub (Jan 30, 2024): Android should definitely support m4b files. I wonder what's going on with that file? Maybe it's not getting downloaded correctly because it's so big?
Author
Owner

@RaHoni commented on GitHub (Jan 24, 2025):

@advplyr do you have a preference for the API for this?

Otherwise I would recommend something like
api/items/:id/file/:fileid/download?containerformats=mp3,m4b&audiocodecs=aac,mp3

Which would check if it is already available in an accepted format. And if not it gets converted before the download starts.

As optimization we could test if for example only the container needs to be changed and than use -codec:a copy.

@RaHoni commented on GitHub (Jan 24, 2025): @advplyr do you have a preference for the API for this? Otherwise I would recommend something like `api/items/:id/file/:fileid/download?containerformats=mp3,m4b&audiocodecs=aac,mp3` Which would check if it is already available in an accepted format. And if not it gets converted before the download starts. As optimization we could test if for example only the container needs to be changed and than use `-codec:a copy`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1633