TagLib is an open-source, cross‑platform C++ library designed for reading, editing, and storing metadata (commonly known as tags) in audio files. The library provides a uniform API for handling a variety of popular audio formats and their associated tag types, such as ID3v1, ID3v2, Vorbis comments, MP4 tags, APE tags, and others.
History and Development
The TagLib project was initiated in 2003 by Michael Pyne and has since been maintained by a community of contributors. Development is coordinated through a public source‑code repository hosted on platforms such as GitHub. The library is released under the GNU Lesser General Public License (LGPL) version 2.1, allowing both open‑source and proprietary software to link against it under the terms of that license.
Key Features
| Feature | Description |
|---|---|
| Supported Formats | MP3 (ID3v1, ID3v2), OGG Vorbis, FLAC, MP4/M4A (MP4 atoms), AIFF, WAV, Musepack (MPC), Monkey’s Audio (APE), and others. |
| Tag Types | Full read/write access to ID3v1, ID3v2, Vorbis comment, APE tag, MP4 tag, and custom tag structures. |
| Unicode Support | Handles UTF‑8, UTF‑16, and ISO‑8859‑1 encodings for tag text. |
| Thread Safety | Provides re‑entrant functions; instances can be used concurrently when separate objects are created. |
| Platform Compatibility | Compiles on major operating systems, including Windows, macOS, Linux, and BSD variants. |
| Language Bindings | Official C++ API, with third‑party bindings for languages such as Python (pytaglib), Java (jtaglib), and .NET (TagLib#). |
Architecture
TagLib follows an object‑oriented design. Core classes include File, representing an abstract audio file, and specialized subclasses such as MPEG::File for MP3, FLAC::File for FLAC, and MP4::File for MP4 containers. Tag data is accessed via Tag subclasses (e.g., ID3v2::Tag). The library abstracts format‑specific details, allowing developers to interact with metadata through a consistent interface.
Typical Usage
A minimal example in C++ demonstrates reading the title and artist from an MP3 file:
#include <taglib/fileref.h>
#include <taglib/tag.h>
TagLib::FileRef f("song.mp3");
if(!f.isNull() && f.tag()) {
TagLib::Tag *tag = f.tag();
std::cout << "Title: " << tag->title() << std::endl;
std::cout << "Artist: " << tag->artist() << std::endl;
}
The same API can be used to modify tags and save changes back to the file.
Adoption
TagLib is employed by a wide range of multimedia applications and utilities, including but not limited to:
- VLC media player
- Amarok music player
- Audacious audio player
- Clementine music player
- MediaMonkey (via TagLib#)
Its lightweight footprint and permissive LGPL licensing make it a common choice for both desktop and embedded audio software.
Project Resources
- Official website: https://taglib.org/
- Source repository: https://github.com/taglib/taglib
- Documentation: Provided via Doxygen-generated API reference on the official site.
- Latest stable release (as of 2024): version 1.13.1, released in early 2024.
Limitations
While TagLib supports a broad set of formats and tag types, certain niche or proprietary metadata schemes are not covered. Additionally, complex tag structures such as embedded album art in some containers may require additional handling beyond the core library functions.
See Also
- ID3 – Standard metadata container for MP3 files.
- Vorbis comment – Metadata format used in OGG and FLAC files.
- MP4 atom – Container structure for metadata in MP4/M4A files.
References
- TagLib Project. “TagLib – Audio Meta‑Data Library.” https://taglib.org/. Accessed July 2026.
- TagLib GitHub Repository. “Releases.” https://github.com/taglib/taglib/releases. Accessed July 2026.
- “TagLib License.” TagLib.org. https://taglib.org/license.html. Accessed July 2026.