[Bug]: Embed Metadata removes some existing but not overlapping metadata #2947

Closed
opened 2026-04-25 00:12:10 +02:00 by adam · 6 comments
Owner

Originally created by @ListerD000169 on GitHub (Aug 12, 2025).

What happened?

I was testing the embed metadata feature, and it did a great job of adding/updating much of the metadata in an m4b file. However, it also removed metadata that was not on the list of items to be updated. In my case, I noticed that #Series and #Series-Part were removed from the file. These are the tag names used in the default view of mp3tag. I had been using this field for the book series name (#Series) and number (#Series-Part). While I expected embed metadata to update and overwrite tags listed in the Metadata to embed table, I did not expect it to delete tags not in that list. I did verify that this is not an issue with the grouping tag, as that goes to what mp3tag refers to as Content Group.

What did you expect to happen?

I expected tags not listed in the Metadata to embed table to be left in place.

Image

Steps to reproduce the issue

  1. Update #Series and #Series-Part in mp3tag for an m4b file
  2. Run Embed Metadata for that same m4b file
  3. Recheck the m4b file metadata in mp3tag and #Series and #Series-Part data is missing.

Audiobookshelf version

2.27.0

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Windows

If the issue is being seen in the UI, what browsers are you seeing the problem on?

None

Logs


Additional Notes

No response

Originally created by @ListerD000169 on GitHub (Aug 12, 2025). ### What happened? I was testing the embed metadata feature, and it did a great job of adding/updating much of the metadata in an m4b file. However, it also removed metadata that was not on the list of items to be updated. In my case, I noticed that #Series and #Series-Part were removed from the file. These are the tag names used in the default view of mp3tag. I had been using this field for the book series name (#Series) and number (#Series-Part). While I expected embed metadata to update and overwrite tags listed in the Metadata to embed table, I did not expect it to delete tags not in that list. I did verify that this is not an issue with the grouping tag, as that goes to what mp3tag refers to as Content Group. ### What did you expect to happen? I expected tags not listed in the Metadata to embed table to be left in place. <img width="830" height="884" alt="Image" src="https://github.com/user-attachments/assets/3e595075-00ad-46ea-aec8-58075038c718" /> ### Steps to reproduce the issue 1. Update #Series and #Series-Part in mp3tag for an m4b file 2. Run Embed Metadata for that same m4b file 3. Recheck the m4b file metadata in mp3tag and #Series and #Series-Part data is missing. ### Audiobookshelf version 2.27.0 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Windows ### If the issue is being seen in the UI, what browsers are you seeing the problem on? None ### Logs ```shell ``` ### Additional Notes _No response_
adam added the bug label 2026-04-25 00:12:10 +02:00
adam closed this issue 2026-04-25 00:12:11 +02:00
Author
Owner

@advplyr commented on GitHub (Aug 13, 2025):

This is only the case with m4b/mp4 files because of ffmpegs limitation on meta tags.

I'm not sure there is anything we can do about this without including another dependency. We already experimented with that with tone and is not likely to happen.

In my tests any re-encoding of an mp4 file with ffmpeg, even when copying the stream, will remove all meta tags that ffmpeg doesn't support.
The supported meta tags are here https://wiki.multimedia.cx/index.php/FFmpeg_Metadata

@advplyr commented on GitHub (Aug 13, 2025): This is only the case with m4b/mp4 files because of ffmpegs limitation on meta tags. I'm not sure there is anything we can do about this without including another dependency. We already experimented with that with tone and is not likely to happen. In my tests any re-encoding of an mp4 file with ffmpeg, even when copying the stream, will remove all meta tags that ffmpeg doesn't support. The supported meta tags are here https://wiki.multimedia.cx/index.php/FFmpeg_Metadata
Author
Owner

@ListerD000169 commented on GitHub (Aug 13, 2025):

Wow, thanks for the quick response! So I guess by another dependency you mean using something other then ffmpeg to just manage tags? Didn't realize that it was reencoding the file to update the tags, although that explains why it seems to take longer to process than if it were just updating the metadata.

Guess for now I'll just update the series info manually, and I'll also look into the API to see if I can pull the info that way to update the file metadata.

Thanks again for the fast response, and for the great tool. Audiobookshelf is awesome!

@ListerD000169 commented on GitHub (Aug 13, 2025): Wow, thanks for the quick response! So I guess by another dependency you mean using something other then ffmpeg to just manage tags? Didn't realize that it was reencoding the file to update the tags, although that explains why it seems to take longer to process than if it were just updating the metadata. Guess for now I'll just update the series info manually, and I'll also look into the API to see if I can pull the info that way to update the file metadata. Thanks again for the fast response, and for the great tool. Audiobookshelf is awesome!
Author
Owner

@nichwall commented on GitHub (Aug 13, 2025):

Guess for now I'll just update the series info manually, and I'll also look into the API to see if I can pull the info that way to update the file metadata.

You can either use the API or the metadata.json that Audiobookshelf creates. This JSON file includes all of the metadata for the item (not including collection/playlist or user progress information) and is stored in /metadata by default. You can enable the server settings to store this metadata file in the same folder as your media items instead, but the metadata files are not moved automatically.

The metadata file is created/updated for a book any time the Audiobookshelf metadata change. An easy way to move the metadata file to the media folder is to bulk add a temporary tag to your books, then delete the tag in the server settings.

@nichwall commented on GitHub (Aug 13, 2025): > Guess for now I'll just update the series info manually, and I'll also look into the API to see if I can pull the info that way to update the file metadata. You can either use the API or the `metadata.json` that Audiobookshelf creates. This JSON file includes all of the metadata for the item (not including collection/playlist or user progress information) and is stored in `/metadata` by default. You can enable the server settings to store this metadata file in the same folder as your media items instead, but the metadata files are not moved automatically. The metadata file is created/updated for a book any time the Audiobookshelf metadata change. An easy way to move the metadata file to the media folder is to bulk add a temporary tag to your books, then delete the tag in the server settings.
Author
Owner

@advplyr commented on GitHub (Aug 14, 2025):

I'm not sure if the technical term would be encoding since the streams aren't being touched but the m4b encoding tool uses the same metadata embed logic.

@advplyr commented on GitHub (Aug 14, 2025): I'm not sure if the technical term would be encoding since the streams aren't being touched but the m4b encoding tool uses the same metadata embed logic.
Author
Owner

@ListerD000169 commented on GitHub (Aug 14, 2025):

@nichwall , Good point on the metadata.json file. That would allow for doing everything via the filesystem. Thanks!

@advplyr , encoding was the wrong term, but the process seems to be interacting with more than just the metadata. I tested, without backing up a file, and for a 1 gig m4b, the metadata embed took about 30 seconds to complete. It took about 6 seconds for a 150 meg file. Just an FYI. Thanks!

@ListerD000169 commented on GitHub (Aug 14, 2025): @nichwall , Good point on the metadata.json file. That would allow for doing everything via the filesystem. Thanks! @advplyr , encoding was the wrong term, but the process seems to be interacting with more than just the metadata. I tested, without backing up a file, and for a 1 gig m4b, the metadata embed took about 30 seconds to complete. It took about 6 seconds for a 150 meg file. Just an FYI. Thanks!
Author
Owner

@ListerD000169 commented on GitHub (Aug 14, 2025):

Since it looks like this isn't a bug in audiobookshelf, but a "feature" of ffmpeg, I'm going to close the ticket. Thanks for all the info!

@ListerD000169 commented on GitHub (Aug 14, 2025): Since it looks like this isn't a bug in audiobookshelf, but a "feature" of ffmpeg, I'm going to close the ticket. Thanks for all the info!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2947