AudioSpecificConfig is the configuration record of MPEG-4 Audio, defined in
ISO/IEC 14496-3. Every transport that does not repeat its settings in each frame carries
one: an M4A file in its esds box, and
LATM in its multiplex configuration. Bits are read
most significant first.
Fields
| Width in bits | Name | Meaning |
|---|---|---|
| 5 | audioObjectType | the object type. The value 31 means the type is 32 + audioObjectTypeExt, with audioObjectTypeExt in the next 6 bits |
| 4 | samplingFrequencyIndex | the rate index. The value 15 means a 24-bit samplingFrequency follows, in hertz |
| 4 | channelConfiguration | the channel configuration |
| varies | extension signalling | only for object type 5 or 29: see SBR and PS |
| varies | object-type-specific config | for the AAC family, GASpecificConfig; other types have their own |
| 2 | epConfig | only for the error-resilient object types (17, 19 to 27, and 39). Values 2 and 3 add an ErrorProtectionSpecificConfig; 3 adds a directMapping bit. Their details are in ISO/IEC 14496-3 and not reproduced here |
| varies | sync extension | an optional trailer: see SBR and PS |
Audio object types
| Value | Object type | Value | Object type |
|---|---|---|---|
| 0 | null | 23 | Error-resilient AAC Low Delay |
| 1 | AAC Main | 24 | Error-resilient CELP |
| 2 | AAC LC | 25 | Error-resilient HVXC |
| 3 | AAC SSR | 26 | Error-resilient HILN |
| 4 | AAC LTP | 27 | Error-resilient parametric |
| 5 | SBR (spectral band replication) | 28 | SSC |
| 6 | AAC Scalable | 29 | PS (parametric stereo) |
| 7 | TwinVQ | 30 | MPEG Surround |
| 8 | CELP | 31 | escape value |
| 9 | HVXC | 32 | MPEG-1 and 2 Layer I |
| 10, 11 | reserved | 33 | MPEG-1 and 2 Layer II |
| 12 | TTSI (text to speech) | 34 | MPEG-1 and 2 Layer III |
| 13 | Main synthesis | 35 | DST (direct stream transfer) |
| 14 | Wavetable synthesis | 36 | ALS (audio lossless) |
| 15 | General MIDI | 37 | SLS (scalable lossless) |
| 16 | Algorithmic synthesis and audio effects | 38 | SLS, non-core |
| 17 | Error-resilient AAC LC | 39 | Error-resilient AAC Enhanced Low Delay |
| 18 | reserved | 40 | SMR Simple |
| 19 | Error-resilient AAC LTP | 41 | SMR Main |
| 20 | Error-resilient AAC Scalable | 42 | USAC, without SBR |
| 21 | Error-resilient TwinVQ | 43 | SAOC |
| 22 | Error-resilient BSAC | 44 | Low Delay MPEG Surround |
| 45 | USAC |
Sampling frequency index
| Index | Rate | Index | Rate |
|---|---|---|---|
| 0 | 96,000 Hz | 8 | 16,000 Hz |
| 1 | 88,200 Hz | 9 | 12,000 Hz |
| 2 | 64,000 Hz | 10 | 11,025 Hz |
| 3 | 48,000 Hz | 11 | 8,000 Hz |
| 4 | 44,100 Hz | 12 | 7,350 Hz |
| 5 | 32,000 Hz | 13, 14 | reserved |
| 6 | 24,000 Hz | 15 | an explicit 24-bit rate follows |
| 7 | 22,050 Hz |
Channel configuration
| Value | Channels | Layout |
|---|---|---|
| 0 | – | defined by the object-type config, usually a program config element |
| 1 | 1 | front centre |
| 2 | 2 | front left, front right |
| 3 | 3 | front centre, front left and right |
| 4 | 4 | front centre, front left and right, back centre |
| 5 | 5 | front centre, front left and right, back left and right |
| 6 | 6 (5.1) | as 5, plus low-frequency effects |
| 7 | 8 (7.1) | front centre, front left and right, side left and right, back left and right, low-frequency effects |
| 8, 9, 10 | – | reserved |
| 11 | 7 (6.1) | added by a later edition of the standard |
| 12 | 8 (7.1) | added by a later edition of the standard |
| 13 | 24 (22.2) | added by a later edition of the standard |
| 14 | 8 (7.1 with height) | added by a later edition of the standard |
| 15 | – | reserved |
Values 11 to 14 appear in the channel table of FFmpeg’s MPEG-4 audio parser and in later editions of ISO/IEC 14496-3. The speaker positions for each were not confirmed from a public specification.
SBR and PS signalling
An HE-AAC stream can say it uses spectral band replication in three ways.
Explicitly and hierarchically, when audioObjectType is 5
(SBR) or 29 (PS):
| Width in bits | Name | Meaning |
|---|---|---|
| 4 | extensionSamplingFrequencyIndex | the output rate; 15 adds a 24-bit rate |
| 5 | audioObjectType | the object type of the core codec underneath, usually 2 (AAC LC). The value 31 escapes as above |
| 4 | extensionChannelConfiguration | only when the inner type is 22 (BSAC) |
Backward-compatibly, as a trailer after the core config, which old decoders ignore:
| Width in bits | Name | Meaning |
|---|---|---|
| 11 | syncExtensionType | 0x2B7 |
| 5 | extensionAudioObjectType | 5 for SBR; 31 escapes as above |
| 1 | sbrPresentFlag | only if the type is 5 |
| 4 | extensionSamplingFrequencyIndex | only if sbrPresentFlag is 1. 15 adds a 24-bit rate |
| 11 | syncExtensionType | a second trailer, 0x548 |
| 1 | psPresentFlag | present after 0x548 |
Implicitly: nothing is stated, and the decoder finds SBR data in the extension payloads of the raw data blocks. This is the only way an ADTS stream can carry it.
GASpecificConfig
The config for the general audio types, which include AAC Main, LC, SSR, LTP and the error-resilient and scalable AAC types.
| Width in bits | Name | Meaning |
|---|---|---|
| 1 | frameLengthFlag | 0 1024-sample long windows, 1 960. For Low Delay, 512 or 480 |
| 1 | dependsOnCoreCoder | 1 if a core coder is used |
| 14 | coreCoderDelay | only if dependsOnCoreCoder is 1 |
| 1 | extensionFlag | extension fields follow |
| varies | program_config_element | only if channelConfiguration is 0: see program config element |
| 3 | layerNr | only for object types 6 and 20 |
| 5 | numOfSubFrame | only if extensionFlag is 1 and the type is 22 (BSAC) |
| 11 | layer_length | as above |
| 1 each | aacSectionDataResilienceFlag, aacScalefactorDataResilienceFlag, aacSpectralDataResilienceFlag | only if extensionFlag is 1 and the type is 17, 19, 20 or 23 |
| 1 | extensionFlag3 | only if extensionFlag is 1; reserved for future use |
Object-type-specific configs for the other types (CELP, HVXC, TwinVQ, SSC, ALS, USAC and so on) are defined in other parts of ISO/IEC 14496-3 and are not reproduced here.
An example
The two bytes 12 10, bit by bit, are the usual config of an AAC LC file at
44,100 Hz in stereo:
| Field | Bits | Value |
|---|---|---|
| audioObjectType | 00010 | 2, AAC LC |
| samplingFrequencyIndex | 0100 | 4, 44,100 Hz |
| channelConfiguration | 0010 | 2, stereo |
| frameLengthFlag | 0 | 1024 samples |
| dependsOnCoreCoder | 0 | no core coder |
| extensionFlag | 0 | no extension |