Skip to content

Corruption of chapters in .m4b files when saving the file #373

@ListerD000169

Description

@ListerD000169

I'm using TagLib Sharp version 2.3.0, calling from powershell. The script updates several tags, creates a few new tags, and also updates the cover art. I noticed as I was testing on a larger number of files that chapters were no longer available in the player or metadata reader (foobar2000 and MediaInfo used for testing). I then also checked against the data in MediaInfo and discovered that the chapter information had gotten corrupted.

As a result, I backed the script down to just change a single tag and save the file. I tested this updating and saving only the year, then again updating and saving only the composer. In both instances, the tags updated successfully, but the chapters corrupted.

Additionally, I tried updating the file only with a cover image. No changes to any tags. Same result. Cover image updated successfully but the chapters corrupted.

Lastly, I tried just instantiating the file and saving it, and this also resulted in the chapter metadata being corrupted. So just the act of saving the file seems to cause issues with chapter metadata, even if no other changes are made.

The powershell code to just instantiate the file and save it are as follows:

$updateFile = [TagLib.File]::Create($fileName)
$updateFile.Save()

Below are before and after shots of a file with three chapters based on MediaInfo:
Before opening/saving file:
Image

After opening/saving file:

Image

The Menu2 info is gone in this file. In files with more chapters, some data would be available, but much would be missing and it would be scrambled. Example below:

Image

Everything else works great. The tags get updated, custom tags get created and populated, and the image file gets embedded. However, even though I'm not touching the chapter info, its gets corrupted just by opening and saving the file.

I did try this with both the netstandard2.0 and the net462 .dll files and got the same result from both. I also did try this with several chapterized .m4b files and they all ended up with chapter corruption after just calling and saving the file with no tag or image changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions