问题
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:
- Open a file stream.
- Seek to Length - 9, read 9 bytes and see if they equal
LYRICS200
orLYRICSEND
. If not, close the file. - Seeking back 11 bytes.
- Reading 11 bytes and checking if they match
LYRICSBEGIN
. If so, truncate the file at that point. - 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