Recursive AI

TagLib# vs. OneMedia for metadata editing

Pick by the files you handle: TagLib# covers photos too, while OneMedia lets you choose which audio or video tag formats get written.

OneMedia is a free, open-source (MIT or Apache-2.0) library from Recursive AI for reading and editing audio and video metadata in .NET. NuGet · GitHub · Docs.

TagLib# (NuGet: TagLibSharp) is an open-source .NET library for reading and writing tags in audio, video, and image files. Version 2.3.0 is licensed under LGPL-2.1-only.

OneMedia 1.0.2 reads and edits tags in supported audio and video containers; it doesn’t read or write metadata in standalone photo files such as JPEGs.

Quick start

From an empty directory with the .NET 10 SDK:

Install
dotnet new console -f net10.0
dotnet add package \
  RecursiveAI.OneMedia --version 1.0.2
dotnet add package TagLibSharp \
  --version 2.3.0

Use any short WAV that both packages can open, rename a copy to clip.wav, or generate a silent PCM WAV with FFmpeg:

Generate clip.wav
ffmpeg -f lavfi \
  -i anullsrc=r=8000:cl=mono -t 0.1 \
  -map_metadata -1 -c:a pcm_s16le \
  -y clip.wav

Replace Program.cs with the following and run dotnet run. The generated WAV has no title; if you use your own file, it may already have one.

Program.cs.NET 10
using RecursiveAI.OneMedia;
 
using var taglib = TagLib.File.Create("clip.wav");
using var media = Media.Open("clip.wav");
Console.WriteLine(taglib.Tag.Title ?? "(no title)");
Console.WriteLine(media.Tags.Title ?? "(no title)");
OutputText
(no title)
(no title)

Choose by file type and write behavior

A native tag system is the format’s own way of storing metadata, such as ID3v2 in MP3 or RIFF INFO in WAV.

Photo, audio, or video metadata

TagLib#: The documented examples include JPEG snapshot time and title, and title and duration for MP3 and AVI.

OneMedia: The write mappings cover native audio and video tag systems, including ID3v2, Vorbis comments, the MP4 item list, and Matroska tags.

Edit common or native fields

TagLib#: The README shows setting Tag.Title and calling Save(), or accessing a native Xiph comment field via GetTag.

OneMedia: Changes to common tags are held until you save. TagEdits also accepts native keys. TagWriteOptions.Systems selects which supported tag systems to write, creating selected systems that are absent.

Record what landed in each tag system

TagLib#: The upstream save examples don’t document a per-system write report.

OneMedia: TagWriteReport.Systems lists written and removed fields, conversions, and fields that the target system could not represent.

Start with TagLib# if your inputs include photos alongside audio and video and the formats and fields you need are covered. Evaluate OneMedia if you need to choose which tag formats are written or log what each format could store. For instance, a WAV LIST INFO tag can store a title as INAM but has no mapping for AlbumArtist in OneMedia. Test the actual combinations of files, fields, and downstream readers you support; a shared property name doesn’t mean both libraries write the same tags.

Write and reopen two copies of the same WAV

Use the same clip.wav from the quick start. The edits leave it alone and overwrite their respective output files if present.

The TagLib# path sets the title on a copy and saves it. The OneMedia path reads the pending title before saving to a new file, then prints which native system received the field. Both paths reopen their output rather than treating a property read before save as evidence of a write.

Program.cs.NET 10
using RecursiveAI.OneMedia;
 
File.Copy("clip.wav", "taglib.wav", overwrite: true);
using (var file = TagLib.File.Create("taglib.wav"))
{
    file.Tag.Title = "TagLib title";
    file.Save();
}
using (var file = TagLib.File.Create("taglib.wav"))
    Console.WriteLine($"TagLib# reopened: {file.Tag.Title}");
 
using (var media = Media.Open("clip.wav"))
{
    media.Tags.Title = "OneMedia title";
    Console.WriteLine($"OneMedia before save: {media.Tags.Title}");
    var report = media.SaveAs("onemedia.wav", overwrite: true);
    foreach (var system in report.Systems)
        Console.WriteLine($"{system.System}: wrote {string.Join(", ", system.Written)}");
}
using var saved = Media.Open("onemedia.wav");
Console.WriteLine($"OneMedia reopened: {saved.Tags.Title}");
OutputText
TagLib# reopened: TagLib title
OneMedia before save: OneMedia title
riff-info: wrote Title
OneMedia reopened: OneMedia title

This shows one common field on one WAV layout. If you’re already moving code between the libraries, see the TagLib# to OneMedia call mapping.