Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f74f632
fix: Split ID3v2 text lists on NUL only, so AC/DC stays one name
decriptor Dec 3, 2026
38e8d04
fix: Write an ID3v2.2 tag back as a readable tag (#187)
decriptor Dec 3, 2026
128db2d
fix: Read and set the Matroska album where ffmpeg puts it, keeping th…
decriptor Dec 3, 2026
50938b3
fix: Read an MP4 video track as video: coded size, codec, rotation
decriptor Dec 3, 2026
6d6d04c
fix: Report the Matroska video rotation from ProjectionPoseRoll
decriptor Dec 3, 2026
e0cdd29
fix: Keep every MP4 and APE cover role through a save
decriptor Dec 3, 2026
3cccb29
fix: Give a file with no tag a tag view that writes nothing until a v…
decriptor Dec 3, 2026
644d4b2
refactor: Share where an XMP packet's XML starts and ends
decriptor Dec 3, 2026
9540e0f
fix: Read and write a JPEG title in XMP dc:title and remove every XPT…
decriptor Dec 3, 2026
55f036f
test: Measure markup detection's allocation as the least of several runs
decriptor Dec 3, 2026
843e164
fix: Clear a field set to an empty string in every format, and count …
decriptor Dec 3, 2026
8e18b88
fix: Change the Matroska segment title when the title is set (#210)
decriptor Dec 3, 2026
cc96c6d
fix: Write the Matroska disc as DISC and the track total as "n/m", wh…
decriptor Dec 3, 2026
2033436
fix: Read and write WAV INFO by one text rule, and refuse ID3v1 text …
decriptor Dec 3, 2026
78410c9
fix: Name MPEG audio in MP4 and QuickTime by its layer, and name ProR…
decriptor Dec 3, 2026
ac7aa9a
fix: Skip non-element bytes in a Matroska Segment on every read and k…
decriptor Dec 3, 2026
912aa9d
fix: Write back the ID3v2 frames this library does not read or cannot…
decriptor Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ See the [Migration Guide](docs/MIGRATION-FROM-TAGLIB.md) for detailed comparison
- **Performance-First**: Zero-allocation parsing with `Span<T>` and `ArrayPool<T>`
- **Multi-Target**: Supports .NET Standard 2.0/2.1, .NET 8.0, and .NET 10.0
- **Format Support**:
- Audio: MP3 (ID3v1/ID3v2), FLAC, Ogg Vorbis, Ogg Opus, Ogg FLAC, WAV (RIFF INFO/ID3v2), AIFF (ID3v2), MP4/M4A (AAC/ALAC), raw AAC (ADTS/ADIF, ID3v2/APEv2/ID3v1), ASF/WMA, DSF (DSD), DFF (DSDIFF), WavPack, Monkey's Audio (.ape), Musepack
- Matroska/WebM (`.mkv`, `.mka`, `.mks`, `.mk3d`, `.webm`): tags (including `SORT_WITH` sort names for title, artist, album, album artist, and composer), chapters (editions and nested chapter atoms), duration, audio and video properties, tracks, and pictures. Tag values, chapters, pictures, and each track's enabled flag can be saved. A disabled track is not picked as the main audio or video track. Pictures are image attachments: a new front cover is written as `cover.jpg` or `cover.png` (another image type keeps its own extension, such as `cover.gif`), and fonts and other attachments are kept. WebM has no attachments, so a save that would add a picture to a WebM file fails.
- MPEG program streams (`.mpg`, `.mpeg`, `.mpe`, `.vob`) and MPEG video elementary streams (`.mpv`, `.m1v`, `.m2v`): duration, MPEG-1/MPEG-2 video properties, and the first audio stream (MPEG audio, AC-3, LPCM). ID3v2 in front of the stream, an ID3v2.4 tag appended after it (the layout TagLib# writes), and ID3v1 are read and written in place; the stream bytes are not changed.
- Audio: MP3 (ID3v1, ID3v1.1, ID3v2.2 read and saved as ID3v2.3, ID3v2.3, ID3v2.4), FLAC, Ogg Vorbis, Ogg Opus, Ogg FLAC, WAV (RIFF INFO/ID3v2), AIFF (ID3v2), MP4/M4A (AAC/ALAC, including a video track's coded width and height, codec, and rotation), raw AAC (ADTS/ADIF, ID3v2/APEv2/ID3v1), ASF/WMA, DSF (DSD), DFF (DSDIFF), WavPack, Monkey's Audio (.ape), Musepack. A tagless MP3, raw AAC, DSF, DFF, WAV, AIFF, FLAC, WavPack, Monkey's Audio, Musepack, or MP4 file still has a tag view (`IMediaFile.Tag`): reading it does not write a tag, the first assignment creates the format's tag (ID3v2 in MP3, AAC, DSF, DFF, WAV and AIFF; a Vorbis comment in FLAC; APEv2; an MP4 `ilst`), and an assignment that leaves that tag empty removes it again, so a save then writes no empty tag
- Matroska/WebM (`.mkv`, `.mka`, `.mks`, `.mk3d`, `.webm`): tags (including `SORT_WITH` sort names for title, artist, album, album artist, and composer), chapters (editions and nested chapter atoms), duration, audio and video properties, tracks, and pictures. The album is read from `TITLE` at target type 50, else from the `ALBUM` tag ffmpeg writes. Setting the album never changes the title this library reads, and never makes ffprobe or MediaInfo show the album as the title. A file with a `TITLE` at target 50 has it updated, with any `ALBUM` beside it; when the track has no title of its own, the title it showed is first kept as `TITLE` at target 30. Any other file gets an `ALBUM` tag at target 50, which ffprobe, MediaInfo and ExifTool report as the album, and no `TITLE`. On a file ffmpeg wrote, album artists that would otherwise replace the track's artist are written as `ALBUM_ARTIST`. Tag values, chapters, pictures, and each track's enabled flag can be saved. A disabled track is not picked as the main audio or video track. Pictures are image attachments: a new front cover is written as `cover.jpg` or `cover.png` (another image type keeps its own extension, such as `cover.gif`), and fonts and other attachments are kept. WebM has no attachments, so a save that would add a picture to a WebM file fails.
- MPEG program streams (`.mpg`, `.mpeg`, `.mpe`, `.vob`) and MPEG video elementary streams (`.mpv`, `.m1v`, `.m2v`): duration, MPEG-1/MPEG-2 video properties, and the first audio stream (MPEG audio, AC-3, LPCM). ID3v2 in front of the stream, an ID3v2.4 tag appended after it (the layout TagLib# writes), and ID3v1 are read and written in place; the stream bytes are not changed. A tagless stream still has a tag view: reading it does not write a tag, the first assignment creates an ID3v2 tag, and an assignment that leaves that tag empty removes it again.
- Audible `.aa`: the text dictionary (title, author, narrator, dates, descriptions, and every other key by name), the cover image, and the duration. Dictionary edits can be saved; the encrypted audio, its DRM keys, and the cover are copied unchanged. Edited files have been checked with ffprobe, ffmpeg, and ExifTool, not with Audible's own apps, which may check a digest the file stores (the purpose of the `68ec733412b9` key is unknown). Keep a copy of the original, or save to a new path. Audible `.aax` is MPEG-4 and opens as MP4/M4A, with its audiobook atoms (narrator, short and parent titles, product IDs, release date) as named properties. Decryption is out of scope.
- AVI (`.avi`, including OpenDML): RIFF INFO and `ID32` (ID3v2) tags, duration, video size, frame rate and FourCC, and the first audio stream. Tags are saved without changing the `movi` sample data; every `idx1` and OpenDML index stays valid. INFO text follows the RIFF `CSET` chunk (ISO 8859-1 when there is none): 65001, 1252, 0 and 28591 are decoded, and with no `CSET` valid UTF-8 (what ffmpeg and TagLib# write) is read as UTF-8 and other text as Windows-1252. On save, a value you did not change keeps its exact bytes and the file keeps its `CSET`; changed values are written in the file's code page when they fit it (with no `CSET`, ASCII only), otherwise the list becomes UTF-8 with a `CSET` of code page 65001 before it, which ffprobe, TagLib# and exiftool read (mediainfo ignores `CSET`). When the list becomes UTF-8, untouched text in a declared code page that is decoded exactly (1252, 28591, 0) is rewritten as the same text in UTF-8; the save is refused, with an error naming the field and the reason, when an untouched value's code page is only a guess (no `CSET`), is not decoded here (Shift-JIS, cp1251, ...), or the value holds a byte its declared code page leaves undefined (0x81, 0x8D, 0x8F, 0x90, 0x9D in 1252; 0x80-0x9F under code page 0). The new `CSET` keeps the old one's country, language and dialect codes. The five undefined 1252 code points are written as UTF-8, never as 1252 bytes. A save loads the whole file into memory (about one file's worth when nothing moves, two when the data has to move), so AVI files of 2 GiB or more cannot be saved yet; reading has no such limit.
- Still images: JPEG, PNG, GIF, BMP, PCX, Netpbm (`.pbm`, `.pgm`, `.ppm`, `.pnm`), TIFF, DNG, and SVG open through `MediaFile.Read` or `StillImageFile.ReadFromFile` with width and height. PNG text, the GIF comment, and the JPEG COM marker can be edited; a PNG edit also updates the XMP and Exif copies of the field. Other image metadata is not read or written yet.
- Still images: JPEG, PNG, GIF, BMP, PCX, Netpbm (`.pbm`, `.pgm`, `.ppm`, `.pnm`), TIFF, DNG, and SVG open through `MediaFile.Read` or `StillImageFile.ReadFromFile` with width and height. PNG text, the GIF comment, and the JPEG COM marker and title can be edited. A JPEG title is stored in XMP `dc:title`, in a new XMP segment when the file has none, and is read from there, or from IFD0 `XPTitle` (0x9C9B) when the XMP has none. A set or a clear also removes every `XPTitle`, through the same plain-structure Exif edit as any other copy, so ExifTool, Exiv2, macOS ImageIO and TagLib# show the new title (measured), and Windows reads `dc:title` when no `XPTitle` is there (System.Title photo metadata policy). A set writes one `x-default` title and drops the other languages. A title whose XMP would not fit in one 64 KB segment is refused. IPTC `ObjectName` and Exif `ImageDescription` are not changed: after a clear, ImageIO shows an IPTC `ObjectName` as the title, and Windows falls back to `UserComment` or `ImageDescription`. A PNG edit also updates the XMP and Exif copies of the field. GPS, IPTC, and other Exif values are not read. TIFF, DNG, BMP, PCX, Netpbm, and SVG have dimensions and no text tag.

## Format Support Matrix

Expand Down Expand Up @@ -75,7 +75,7 @@ See the [Migration Guide](docs/MIGRATION-FROM-TAGLIB.md) for detailed comparison
| Ogg FLAC | Vorbis Comment | — | Native only |
| WAV | RIFF INFO | ID3v2, bext (BWF) | ID3v2 preferred |
| AIFF | ID3 chunk | ANNO, COMT, NAME, AUTH, (c) (read) | ID3 preferred; edits write ID3 |
| MP4/M4A | iTunes atoms (ilst) | — | Native only |
| MP4/M4A | iTunes atoms (ilst) | — | Native only. A `vide` track is video (ISO/IEC 14496-12); its sample entry is not read as audio |
| ASF/WMA | ASF Content Description | Extended Content Description | Native only |
| DSF | ID3v2 | — | Native only |
| DFF | ID3v2 | — | Native only |
Expand Down Expand Up @@ -193,13 +193,15 @@ This is a clean-room rewrite of media tagging functionality, designed from speci
- [x] TagReadResult for error handling

### Phase 2: ID3 Support ✅
- [x] ID3v1/v1.1 reading and writing (id3.org specification)
- [x] ID3v2.3/2.4 reading and writing (id3.org specification)
- [x] Text frames (TIT2, TPE1, TALB, TYER, TDRC, TCON, TRCK, TPE2, TPOS, TCOM, TBPM, TENC, TSSE, TIT1, TIT3, TPE4, TKEY, TMOO, TMED, TLAN)
- [x] Involved people frames (TIPL, TMCL, IPLS) for musician credits
- [x] Picture frames (APIC) with multiple picture types
- [x] Syncsafe integer handling, multiple text encodings
- [x] Extended header support
- [x] ID3v1 and ID3v1.1 reading and writing (id3.org). ID3v1.1 is the track number in the last two comment bytes when byte 28 is 0
- [x] ID3v2.2 reading (id3.org). Three-character frame IDs are mapped onto their ID3v2.3 names (`TT2` to `TIT2`, `TYE` to `TYER`, `PIC` to `APIC` with its image format turned into a MIME type). A save writes the tag as ID3v2.3 with every frame that was read. A frame with no ID3v2.3 name (`CRM`, experimental IDs) and `LNK`, whose body differs in v2.3, are skipped; a frame this library does not read (such as `MCI` and `CNT`) is written back under its ID3v2.3 name. In every version, a frame this library does not read, or cannot parse, is written back as it was stored, flags included, when the tag is saved in the version it was read in. `Version` reports 2 until the saved file is read again
- [x] ID3v2.3 and ID3v2.4 reading and writing (id3.org). A new tag is v2.4 unless `Id3v2Version.V23` is passed. v2.3 frame sizes are big-endian and the year is `TYER`; v2.4 sizes are syncsafe, text may be UTF-8, and the year is `TDRC`. A header whose major version is not 2, 3, or 4 is rejected
- [x] Text lists split on NUL only (ID3v2.4 frames §4.2), in every version. A slash is part of the value, so `AC/DC` stays one performer. ID3v2.3's TPE1 text says `/` separates artists; that rule is not applied. `"(17)"` is still the ID3v1 genre Rock. Track and disc numbers still use `n/m`
- [x] Text frames (TIT2, TPE1, TALB, TYER, TDRC, TCON, TRCK, TPE2, TPOS, TCOM, TBPM, TENC, TSSE, TIT1, TIT3, TPE4, TKEY, TMOO, TMED, TLAN)
- [x] Involved people frames (TIPL, TMCL, IPLS) for musician credits
- [x] Picture frames (APIC) with multiple picture types
- [x] Syncsafe integer handling, multiple text encodings
- [x] Extended header support

### Phase 3: Xiph Formats ✅
- [x] Vorbis Comments (xiph.org specification)
Expand Down Expand Up @@ -267,8 +269,9 @@ This is a clean-room rewrite of media tagging functionality, designed from speci
- [x] ISO 14496-12 box parsing (ftyp, moov, mdat, etc.)
- [x] iTunes-style metadata atoms (ilst with ©nam, ©ART, etc.)
- [x] AAC audio properties via esds parsing
- [x] Video track width, height, and codec from a visual sample entry (ISO/IEC 14496-12), including when the handler is not `vide`. Width and height are the coded size, as ffprobe and mediainfo report it: the track matrix is not applied but returned as `VideoProperties.Rotation` (clockwise degrees; 0 for a matrix that mirrors or skews), and the pixel aspect ratio is not applied. An `mp4v` entry's codec is named from its `esds` object type (MPEG-4, MPEG-1 and MPEG-2 video, JPEG, PNG). A track another track names as chapters (`tref`/`chap`), such as Apple's chapter images, is not the video. That entry is not parsed as audio
- [x] ALAC audio properties via alac magic cookie
- [x] Album art (covr atom) with JPEG/PNG detection
- [x] Album art (`covr`) with JPEG/PNG detection. The data type is the image format. QuickTime has no field for a picture role, so a role other than front cover is kept by a private convention: the data atom's locale holds the role one higher than the ID3 picture type in its top byte, a country byte no real locale uses. `Other` round-trips, and a locale of zero (or any real one) reads as front cover. AVFoundation, QuickLook, ffprobe, ExifTool and MediaInfo still show the image as a normal cover
- [x] MusicBrainz IDs and ReplayGain via freeform atoms
- [x] Atomic file writing with mdat relocation
- [x] Chapters: Nero `chpl` and QuickTime chapter text track (`tref`/`chap`), read and write
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Based on the specification in `/Users/sshaw/code/roon-8/Docs/TagLibSharp2/` and
| Feature | Status |
|---------|--------|
| Header parsing | ✅ |
| v2.2 support (3-char frames) | ✅ |
| v2.2 support (3-char frames) | ✅ | Read and mapped to ID3v2.3 IDs. A save writes the tag as ID3v2.3 |
| v2.3 support | ✅ |
| v2.4 support | ✅ |
| Extended header parsing | ✅ |
Expand Down
1 change: 0 additions & 1 deletion docs/IMPLEMENTATION-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ how it was broken before.
remove them.

Known gaps on main are follow-up bugs, not precedent. Do not copy them:
- Matroska `Clear()` and `Title = null` keep `Info/Title`, so the title still reads back.
- Audible `Clear()` keeps `user_alias`, an account name.

*Past example:* an MP4 `Clear()` kept the unmapped `apID` atom, so a "cleaned" file still carried the
Expand Down
2 changes: 1 addition & 1 deletion docs/MP4_COMPREHENSIVE_SPECIFICATION_ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ Used for alphabetical sorting, ignoring articles like "The".

**Structure:**
- Can contain multiple `data` atoms (front cover, back cover, etc.)
- Each data atom has type indicator 13 (JPEG) or 14 (PNG)
- Each data atom has type indicator 13 (JPEG) or 14 (PNG). That code is the image format, not an ID3 picture role. A role other than front cover is stored in the top byte of a zero locale, one higher than the ID3 picture type, so this library can read it back. A locale of zero still reads as front cover. ExifTool still shows the image as cover art
- No size limit specified, but typically ≤ 2048×2048 pixels

**Example:**
Expand Down
Loading
Loading