mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-30 23:40:40 +02:00
[Bug]: Support "Auto-Embed Metadata" for M4A Format in AudioBookShelf #3066
Closed
opened 2026-04-25 00:13:22 +02:00 by adam
·
5 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
playlists
video
v2.35.1
v2.35.0
v2.34.0
v2.33.2
v2.33.1
v2.33.0
v2.32.1
v2.32.0
v2.31.0
v2.30.0
v2.29.0
v2.28.0
v2.27.0
v2.26.3
v2.26.2
v2.26.1
v2.26.0
v2.25.1
v2.25.0
v2.24.0
v2.23.0
v2.22.0
v2.21.0
v2.20.0
v2.19.5
v2.19.4
v2.19.3
v2.19.2
v2.19.1
v2.19.0
v2.18.1
v2.18.0
v2.17.7
v2.17.6
v2.17.5
v2.17.4
v2.17.3
v2.17.2
v2.17.1
v2.17.0
v2.16.2
v2.16.1
v2.16.0
v2.15.1
v2.15.0
v2.14.0
v2.13.4
v2.13.3
v2.13.2
v2.13.1
v2.13.0
v2.12.3
v2.12.2
v2.12.1
v2.12.0
v2.11.0
v2.10.1
v2.10.0
v2.9.0
v2.8.1
v2.8.0
v2.7.2
v2.7.1
v2.7.0
v2.6.0
v2.5.0
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.23
v2.2.22
v2.2.21
v2.2.20
v2.2.19
v2.2.18
v2.2.17
v2.2.16
v2.2.15
v2.2.14
v2.2.13
v2.2.12
v2.2.11
v2.2.10
v2.2.9
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.24
v2.0.23
v2.0.22
v2.0.21
v2.0.20
v2.0.19
v2.0.18
v2.0.17
v2.0.16
v2.0.15
v2.0.14
v2.0.13
v2.0.12
v2.0.11
v2.0.10
v2.0.9
v2.0.8
v2.0.7
v2.0.6
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v1.7.2
v1.7.1
v1.7.0
v1.6.0
v1.5.5
v1.5.0
v1.4.11
v1.4.9
v1.4.7
v1.4.6
v1.4.4
v1.4.2
v1.4.0
v1.4.1
v1.3.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
bug
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#3066
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 @carethink11 on GitHub (Nov 1, 2025).
What happened?
Request: Support "Auto-Embed Metadata" for M4A Format in AudioBookShelf
Issue Description:
The "Auto-Embed Metadata" feature in AudioBookShelf currently fails when processing M4A audio files. Logs show FFmpeg errors like "Invalid audio stream" and "Error opening output file" due to format incompatibility. Investigation reveals the root cause is missing adaptation for M4A metadata handling:
.mp3, the app still uses MP3’s ID3 tag logic to call FFmpeg, causing conflicts..m4aextension, the app likely lacks code to embed metadata using MP4 container tags (e.g., iTunes tags), so metadata can’t be written.需求:在 AudioBookShelf 中支持 M4A 格式的“自动嵌入元数据”功能
问题描述:
当前 AudioBookShelf 的“自动嵌入元数据”功能处理 M4A 格式音频文件时会失败,日志显示 FFmpeg 因格式不兼容报错(如“Invalid audio stream”“Error opening output file”)。经排查,问题根源是软件未适配 M4A 格式的元数据处理:
.mp3,软件仍会用 MP3 的 ID3 标签逻辑调用 FFmpeg,导致格式冲突。.m4a后缀的文件,软件可能没有实现 MP4 容器标签(比如 iTunes 标签)的嵌入逻辑,元数据根本写不进去。What did you expect to happen?
In practice, many audiobooks are distributed in M4A (especially high-quality content), so missing support for this format hurts user experience.
Feature Request:
Please add support for M4A in the "Auto-Embed Metadata" feature. Key logic suggestions:
TIT2for title,TALBfor album) for MP3 files.©namfor title,©albfor album,covrfor cover art).Use Case:
Users managing M4A audiobooks in AudioBookShelf should be able to auto-embed metadata (cover art, title, author) without altering the original file’s encoding or quality, improving efficiency for multi-format audiobook libraries.
实际使用中,很多有声书都是 M4A 格式(尤其是高音质内容),不支持这个格式会影响用户体验。
功能需求:
希望开发团队给“自动嵌入元数据”功能加个 M4A 支持,核心逻辑建议如下:
TIT2存标题、TALB存专辑)。©nam存标题、©alb存专辑、covr存封面)。使用场景:
用户用 AudioBookShelf 管理 M4A 有声书时,能自动嵌入封面、标题、作者这些元数据,还不改变原文件的编码和音质,提升多格式有声书库的管理效率。
Steps to reproduce the issue
Additional Info:
[mp3 @ ...] Invalid audio stream. Exactly one MP3 audio stream is required.mp3; verify real format viamediainfoorffprobe.补充信息:
[mp3 @ ...] Invalid audio stream. Exactly one MP3 audio stream is required.mp3时会触发错误,可通过mediainfo或ffprobe验证真实格式。Audiobookshelf version
2.30.0
How are you running audiobookshelf?
Docker
What OS is your Audiobookshelf server hosted from?
Linux
If the issue is being seen in the UI, what browsers are you seeing the problem on?
Safari
Logs
Additional Notes
No response
@thatguy7 commented on GitHub (Nov 3, 2025):
You seem to confuse codec and container format.
The codec is the format of the audio-stream. It's the way the audio signal is represented digitally. Typical codecs are AAC, mp3 and opus.
The container is the layout of the audio file as a whole, e.i. a convenvention where in the file the audio stream is stored and where the tags and cover image is. Examples of this is m4a/m4b (which both are mp4), mp3 (confusingly named the same as the codec), ogg, ...
What you are trying to do is put a AAC audio stream in a .mp3 container. I do not think this is supported by the mp3 audio container specification. It certainly is not supported by ffmpeg, which ABS uses - so there is nothing that can be done about that on the ABS side.
Your options are either to use a different container format, like .m4a/.m4b - or transcode your audio to mp3 codec and put that in a .mp3 container.
@carethink11 commented on GitHub (Nov 3, 2025):
I didn't express myself clearly.
Actually, I encountered a "failure to embed metadata" when processing AAC-encoded audio in m4a format.
Additionally, I also get a "failure to embed metadata" when processing AAC-encoded audio with an mp3 extension (which should actually be m4a, but the extension was changed to mp3).
是我表述的不清晰,实际上,我是在处理aac编码的m4a格式音频时发生了"嵌入元数据失败"。另外我在在处理aac编码的mp3扩展名的音频(实际上应该是m4a,只不过扩展名被改成了mp3)时,也会发生 "嵌入元数据失败"
@thatguy7 commented on GitHub (Nov 3, 2025):
Embedding metadata in m4a files works fine. I do it all the time. The only problem there is that when you have your book split by chapters in multiple files, the title of all files will be set to "book title" instead of chapter title.
According to your logs:
The file that is to be tagged is
/audiobooks/凡人修仙传/0001-wpfx.org.mp3. It seems to be a .m4a container with a AAC stream in it, just named incorrectly.mp3. When ABS embeds tags in a file, it will use ffmpeg to build a completely new file from the input files with the correct tags embedded. In your case that new file is:Since the output file end with
.mp3, ffmpeg will write a proper mp3 file. Since there is no mp3-stream to put into the .mp3 file, that fails.ffmpeg will read your mislabeled files correctly, but it will not write an incorrect .mp3 file for you.
So again, your options are:
You can't rename a .pdf to .png and expect for things to just work. ABS does the correct thing here. Your file names are messed up.
@carethink11 commented on GitHub (Nov 3, 2025):
Wow, your analysis is totally spot-on! I finally get it now. That’s exactly the problem I was having—thanks so much for sorting it out for me. The cause must be that the audio file I downloaded had its extension incorrectly changed by the uploader. I’ll be more careful from now on, and I really appreciate your help. Your tech skills are awesome!
@thatguy7 commented on GitHub (Nov 4, 2025):
Glad I could help. Close this issue if the problem is resolved.