vb.netmetadataid3taglib-sharp

How to remove Lyrics3 v2 tag from id3?


I use the taglib sharp library to remove all tags from my songs with the command

Track = TagLib.File.Create("C:\test\Super Trouper.mp3")
Track.RemoveTags(TagLib.TagTypes.AllTags)
Track.Save()
Track.Dispose()

Unfortunately, the .RemoveTags doesn't remove a Lyrics3 v2.0 tag
(specified here: http://id3.org/Lyrics3v2).

Such a tag can be detected with a tool like "Mp3 Diags" (http://mp3diags.sourceforge.net/)

How can I completely remove ALL tags and ALL frames from my song?

Or how can I remove this specific Lyrics3 v2 tag?


Solution

  • Unfortunately, TagLib# doesn't support Lyrics3 tags. In an MP3 file, TagLib# will detect and can remove only APE, Id3v1, and Id3v2 tags.

    After saving the file with tags removed by TagLib#, you could do something like the following with your own code:

    1. Open a file stream.
    2. Seek to Length - 9, read 9 bytes and see if they equal LYRICS200 or LYRICSEND. If not, close the file.
    3. Seeking back 11 bytes.
    4. Reading 11 bytes and checking if they match LYRICSBEGIN. If so, truncate the file at that point.
    5. If not, keep seeking back 1 byte and repeating step 4. Probably give up after 10KB or so.

    This is not the most efficient strategy but I'm imagining the number of files with these tags is quite low so most should stop after step 2.