Skip to main content
net10.0net8.0net9.0

A library for reading and writing metadata tags in media files (MP3, OGG, FLAC, MP4/M4A, WAV, AIFF)

Published
May 23, 2026
4mo ago
Total Downloads
4.0K
3,994

Install

dotnet add package Meziantou.Framework.MediaTags --version 1.1.9
ProductVersions
.NET
net10.0net8.0net9.0

README

Meziantou.Framework.MediaTags

Meziantou.Framework.MediaTags is a .NET library for reading and writing metadata tags in audio files.

Supported formats

  • MP3 (ID3v1 and ID3v2)
  • OGG Vorbis
  • OGG Opus
  • FLAC
  • MP4 / M4A
  • WAV
  • AIFF

Usage

using Meziantou.Framework.MediaTags;

var result = MediaFile.ReadTags("song.flac");
if (!result.IsSuccess)
{
    Console.WriteLine($"{result.Error}: {result.ErrorMessage}");
    return;
}

var tags = result.Value;
Console.WriteLine($"Format: {tags.Format}");
Console.WriteLine($"Duration: {tags.Duration}");
Console.WriteLine($"Title: {tags.Title}");
Console.WriteLine($"Artist: {tags.Artist}");
using Meziantou.Framework.MediaTags;

var tags = new MediaTagInfo
{
    Title = "New Title",
    Artist = "New Artist",
    Album = "New Album",
    Year = 2026,
    Genre = "Rock",
    TrackNumber = 1,
    TrackTotal = 10,
};

tags.Pictures.Add(new MediaPicture
{
    PictureType = MediaPictureType.FrontCover,
    MimeType = "image/png",
    Description = "Album cover",
    Data = File.ReadAllBytes("cover.png"),
});

var writeResult = MediaFile.WriteTags("song.mp3", tags);
if (!writeResult.IsSuccess)
{
    Console.WriteLine($"{writeResult.Error}: {writeResult.ErrorMessage}");
}

API overview

  • MediaFile.ReadTags(...) reads metadata from a file path or stream.
  • MediaFile.WriteTags(...) writes tags to a file path or to an output stream.
  • MediaFile.DetectFormat(...) detects the media format from file content and extension.
  • MediaTagInfo contains common metadata fields, embedded pictures, ReplayGain values, and custom fields.
  • MediaTagResult and MediaTagResult<T> return operation status, error code, and message.

Changes from Previous Version

No structural changes between v1.1.8 and v1.1.9.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.