.NET Library for Manipulating video Documents
Read, Write and extract Metadata of video File Format.
Taglib-Sharp is an open-source API developed for reading and writing metadata in video file formats. Using the API, you can read & write standard tags of video file format and can also create and extract metadata of custom tags. The API is designed to extract any format, any container the video file format is using.
TagLib-Sharp is free software released under the LGPL. The developer can create their own metadata extraction & creation applications using the API. The developers can work with a wide range of video file formats for metadata manipulation.
Getting Started with Taglib-Sharp
The best way to install Taglib-Sharp is via NuGet you can run the following command and install Taglib-Sharp in your application.
Install Taglib-Sharp from NuGet
Install-Package Taglib-Sharp
Extract Metadata Tags from video via Free .NET API
Taglib-Sharp allows .NET programmers to extract metadata tags from video file formats easily. You can extract the tag regardless of the container or the format of the tag. To extract metadata tag, first, you need to load the video file using TagLib.File.Create() method and read tag e.g Title using TagFile.Tag.Title property. The following code snippet demonstrates, how to extract metadata properties from video file.
Extract Metadata from video using C#
- Load video using TagLib.File.Create() method and pass file path as string
- Extract title as a string using tfile.Tag.Title property
- Extract video duration as TimeSpan using tfile.Properties.Duration property
Extract Video Metadata using C#
var tfile = TagLib.File.Create(@"video.avi");
string title = tfile.Tag.Title;
TimeSpan duration = tfile.Properties.Duration;
Console.WriteLine("Title: {0}, duration: {1}", title, duration);
Free C# API to Write video Metadata Tags
The open-source API TagLib-Sharp allows .NET developers to write standard as well as custom metadata tags in video file formats. To write, you can read a video file using TagLib.File.Create() method and new tag value using Tag. Tile property.
Write video Metadata Tags via .NET API
var tfile = TagLib.File.Create(@"video.avi");
string title = tfile.Tag.Title;
TimeSpan duration = tfile.Properties.Duration;
Console.WriteLine("Title: {0}, duration: {1}", title, duration);