Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# ID3 library that supports custom fields

Tags:

c#

.net

mp3

id3

Currently i'm using TagLib Sharp as suggested in one of the posts @stackoverflow for reading id3-Tag out of mp3, flac, ogg and similar multimedia files .. now i just realized, that id3v2 (maybe even v1) supports custom tags but i can't find the implementation for reading/writing custom tags in TagLib Sharp. Does anybody know of a library that supports custom fields?

Christian

--- Update 20100422 ---

Still searching.. found this page:

http://id3.org/Implementations

like image 853
Christian Casutt Avatar asked Feb 20 '10 08:02

Christian Casutt


2 Answers

You can try to add a new frame (instead of entire new custom tag). As example, if you want to add a new "Acoustid Duration" TXXX-Frame to an existing *.mp3 file, you can use the taglib-sharp library and something like

Dim MyTaglibMP3 As TagLib.File = TagLib.File.Create("C:\temp\I'm Alive.mp3")
Dim id3v2tag As TagLib.Id3v2.Tag = CType(MyTaglibMP3.GetTag(TagLib.TagTypes.Id3v2), TagLib.Id3v2.Tag)
Dim AcoustidDurationTXXXFrame As New TagLib.Id3v2.UserTextInformationFrame("Acoustid Duration", TagLib.StringType.UTF16)
AcoustidDurationTXXXFrame.Text = {"207"}
id3v2tag.AddFrame(AcoustidDurationTXXXFrame)
...
MyTaglibMP3.Save()
MyTaglibMP3.Dispose()

Of course, this works with every other already defined id3v2 type like "CommentsFrame", "PrivateFrame", "TextInformationFrame" and even "UnsynchronisedLyricsFrame".

If you don't want that the id3v2tag will be encoded with UTF-16, choose another TagLib.StringType

like image 162
PeterCo Avatar answered Oct 06 '22 10:10

PeterCo


Have you tried to do it with csid3lib ?

http://sourceforge.net/projects/csid3lib/

like image 43
m1k4 Avatar answered Oct 06 '22 11:10

m1k4