Search code examples
c#taglib-sharp

How could you remove MP3 tags from an existing file


I am looking to strip out ID3v1, ID3v2.x tags from an .mp3 file using C#. I would rather not implement it myself - but use something tried and tested.

TagLibSharp looks really good for creating tags - but how could it be used to remove them? If there's any other library more suited to this I'd use it.


Solution

  • Use the TagLibSharp RemoveTags() method.

    file.RemoveTags(tagtypes);
    

    where tagtypes is a TagType bitmask for the tags you want to remove. For Id3v1 and Id3v2, try

    file.RemoveTags(TagTypes.Id3v1 && TagTypes.Id3v2);