APE tags come from Monkey’s Audio and appear on MP3 files too, usually written by MP3Gain and other tools. They are lists of named items at the end of the file, placed before any ID3v1 tag. Numbers are little-endian. APEv1 has only a footer, APEv2 may also have a header.
Layout
| Part | Size | Notes |
|---|---|---|
| Header | 32 | optional; APEv2 only |
| Items | varies | in the order written; shorter items usually first |
| Footer | 32 | always in APEv1; usual in APEv2 |
Header and footer
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 8 | Preamble | APETAGEX |
| 8 | 4 | Version | 1000 for APEv1, 2000 for APEv2 |
| 12 | 4 | Tag size | bytes of the items and the footer, not the header |
| 16 | 4 | Item count | items in the tag |
| 20 | 4 | Flags | see below |
| 24 | 8 | Reserved | zero |
| Flag bit | Meaning |
|---|---|
| 31 | the tag has a header |
| 30 | the tag has no footer |
| 29 | this 32-byte block is the header (0 for the footer) |
| 1–2 | item type, in items (see below) |
| 0 | read-only, in items |
Items
| Size | Field | Meaning |
|---|---|---|
| 4 | Value size | bytes of the value |
| 4 | Item flags | bit 0 read-only; bits 1–2 the type: 0 UTF-8 text, 1 binary, 2 external locator (a UTF-8 URL), 3 reserved |
| varies | Key | ASCII, 2 to 255 characters, ending in a zero byte |
| value size | Value | text may list several values separated by zero bytes; a binary value begins with a description then a zero byte |
The usual keys, all case-insensitive:
| Key | Meaning | Key | Meaning |
|---|---|---|---|
Title | Title | Subtitle | Subtitle |
Artist | Artist | Album | Album |
Debut album | Debut album | Publisher | Publisher |
Conductor | Conductor | Track | Track number |
Composer | Composer | Comment | Comment |
Copyright | Copyright | Publicationright | Publication right |
File | The source file | Year | Year |
Record Date | Recording date | Record Location | Recording location |
Genre | Genre | Media | Media |
EAN/UPC, ISBN, ISRC | Barcodes and identifiers | Catalog | Catalogue number |
LC | Label code | Language | Language |
Index | Indexes for quick access | Related | Related information |
Abstract | Abstract | Bibliography | Bibliography |
Introplay | Introplay | REPLAYGAIN_*, MP3GAIN_* | Written by gain tools |