Introduction
An OMA file may start with a tag. It is an ID3v2 tag whose first three bytes are the lower-case letters
ea3 instead of ID3, so that ID3 readers do not mistake the file for an MP3. The tag holds
the title, the artist and other text, and in protected files the key ring. The EA3 header follows
the last byte of the tag. A file with no tag starts directly with the letters EA3 (upper case); atracdenc
writes files that way, and FFmpeg’s reader and its format probe accept them.
Multi-byte numbers in the tag are big-endian.
Tag header
Ten bytes.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 3 | Magic | The bytes 65 61 33, the letters ea3. |
| 3 | 1 | Version | The ID3v2 major version of the frames. 3 in every file read; with 4 the frame sizes are syncsafe (seven bits a byte). |
| 4 | 1 | Revision | The ID3v2 revision, 0. |
| 5 | 1 | Flags | Bit 7 unsynchronisation, bit 6 extended header present, bit 5 experimental, bit 4 footer present. |
| 6 | 4 | Size | The number of bytes after this header, not counting a footer: four bytes of seven bits each, most significant first (the top bit of every byte must be 0). |
The tag ends at byte 10 + Size (plus 10 when the footer flag is set). The EA3 header starts there.
When the extended header flag is set, a 4-byte size and that many bytes follow the tag header before the first
frame.
Frames
Frames follow one after another from byte 10 (or after the extended header) to the end of the tag body. A frame is a ten-byte header and its data.
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | Id | Four letters or digits: TIT2 title, TPE1 artist, TALB album, TCON genre, TRCK track, TYER year, TSSE encoder settings, TLEN length, TCOM composer, TPE2 album artist, TPOS disc, TDRC recording time, TENC encoded by, TXXX user text, GEOB general object, APIC picture, COMM comment. |
| 4 | 4 | Size | The data size, not counting these ten bytes. Big-endian in version 3, syncsafe in version 4. |
| 8 | 2 | Flags | Frame flags (tag and file alter preservation, read only, compression, encryption, grouping), as in ID3v2.3. |
A frame whose first byte is 0 starts the padding. A frame that runs past the end of the tag is cut at the end.
Text frames (ids that start with T)
The first data byte is the text encoding: 0 Latin-1, 1 UTF-16 with a byte order mark, 2 UTF-16 big-endian, 3 UTF-8. The text follows, with trailing zeros removed. TXXX has a description first (ended by a zero, two zeros in UTF-16), then the value.
GEOB (general encapsulated object)
An encoding byte, the MIME type (Latin-1, ended by one zero), the file name and the description (both in the
encoding, each ended by a zero), then the object bytes to the end of the frame. Protected files carry a GEOB frame
whose description is OMG_LSI or OMG_BKLSI; its object is the key ring
(Encryption).
Padding
Bytes between the last frame and the end of the tag are zero. They belong to the tag; the EA3 header does not start before the tag ends.
Sources
- FFmpeg
libavformat/omadec.c(oma_read_probe,oma_read_header,decrypt_init): the match on the lettersea3, the tag length, the GEOB descriptions OMG_LSI and OMG_BKLSI, and the hand-over to FFmpeg’s generic ID3v2 reader for the header, frames and text layouts (the explorer’s own reader follows ID3v2.3). - ID3v2.3.0 informal standard: the flags, the extended header and footer and the text encodings.
Links
Reference
- ID3v2.3.0 informal standard – the frame and tag layout the ea3 tag follows