TagLib Java is an independent Java adaptation of TagLib, an established C++ library for reading and editing metadata in popular audio formats.
- Upstream project: TagLib
- Current Parity target: 2.3.2
TagLib Java supports various metadata containers such as ID3v1, ID3v2 and Vorbis comments for MP3, MP4, AAC, Ogg, Opus, FLAC, Speex, APE, MPC, WavPack, WAV, AIFF, TrueAudio, Matroska, WebM, ASF, WMA, DSF, DFF and tracker (MOD, XM, S3M, IT) files.
The library requires Java 25 at runtime.
<dependency>
<groupId>cz.skyba</groupId>
<artifactId>taglib</artifactId>
<version>1.3.0</version>
</dependency>Read tags and audio properties:
var metadata = TagLib.read(Path.of("song.flac"));
IO.println(metadata.tag().title());
IO.println(metadata.properties().get(PropertyKey.ARTIST));
IO.println(metadata.audioProperties().lengthInSeconds());Update selected fields, preserving other properties:
TagLib.edit(Path.of("song.flac"))
.set(PropertyKey.TITLE, "New title")
.set(PropertyKey.ARTIST, "Artist A", "Artist B")
.remove(PropertyKey.COMMENT)
.save();Set a front cover and remove back covers, preserving other artwork:
TagLib.edit(Path.of("song.flac"))
.setPicture(PictureType.FRONT_COVER, Path.of("cover.jpg"))
.removePictures(PictureType.BACK_COVER)
.save();Benchmark usage, methodology and current results are in BENCHMARK.md.
TagLib Java is distributed under the GNU Lesser General Public License (LGPL 2.1) or Mozilla Public License 2.0.
This is an independent Java adaptation, not an official TagLib release or a one-to-one translation. The original TagLib project and its contributors are credited for the algorithms, format behavior and field mappings that informed this work.