Audible Audio

From MultimediaWiki
Jump to navigation Jump to search

Proprietary container format from There is no published specification. It may contain one of five different encodings which are numbered 1 thru 5. 1-3 are rumored to be at varying bitrates. #4 is MP3. #5 is some unknown Sony format.

To find files, use Google "filetype:aa audible".

Apparently this project knows everything below this: PyAudibleTags

File format

The file is composed of multiple chunks (11 chunks in all files seen so far in the wild):

  • general header
  • multiple binary metadata chunks
  • a single textual metadata chunk
  • offsets table
  • audio data
  • cover image

Whenever multi-byte values are used (e.g. 32-bit integers), they are encoded in big-endian format.

General header

First 32-bit word is the file size including these four bytes.

Third 32-bit word is the number of chunks in the file.

A chunk index begins at the fourth word (file offset 16); for each chunk, this index includes three 32-bit values:

  • The chunk type
  • Chunk starting position in file
  • Chunk size

Internal structure and meaning for most chunks is unknown. The following table summarizes the known chunk types:

chunk type code contents
0x00 entire file
0x02 textual metadata
0x06 offsets table
0x0a (encrypted) audio contents
0x0b cover image

Textual metadata

The textual metadata (chunk type 2) consists of a sequence of named attributes. The attribute names are textual (ASCII); attribute values appear to be encoded in UTF-8. This chunk is formatted as follows:

  • 32-bit number of attributes (n_attrs)
  • n_attrs attribute entries, each consisting of
    • 1 byte: 0x00
    • 32 bits: name_length
    • 32 bits: value_length
    • name_length bytes: attribute name
    • value_length bytes: value

Interesting and useful attributes include author, narrator, title, pubdate, and description.

Offset table

The offsets table (chunk type 6) lists all audio frames in the file, split into chapters.

Its format is:

  • 32-bit number of chapters (n_chaps)
  • n_chaps chapters:
    • 32-bit flag word (usage unknown, observed values 0..3)
    • 2 32-bit unused words (always 0xffffffff)
    • 32-bit size of chapter in bytes
    • 32-bit number of offsets in chapter (n_offsets); each offset refers to one second of playback
    • 16-bit unknown half-word (always 0xc00d)
    • 32-bit number of offsets in chapter (n_offsets, again)
    • n_offsets offset entries:
      • 32-bit flag word (usage unknown, observed values 0..2)
      • 32-bit offset inside chapter

The offsets table is useful for determining the number of chapters in the file and each chapter's length.

Cover image

The cover image (chunk type 11) is stored as follows:

  • 32-bit length of image (imglen)
  • 32-bit file position of image (always points to next byte in practice)
  • imglen bytes: JPEG (EXIF) cover image