Search code examples
c#mp3taglibtaglib-sharp

Taglib not saving full tags


I'm using taglib# to input mp3 title and artist names as metadata parsed from file names. To do this, I'm essentially looping through a list of file names, parsing the names, creating a taglib file, changing the tags, then saving and disposing of the taglib file. Oddly enough, in my circumstances, I noticed that there seems to be a maximum length for strings that tags can take as input after the first file has been successfully changed.

Here is a small scale example I am running now.

foreach (string path in files)
{
    using (TagLib.File f = TagLib.File.Create(path))
    {
        f.Tag.Title = "000000000011111111112222222222333333333344444444445555555555"
        f.Save();
    }
}

As output, the first file touched has the correct title field:

000000000011111111112222222222333333333344444444445555555555

But each file after it only has a portion:

000000000011111111112222222222

You can see it in explorer:

Each title field after the first is cut short.

The results are the same no matter the field modified. Also, explicitly calling Dispose() on the taglib file does not change anything. Why could this be?


Solution

  • It seems I always ask a question right when I'm on the brink of finding an answer. I did a little more digging and found that this answer also solves my problem. In short, make sure that the right version of Id3 is in use.

    Aside: I found that this also solved another issue I was having with unicode being turned into question marks in the output. A nice bonus!