8

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 ??

svick
  • 236,525
  • 50
  • 385
  • 514
Muhammad Umar
  • 3,761
  • 1
  • 24
  • 36

2 Answers2

8

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.

Ben Allred
  • 4,544
  • 1
  • 19
  • 20
5

You will need to use AppleTag. This will work. For mp4 file you have to write value into dashbox. Like this:

TagLib.File videoFile = TagLib.File.Create("test.mp4");
TagLib.Mpeg4.AppleTag customTag = (TagLib.Mpeg4.AppleTag)f.GetTag(TagLib.TagTypes.Apple);
customTag.SetDashBox("Producer","Producer1", "value");
f.Save();
f.Dispose();

And you can get the value like this:

var tokenValue = customTag.GetDashBox("Producer", "Producer1");
Hannan Hossain
  • 740
  • 1
  • 12
  • 23