IPOD Itunes Database format (0.1b)
Introduction
This document contains the detils of the ipod itunesdb file format. This information was obtained by reverse engineering the file on a 10gig Windows Ipod (firmware 1.2). It may be different on other versions.
There is still a few bits of the file I don’t know what they are for. If anyone knows please email me and I’ll update the page.
Note: In the sections below I’ve detailed the contents of the records, since they all start with the same 12 bytes (record identifier, header size, etc) I’ve started counting from this point. Therefore when I say the 0th byte it is infact the 12th byte.
Overview of the file
The file is (of course) binary, it has many records. The records start with a 4 byte string that details what kind of record it is. The next 4-byte block is the size of this single record, the next 4-byte block is the size of this record and all child records associated with it.
All the numbers in the file are 4 byte little-endian longs.
mhdb (db record)
mhsd (list container record)
mhlt (song list record)
mhit (song item 1)
mhod (title)
mhod (location)
mhod (genre)…
mhit (song item 2)
mhod (title)
mhod (location)
mhod (genre)…
mhsd (list container record)
mhlp (play list container)
mhyp (all song items)
mhod (type=100) (standard data)
mhip (songIndex=1)
mhod (type=100)
mhip (songIndex=2)
mhod (type=100)
mhyp (a user defined play list)
mhod (type=100) (standard data)
mhod (type=1) (title)
mhip (songIndex=2)
mhod (type= 100)
Songs
Mhbd
Desc: Only one of these records in the whole file. Represents the whole
database
Details:
Header1: the length of this record
Header2: relate to the size of the itunesdb file.
0-3: Always 1 (not confirmed)
4-7: Always 1 (not confirmed)
8-11: Number of child records, always 2 (not confirmed)
+ null padding
Mhsd
Desc: A list holder, holds lists of songs (MHLT) or play lists (MHLP).
Details:
Header1: the length of this record header
Header2: size of the header and all child records
0-3: Unique index number.
+ null padding
Mhlt
Desc: Header for a song. Child records (Mhit->Mhod) hold more
information.
Details:
Header1: the length of this record header
Header2: size of the header and all child records
+ null padding
Mhit
Desc: A Song item. Child records (Mhod) hold the title, genre, location,
etc.
Details:
Header1: the length of this record header
Header2: size of the header and all child records
0-3: Number of mhod records
4-7: Unique song identifier
8-11: Unknown, always 1.
12-19: Unknown always blank (unconfirmed)
20-23: Last modified time of the song file (unconfirmed)
24-27: Size of the song file in bytes.
28-31: Length of song (in 1000th’s of a second)
32-35: Track number
36-39: Null? (unconfirmed)
40-43: Year of song (1998, 2000, etc)
44-47: Bit rate (160, 128, etc)
+ padding
Mhod:
Desc: This record holds strings associated with the
Details:
0-3: Type (1=title, 2=where on the ipod, 3=album, 4=who, 5=genre, 100=see
below)
4-11: Null? (unconfirmed)
12-15: Always 1 for song items, else the correlation id if this is type 100
(for play lists, see below)
16-19: Length (in bytes) of the string.
20-27: Null? (unconfirmed)
28-end of record: The string two bytes per character (unicode?).
Playlists
Mhlp:
Desc: Place holder
Details:
Header1: Length of this single record (in bytes)
Header2: Number of child records
+ nulls
Mhyp:
Desc: A playlist record, contains records that point to the songs in the
play list.
Details:
Header1: Length of this single record (in bytes)
Header2: Length of record (including child records) upto the next mhyp record
(if there is one)
0-3: play list index
4-7: number of songs in play list (number of mhit records)
8-11: play list type (1 for the default play list, e.g. every song, 0 for every
other play list)
12-15: timestamp (looks likely, not confirmed yet)
16-23: unknown (possibly some aggregate info about songs inside, e.g. total
time, total size, … check later)
Mhip:
Desc: Points to a song record.
0-3: unknown (always 1?) (possibly some sort of type identifier)
8-11: hip-hod correlation id (relates to the mhod record (type 100), see below)
12-15: song index
16-19: a date when the record was added? (looks likely, not confirmed yet)
+ padding
Mhod (type 1):
Desc: A type 1 is a ‘title’ record. This holds the title of the play list.
Mhod records hold strings of data.
Details:
0-3: Type (1=title, 2=where on the ipod, 3=album, 4=who, 5=genre, 100=see
below)
4-11: Null? (unconfirmed)
12-15: Always 1
16-19: Length (in bytes) of the string.
20-27: Null? (unconfirmed)
28-end of record: The string two bytes per character, null padded
ascii?? unicode? (to confirm)
Mhod (type 100):
Desc: The purpose of this particular record is lost on me, The only data is
a index relating to the mhip record. I can’t only assume this is put in for
future use. Or perhaps it allows an alternate name for a song in the
playlist.
There are two types of this record in a play list. The first always seems to have the same info. The other mhod records (the ones associated with the mhit record) only have a correlation id:
Details:
First
Always the same data (Unconfirmed)
0000:069C 6D 68 6F 64 18 00 00 00 88 02 00 00 64 00 00 00 mhod....ˆ...d... 0000:06AC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:06BC 00 00 00 00 00 00 00 00 00 00 01 00 01 00 00 00 ................ 0000:06CC 05 00 00 00 00 00 00 00 02 00 64 00 00 00 00 00 ..........d..... 0000:06DC 00 00 00 00 00 00 00 00 03 00 64 00 00 00 00 00 ..........d..... 0000:06EC 00 00 00 00 00 00 00 00 04 00 64 00 00 00 00 00 ..........d..... 0000:06FC 00 00 00 00 00 00 00 00 08 00 64 00 00 00 00 00 ..........d..... 0000:070C 00 00 00 00 00 00 00 00 0D 00 64 00 00 00 00 00 ..........d..... 0000:071C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:072C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:073C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:074C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:075C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:076C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:077C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:078C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:079C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:07AC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:07BC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:07CC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:07DC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:07EC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:07FC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:080C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:081C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:082C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:083C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:084C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:085C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:086C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:087C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:088C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:089C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:08AC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:08BC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:08CC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:08DC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:08EC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:08FC 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:090C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000:091C 00 00 00 00 00 00 00 00 6D 68 69 70 ........mhip
Second
12-15: hip-hod correlation id