Reading/Writing metadata of audio/video files

Muhammad Umar picture Muhammad Umar · Aug 15, 2013 · Viewed 18.9k times · Source

I need some help in reading/writing meta data inforamation of audio/vido file. I have searched alot but not find anything thing helpful. Taglib sharp is an open source library that provide help in reading/writing metadata. Using tag lib i'm able to edit some of values but not all like.

TagLib.File videoFile = TagLib.File.Create("test.mp4");
videoFile.Tag.Title = "Test";
videoFile.Tag.Comment = "Nothing";

but i'm unable to edit following properties like Author url, producers etc. How i edit these properties ??

Answer

Ben Allred picture Ben Allred · Aug 15, 2013

I've never done this for video files before but I have for mp3 files. You can get access to those frames like this:

TagLib.File file = TagLib.File.Create(mp3FileName);
file.Tag.Title = "some title"; // you've got this
TagLib.Id3v2.Tag tag = (TagLib.Id3v2.Tag)file.GetTag(TagTypes.Id3v2);
tag.SetTextFrame("WOAR", "some url"); // WOAR = Official artist/performer webpage
file.Save();

You can find a list of the text frame identifiers at Wikipedia: ID3v2 Frame Specification (Version 2.3)

I don't know if video files give you the same range of frames that ID3 does, though notice that Wikipedia also says (Implementation in non-mp3s and alternatives)

MP4 also allows the embedding of an ID3 tag, and this is widely supported.

So I would guess this also works for mp4 files like you're trying.