How to remove Lyrics3 v2 tag from id3?

三世轮回 提交于 2019-12-24 12:31:05

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/26671210/how-to-remove-lyrics3-v2-tag-from-id3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!