mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Enhancement]: xHE-AAC support #2738
Open
opened 2026-04-25 00:10:03 +02:00 by adam
·
33 comments
No Branch/Tag Specified
master
book_tags_genres_dedupe
episode_download_fallback
Issue-4540-SortBy-StartedDate-and-FinishedDate
episode_meta_tagging
fix_authorize_race_condition
redirect_transcode_requests
progress_updated_sort
fix_ereader_socket_event
fix_change_empty_root_password
fix_podcast_session_track_index
fix_set_token
session_modal_user
localize_durations
fix_oidc_create_user
jwt_auth_refactor
fix_scanner_deleting_single_file_books
fix_mediaprogress_updatedat_2
experimental_next_client
podcast_episode_duration
episode-timestamps-clickable
book_author_secondary_sort_title
podcast_useragents
pathexists_user_access
fix_pathexists_join
book_author_secondary_sort
clean_duplicate_mediaprogress
sanitize_html_description
trix_prevent_attachments
check_path_api_fix
fix_mediaprogress_updatedat
increase_express_json_limit
fix_dockerfile_nunicode
search_episodes
audiobook_tools_update
episode_secondary_sorts
hls_stream_url_update
new_session_track_endpoint
audiobook_tools_enhancements
watcher_rescans_update
player_track_tooltip
fix_exclude_prefixes_crash
socket_item_events
fix_podcast_episode_scanner_promise
new_stats_controller
count_cache_for_userpermissions
parsing-opf-v3
validate_migration_files
fix-quick-match-all-crash
fix-chapter-end-sleep-timer
stringify_sequelize_query
remove-col-ambiguity
fix_next_prev_edit_description
details_trim_whitespace
fix_content_url_basepath
fix_logger_fatal
progress_bar_visibility
batch-edit-populate-map-details
feed_generator_updates
bookmark-modal-updates
migrate-library-item-in-scanner
migrate-new-library-items
migrate-podcasts-new-library-item-2
migrate-podcasts-new-library-item
fix-remove-episode-from-playlist
playback-session-use-new-library-item
refactor-library-item
fix-heatmap-caption
feed-episodes-upsert
share-media-player-media-session-api
remove-old-playlist
remove_old_collection_object
plugin-implementation-demo
feed_migration
refactor-feeds-from-item
fix_remove_authors_no_books
v2.17.3-fk-constraints-migration
migrations-first-upgrade
sqlite_2
feature/nuxt-target-server
waveform
sqlite
play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.4
v1.3.3
v1.3.1
v1.2.8
v1.2.6
v1.2.5
v1.2.4
v1.2.1
v1.1.15
v1.1.14
v1.1.13
v1.1.12
v1.1.11
v1.1.10
v1.1.9
v1.1.8
v1.0.0
0.9.61-beta.0
0.9.61-beta
Labels
Clear labels
authentication
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
pull-request
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
Mirrored from GitHub Pull Request
No Label
enhancement
Milestone
No items
No Milestone
Projects
Clear projects
No project
Assignees
adam (Adam Melkus)
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/audiobookshelf#2738
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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 @simmias42 on GitHub (Apr 29, 2025).
Type of Enhancement
None
Describe the Feature/Enhancement
Please add support for the xHE-AAC files created by Libation in today's update when users select the new download setting that allows for the highest possible file quality.
Why would this be helpful?
As of today, Libation now supports downloading from Audible at 128/44 for almost every book. You could already download many newer and shorter books at this quality, but now Libation can download a 128/44 xHE-AAC file for many books that previously only had 64/22 AAX files available.
Unfortunately, Audiobookshelf won't recognize these new xHE-AAC files that Libation produces.
Can support be added so we can add these newer, higher quality files to our libraries?
Thank you!!!
Future Implementation (Screenshot)
Added support for xHE-AAC files.
Audiobookshelf Server Version
v2.20.0
Current Implementation (Screenshot)
No response
@nichwall commented on GitHub (Apr 29, 2025):
What is different about these files? Do they have a different extension so ABS does not recognize them? Can you share any logs from trying to add one of these files to the server?
@simmias42 commented on GitHub (Apr 29, 2025):
It still downloads as an m4b file, but it uses the xHE-AAC codec instead of AAC-LC or HE-AAC. I guess xHE-AAC is the latest and greatest as far as AAC codecs go, and it isn't as well supported. It only has partial support in ffmpeg. My Android phone plays it fine, but I had to download a plug-in for foobar for it to play on my computer.
This is from one of the Libation crew: "Ffmpeg has partial support, but not enough support to play these files seamlessly. If you get a hold of the fdk AAC lib (or an ffmpeg built with fdk AAC, which is basically impossible without building it yourself), then it will play seamlessly. As of right now, I think fdk-aac is the only option for playing these. I use potplayer on my PC, and it has the fdk decoder built in."
This is all I get in my ABS log if I try to add one of these files:
2025-04-28 23:17:41.421 ERROR [LibraryItem] Library item not found
2025-04-28 23:17:41.426 ERROR [LibraryItem] Library item not found
2025-04-28 23:17:41.431 ERROR [LibraryItem] Library item not found
2025-04-28 23:17:41.555 ERROR [AudioFileScanner] SyntaxError: Expected property name or '}' in JSON at position 2 : "/audiobooks/Audiobooks/Vonnegut, Kurt/Breakfast of Champions 2/Breakfast of Champions.m4b"
@Vito0912 commented on GitHub (Apr 29, 2025):
We are using a fairly outdated version of ffprobe; version 7.1 is the latest, but we are currently using 5.1 (at least what I saw from the code, maybe I spotted the version wrong).
I am not sure how much updating will help, since on Windows, I saw no crash with either version, only a warning on both. However, the file I tested was just an xHE-AAC sample I found attached to a bug report for ffmpeg, so I do not know if it is exactly the same format as the one mentioned above.
5.1:
7.1:
Edit: ok, nvm. For me, on dev branch on Windows, it does not crash with the file, so ig, it's the wrong format I have
@acidRain-burns commented on GitHub (Apr 29, 2025):
If it helps, an ongoing discussion about using the format is still happening in the Libation issue, https://github.com/rmcrackan/Libation/issues/996
@Vito0912 commented on GitHub (Apr 29, 2025):
Version 7.1 does appear to fix the issue. I have almost no time over the next week, so I won't be able to look into this topic further right now.
I noticed that we use https://ffbinaries.com/downloads for ffprobe. Only version 6.1 is available there. I tested it, and it failed.
So, at the moment, I don't think there is a quick fix, since we need another source for the prebuilt ffmpeg files. I'm not very familiar with ffmpeg-builts, but maybe there is another source (preferably GitHub-Repo) that provides these builds. Ik there are other, but I am not sure how.
As a temporary, but very impractical fix, you can download ffprobe 7.1 and replace the executable. However, it gets overwritten every time abs restarts (for example, after a crash).
Edit: https://github.com/BtbN/FFmpeg-Builds/releases seems to exist. Idk if these are the newest as they do not have a version tag assigned.
Thanks to Simmias for bringing this up. As you said, it could have led (or lead, depending on the time it takes) to confusion for some users.
@Mbucari commented on GitHub (Apr 29, 2025):
@Vito0912 The ffmpeg website has links to several build services. This is the one I tend to use when I a need pre-compiled binaries.
I'm not familiar with your project, but I am familiar with compiling ffmpeg and what is required to decode audiobooks from audible. I'm the AAXClean author, and I just recently had to update the native libraries to enable decoding of these xhe-AAC audio books. Version 7.1 will correctly identify the codec, but it will still not be able to decode it. These audiobooks are encoded with USAC, which is still unsupported by the latest ffmpeg release. If you compile your own ffmpeg with fdk-AAC lib, your build will be able to decode USAC. libxaac May also decode USAC, but as far as I'm aware, nobody has written an ffmpeg interface for that library. So at this point in time, I think the only way you can use ffmpeg to decode USAC is with fdk-AAC.
@ebb-earl-co commented on GitHub (Apr 30, 2025):
FWIW, the Jellyfin has been using their own custom FFmpeg for some time now, and have version 7.1.1-1 available.
It purports to include
libfdk_aacsomehow if I can read theffmpeg -decoders(on Debian 13) output correctly:However, trying to use this binary to transcode a
.mp4container with a single xHE-AAC audio stream fails.@Mbucari commented on GitHub (Apr 30, 2025):
@ebb-earl-co try specifying the decoder like so:
ffmpeg -c:a libfdk_aac -i "xHE-AAC.m4b" "out.m4a"@ebb-earl-co commented on GitHub (Apr 30, 2025):
@Mbucari I had done a slightly different invocation, but executing this results in
@Mbucari commented on GitHub (Apr 30, 2025):
@ebb-earl-co Yeah, I tested Jellyfin and it doesn't look like they actually have fdk-aac built in. I tried building ffmpeg with their claimed configuration, and it won't even allow me to configure it with both
--enable-gpland--enable-libfdk-aacoptions.It doesn't look like you're running windows, but if you have access to a win64 machine, you can use this build I just made. Configuration options are:
ffmpeg-fdk-aac.zip
@ebb-earl-co commented on GitHub (Apr 30, 2025):
@Mbucari thank you!
I'm the author of
tidal-wave, so I have some experience with make a purpose-built FFmpeg: thank you for the config guide!@dymk commented on GitHub (May 1, 2025):
Here's a Dockerfile based off of the official audiobookshelf image, which builds
ffmpegandfdk-aacfrom source.I can re-encode with a command like so -
ffmpeg -loglevel verbose -i "Red Rising [B00I2VWW5U].m4b" -c:a libfdk_aac -c:v copy "red-rising.m4a"This appears to "just work" when using it as abs setup. Audiobooks stream, both new and old m4b.
@Vito0912 commented on GitHub (May 1, 2025):
Edit2: With the new version of Libation, you can turn off "widevine." This will give you audio files that work, but the quality will be lower for books that only have high-quality widevine.
You can turn off "
use widevine DRM" option in the settings of Libation or follow the steps below to make abs recognize these files again.Please note that these steps below have not been tested and might cause problems with other files or clients. For example, plappa does not seem to work with this workaround.
Please note that this is not an issue with ABS, but with the format Libation returns which is not supported with the newest ffmpeg version
If you need xHE-AAC support (required for some files in Libation), you can use a custom Dockerfile based on dymk’s work. This version adds a setting for the
AUDIOBOOKSHELF_TAG(ABS tag). Note: The build process will take some time.Steps
1. Download the Dockerfile
Make sure you are in your
docker-composefolder, then run:or
Please check the downloaded file to ensure it looks correct.
2. Update your
docker-compose.ymlimage:line from your service definition.build:section:You can set
AUDIOBOOKSHELF_TAGto a specific version (e.g.,2.21.0),edge, or leave it aslatest(the default).3. Build and Run
To update when a new ABS version is released, run:
Additional Notes
Distributing an ffmpeg build with fdk-aac may violate licensing terms. Sharing a pre-built image could be problematic. - So that's why I do not provide a finsihed image
Make backups. I am not liable if you loose anything. Make sure you have setup mountpoints correctly!
Credit:
Thanks to dymk for the original Dockerfile.
Example
Example Compose
@jostyee commented on GitHub (May 4, 2025):
With this build I can successfully stream playing my audible rips, only issue is audiobookshelf keeps outputting the below error:
Updated: Apparently it's an incompatibility issue with the Plappa iOS client.
@Vito0912 commented on GitHub (May 4, 2025):
I started a discussion here: https://github.com/advplyr/audiobookshelf/discussions/4258
Could you please post the issue as a new thread? This will make it easier to follow and will avoid sending unwanted notifications to people in the current issue.
PS: Do you use plappa? (Would be nice to know in the new thread)
@jostyee commented on GitHub (May 4, 2025):
Ok will do, thanks.
Haha just updated my comment. ShelfPlayer doesn't have this issue.
@praetorxyn commented on GitHub (May 22, 2025):
I'm not sure if updating a few weeks old thread is the best thing to do or not, but I stumbled upon this due to a cue issue, ironically, and it does seem related.
For Knife of Dreams, Wheel of Time book 11, if Widevine DRM is checked, the cuesheet Libtation generates is perfect. If Widevine DRM is unchecked, the cuesheet is wrong, so while the file is perfectly playable in Audiobookshelf, it has the wrong chapter information, and the Opening Credits and Epigraph chapters are merged into the Prologue, so I don't think it's possible to fix the chapter metadata in the Audiobookshelf lookup UI as there are missing chapters.
I don't know why the cuesheet generated would be different whether Widevine was used or not, but that seems to be the case.
I could download all the books with widevine just as an extra copy to have better cuesheets apparently, then overwrite cuesheets if I find another bad one, but that's not particularly scalable.
@ebb-earl-co commented on GitHub (May 22, 2025):
Now that you say this, I was wondering why Words of Radiance by Brandon Sanderson wasn’t lining up with the chapter timestamps, but I bet it’s this same issue.
@praetorxyn commented on GitHub (May 22, 2025):
I can at least confirm that the cue sheet seems irrelevant. I would posit that the problem is Libation downloading a book that has bad chapters in it or misreading chapter markers in the download / decryption / conversion process, then generating a bad cuesheet form that. I did the following test:
Next:
So that's on me for misunderstanding the chapter edit UI I think.
@Vito0912 commented on GitHub (May 22, 2025):
Hey,
Could we please keep issues related to their specific topic?
It makes things difficult for everyone because everyone gets a notification. Also, people who have the same issue later will have a hard time finding relevant information.
If this is an issue with ABS, please open a new issue to keep things organized.
But this does not look like an error with ABS at all. As far as I know, Libation embeds chapter information into the file. Thus, the cue file is only that helpful
Also just a note: Updating the chapters in abs does not touch the file unless you embed the data manually via the settings, so you should be fine.
I suspect that either Libation does not use the chapter information for normal licenses (because chapter positions for Widevine (or generally insert any) and "normal" licenses differ) or that Audible made a mistake for the chapters with no widevine.
I can check if you send me an ASIN for a book that has this issue, but please do not send it in this thread. Send it via Discord or email instead.
Either way that sounds like an issue from Libation/Audible
@jostyee commented on GitHub (May 22, 2025):
@praetorxyn does it have sth to do with this? https://github.com/rmcrackan/Libation/issues/1246#issuecomment-2861824791
@extesy commented on GitHub (Dec 27, 2025):
I think this works now. I don't know which exact commit fixed it, but the latest release seems to recognize
xHE-AACaudiobooks.@nichwall commented on GitHub (Dec 27, 2025):
There has been no change to codec support. As mentioned in the previous comments, this is still not supported by the server for transcoding.Correction: this may now be supported by the ABS docker container due to Alpine now using ffmpeg 8.0.1 instead of the older ffmpeg 5/6 (more details in https://github.com/advplyr/audiobookshelf/discussions/4258#discussioncomment-15350404). I can't test this because I don't have any xHE-AAC files, but if more people can verify we may be able to close this as fixed in server 2.32.1.
@elevul commented on GitHub (Dec 27, 2025):
Yeah, it has been mentioned by a user on reddit as well: https://old.reddit.com/r/audiobookshelf/comments/1pwjhtv/psa_audiobookshelf_abs_seems_to_play_xheaac_usac/
That said, if I understand the code correctly, this would only apply to Docker, as the code specifically skips the binaries check if running in docker:
But not if directly installed (Windows/Linux):
So arguably it wouldn't really be fixed for anything other than Docker unless the next releases stop forcing the check for the ancient version of ffmpeg and just use the ffmpeg binaries from environmental variables on either OS.
It's something I worked around on Windows by forcing SKIP_BINARIES_CHECK, but I honestly think that Audiobookshelf should just check ENVs and use binaries from there by default if present:
https://github.com/mikiher/audiobookshelf-windows/issues/57#issuecomment-3691832084
Or perhaps it would be time to remove the version check entirely from the code and update the source from which it's downloading ffmpeg with the one that has the latest version?
@nichwall commented on GitHub (Dec 27, 2025):
Yeah. I was copying and pasting my explanation into 4 different threads, so probably see some duplicate information.
Yes, that is correct. We specifically used 5.1 because there were issues with ffmpeg 6 that reported so we stuck with the old version so we stopped getting bug reports of issues caused by the ffmpeg version updating. I believe someone had done some testing with ffmpeg 7/8 a few months ago but ran into issues as well, but I'm not seeing where that was right now.
Probably, depends on if other issues are found with ffmpeg 8.0.1
@elevul commented on GitHub (Dec 27, 2025):
While the reasoning is understandable, it would be perhaps a good idea then to provide a clear explanation of the issue in the docs and then provide an easy way for users (who accept that specific issue) to force the usage of a newer version (Perhaps by only specifying FFMPEG_PATH and FFPROBE_PATH in the environmental variables?) if they require support for xHE-AAC.
@Vito0912 commented on GitHub (Dec 27, 2025):
I just think we should try upgrading ffmpeg.
The used source does not provide any new ffmpeg versions, which I believe contributes that newer versions never where tried.
I had noone contact me that the proposed unofficial workaround did not work and it would also be weird for ffmpeg to break something.
Maybe to be super careful we could add an ENV that reverts back for few if they have issues.
Idk in which thread I wrote it, but it bothers me a bit anyway that we use an that outdated ffmpeg version. (But I am just a contributer).
I will check later today if a test xHE file will work and report back then.
I don't remember the issues with newer versions, so if that is true that's another topic then. But I for myself, daily drive ABS and ran the workaround myself for some time and had no issues. (but that ofc is a very little sampling rate xD)
@Ansem93 commented on GitHub (Dec 28, 2025):
Just update ABS to the latest release and I can confirm! Now it recognize the books I have with xHE-AAC!
The Android app also seems perfectly capable to open them :)
@elevul commented on GitHub (Dec 28, 2025):
Android and iOS have supported xHE-AAC for many years now, and Windows as well since 22h2. That's why it was so frustrating that the limiting factor wasn't playback, but rather Audiobookshelf not being able to add those books to the library for download/play on client devices.
@advplyr commented on GitHub (Dec 28, 2025):
There was an issue with ffprobe 6.1 where it failed to probe some mp3 files. I can't remember the specific details but I was able to reproduce it at the time. That was over 18 months ago so we should look at updating to ffmpeg 8 now.
https://github.com/advplyr/audiobookshelf/issues/2689#issuecomment-1998534247
@elevul commented on GitHub (Feb 6, 2026):
Hi, are there any news on this change? Is there an ETA on when the ffmpeg version in audiobookshelf will be uncapped or increased to version 8?
@H2OKing89 commented on GitHub (Feb 6, 2026):
Their docker image is shipping with V8
https://github.com/advplyr/audiobookshelf/discussions/4258#discussioncomment-15350296
@elevul commented on GitHub (Feb 19, 2026):
That does not address not-docker installs, and is tangential regardless as it's dependent on the Alpine image rather than any change/decision on the part of ABS.