Since QuickTime 7, metadata is stored as key–value pairs in a meta atom, which
may sit in moov, trak or mdia (at most one per place).
Where it and the older user data say the
same thing, the metadata wins. Phones and cameras write keys such as the recording location
here.
meta
| Child | Required | Meaning |
|---|---|---|
hdlr | yes | Metadata handler; its type must be mdta for this layout. |
mhdr | if items have IDs | Metadata header: next item ID. |
keys | yes | The key table. |
ilst | yes | The values. |
ctry | no | Country lists. |
lang | no | Language lists. |
free | no | Free space, allowed between these atoms but not inside ilst. |
Unlike the ISO meta box, Apple’s meta atom is a plain container
with no version and flags. If the handler type is not mdta, another
specification defines the contents: the iTunes-style tags in M4A and many MP4 files use
handler mdir, with item atoms named ©nam, ©ART and
so on instead of key indexes. Unknown atoms inside ilst are ignored;
uuid atoms may appear wherever a list of atoms is allowed.
hdlr and mhdr
| Offset | Size | Name | Meaning (hdlr) |
|---|---|---|---|
| 8 | 1 | version | 0. |
| 9 | 3 | flags | 0. |
| 12 | 4 | predefined | 0. |
| 16 | 4 | handler type | mdta. |
| 20 | 12 | reserved | Three uint32, 0. |
| 32 | varies | name | Null-terminated UTF-8, for debugging; may be a single 0 byte. |
mhdr: version and flags (0), then nextItemID (uint32), the next
unique item ID to assign, normally one more than the largest used. 0xFFFFFFFF means new IDs
must be found by searching for an unused value. (Apple’s field list spells the type
mdhr in one place; the atom is mhdr.)
keys
| Offset | Size | Name | Meaning |
|---|---|---|---|
| 8 | 1 | version | 0. |
| 9 | 3 | flags | 0. |
| 12 | 4 | entry count | Keys that follow. |
| 16 | varies | keys | Each: key size (uint32, including these 8 bytes), key namespace (uint32), key value (key size − 8 bytes). |
Keys are numbered from 1; 0 is never an index. Namespace mdta uses reverse-DNS
key names; namespace udta uses a user data four-character code. Apple’s example
table holds three keys:
| Index | Key size | Namespace | Key value |
|---|---|---|---|
| 1 | 38 | mdta | com.apple.quicktime.copyright |
| 2 | 35 | mdta | com.apple.quicktime.author |
| 3 | 12 | udta | ©cpy |
ilst, items and data
ilst holds one item atom per value. An item’s type is not a four-character
code but the 1-based key index as a uint32, so key 1’s item has type
0x00000001. An item holds:
| Atom | Contents |
|---|---|
itif | Optional item information: version and flags (0), item ID (uint32, unique in this meta). Required if the item has an ID or non-zero flags; no flags are defined. |
name | Optional: version and flags, then a UTF-8 name filling the atom. Not shown to users; no two items may share a name. |
data | One or more values, ordered from the most specific to the most general locale or form, so a reader can stop at the first it can use. |
| Offset | Size | Name | Meaning (data) |
|---|---|---|---|
| 8 | 1 | type set | Must be 0: the well-known types. Other values are reserved. |
| 9 | 3 | type | Well-known type code (table below). |
| 12 | 2 | country | 0 default for every country; 1 to 255 a 1-based index into ctry; otherwise an ISO 3166 code as two ASCII letters. |
| 14 | 2 | language | 0 default; 1 to 255 an index into lang; otherwise a packed ISO 639-2/T code. |
| 16 | varies | value | The value, in the format its type says. |
For example, an item for key 1 whose value is the UTF-8 text “Hello”:
00 00 00 1D 00 00 00 01 item: size 29, key index 1
00 00 00 15 64 61 74 61 data: size 21
00 00 00 01 00 00 00 00 type 1 (UTF-8), default locale
48 65 6C 6C 6F “Hello”
A writer that does not want to limit a value to certain countries uses the ISO 3166
reserved code ZZ; for any language, und. A locale matches when both
country and language match, a 0 matching anything.
ctry and lang
Both are full atoms (version and flags, then a uint32 count of lists). Each list is a
uint16 count and that many uint16 codes: ISO 3166 two-letter codes in ctry,
packed ISO 639-2/T codes in lang. Lists are referred to by 1-based index from
data atoms; at most 255 codes per atom. Apple’s example lang holds
two lists: 5575, 6721, 4277 (eng, fra, deu) and
19969, 16882 (spa, por).
Well-known types
| Code | Type | Notes |
|---|---|---|
| 0 | Reserved | Where no type is needed. |
| 1 | UTF-8 | No count or terminator. |
| 2 | UTF-16 | Big-endian. |
| 3 | S/JIS | Deprecated unless needed for special Japanese characters. |
| 4 | UTF-8 sort | A form of the text used only for sorting. |
| 5 | UTF-16 sort | A form of the text used only for sorting. |
| 13 | JPEG | In a JFIF wrapper. |
| 14 | PNG | A PNG file. |
| 21 | BE signed integer | 1, 2, 3 or 4 bytes, from the value’s size. Not allowed in timed metadata (use 65 to 67). |
| 22 | BE unsigned integer | 1, 2, 3 or 4 bytes. Not allowed in timed metadata (use 75 to 77). |
| 23 | BE Float32 | IEEE 754. |
| 24 | BE Float64 | IEEE 754. |
| 27 | BMP | Windows bitmap. |
| 28 | QuickTime metadata atom | A block with the structure of a meta atom. |
| 65 | 8-bit signed integer | |
| 66 | BE 16-bit signed integer | |
| 67 | BE 32-bit signed integer | |
| 70 | BE PointF32 | x, y as Float32. |
| 71 | BE DimensionsF32 | width, height as Float32. |
| 72 | BE RectF32 | x, y, width, height as Float32. |
| 74 | BE 64-bit signed integer | |
| 75 | 8-bit unsigned integer | |
| 76 | BE 16-bit unsigned integer | |
| 77 | BE 32-bit unsigned integer | |
| 78 | BE 64-bit unsigned integer | |
| 79 | AffineTransformF64 | A 3 × 3 matrix of Float64. |
QuickTime metadata keys
All in namespace mdta. Text values are UTF-8 (type 1) and may have several
values for different languages and countries.
| Key | Value |
|---|---|
com.apple.quicktime.album | Album or collection the content belongs to. |
com.apple.quicktime.artist | Artist who created the content. |
com.apple.quicktime.artwork | One representative image: JPEG (13), PNG (14) or BMP (27). |
com.apple.quicktime.author | Author. |
com.apple.quicktime.comment | User comment. |
com.apple.quicktime.copyright | Copyright statement. |
com.apple.quicktime.creationdate | Date the content was created, as text. |
com.apple.quicktime.description | Description. |
com.apple.quicktime.director | Director. |
com.apple.quicktime.title | Title, usually one line. |
com.apple.quicktime.genre | Genre or genres, free text. |
com.apple.quicktime.information | Information about the content. |
com.apple.quicktime.keywords | Keywords. |
com.apple.quicktime.location.ISO6709 | Location as an ISO 6709:2008 string, such as +27.5916+086.5640+8850/. |
com.apple.quicktime.producer | Producer. |
com.apple.quicktime.publisher | Publisher. |
com.apple.quicktime.software | Software that made the content. |
com.apple.quicktime.year | Year the file or original content was made, such as 2012. |
com.apple.quicktime.collection.user | A user-defined collection containing the movie. |
com.apple.quicktime.rating.user | Float32 (23) from 0.0 to 5.0; 0.0 means not rated. |
com.apple.quicktime.location.name | Name of the location. |
com.apple.quicktime.location.body | Astronomical body, as in 3GPP; earth if absent. |
com.apple.quicktime.location.note | Descriptive comment. |
com.apple.quicktime.location.role | Unsigned integer (22), one byte: 0 shooting location, 1 real location, 2 fictional location. |
com.apple.quicktime.location.date | ISO 8601 date and time, such as 2012-02-24T17:56Z. |
com.apple.quicktime.direction.facing | Direction the camera faces, with no locale, such as +20.34M/-5.3. |
com.apple.quicktime.direction.motion | Direction the camera moves, same format. |
A direction is a compass heading in degrees, optionally signed and optionally followed
by M for magnetic, then optionally a slash and an elevation angle; in the
example, 20.34° magnetic, 5.3° below the horizontal.