The audio codec for mp4 atom

 


In the 'esds' atom there are a few fields of relevance to determining the codec used. The first byte of content of the esds atom is the objectTypeIndication. (This is the 11th byte from your solution.) This field is supposed to indicate the codec used but annoyingly there are a few entries used by multiple codecs. A full list of values is available from the MP4RA. From the list a few are relevant in this case.:

  • 0x40 - MPEG-4 Audio
  • 0x6B - MPEG-1 Audio (MPEG-1 Layers 1, 2, and 3)
  • 0x69 - MPEG-2 Backward Compatible Audio (MPEG-2 Layers 1, 2, and 3)
  • 0x67 - MPEG-2 AAC LC

0x6B and 0x69 denote MPEG-1 and 2 respectively layers 1, 2, and 3. 0x67 denotes MPEG-2 AAC LC but generally is unused in favor of 0x040 (0x66 and 0x68 are also MPEG-2 AAC profiles are seen even less frequently). 0x40 denotes MPEG-4 Audio. MPEG-4 Audio generally is thought of as AAC but there is a whole framework of audio codecs that can go in MPEG-4 Audio including AAC, BSAC, ALS, CELP, and something called MP3On4. MP3On4 is an MP3 variant with some new header information for multichannel.

We can figure out what audio format is actually in the MPEG-4 Audio by looking at the the AudioSpecificConfig. This is the global header for the decoder that exists at byte 13 of the content of the 'esds' atom. At the begining of the AudioSpecificConfig there is a 5-bit AudioObjectType. A full list can be found on the multimedia wiki (that was linked in your post under the 'MPEG-4 Audio' article but here are the useful values:

  • 00 - NULL
  • 01 - AAC Main (a deprecated AAC profile from MPEG-2)
  • 02 - AAC LC or backwards compatible HE-AAC (Most realworld AAC falls in one of these cases)
  • 03 - AAC Scalable Sample Rate (rarely used)
  • 03 - AAC LTP (a replacement for AAC Main, rarely used)
  • 05 - HE-AAC explicitly signaled (Non-backward compatible)
  • 22 - ER BSAC (A Korean broadcast codec)
  • 23 - Low Delay AAC
  • 29 - HE-AACv2 explicitly signaled (In one draft this was MP3On4 instead)
  • 31 - ESCAPE (read 6 more bits, add 32)
  • 32 - MP3on4 Layer 1
  • 33 - MP3on4 Layer 2
  • 34 - MP3on4 Layer 3

If you aren't worried about 'MP3On4' mp3 variant nor the other weird MPEG-4 Audio codecs then just use the objectTypeIndication.

In the MPEG specifications these details are spread across 14496-1, -12, -14, and -3. Of these only 14496-12 is freely available.

参考:

mp4 atom - How to discriminate the audio codec? Is it AAC or MP3?




This section documents the ObjectTypeIndication used in MPEG-4 systems to indicate the type of streams. Applications for a new codec type will also automatically receive an object type indication.

This table also occurs in ISO/IEC 14496-1 (various versions), the MPEG-4 systems specification. The intent is that the table maintained by this registration authority is the most up-to-date and definitive version.

There is also an informative table of the current StreamType allocations.

 
     
Value ObjectTypeIndication Description Defined in/by
0x00 Forbidden  
0x01 Systems ISO/IEC 14496-1 (a) MPEG-4
0x02 Systems ISO/IEC 14496-1 (b) MPEG-4
0x03 Interaction Stream MPEG-4
0x04 Extended BIFS (h) MPEG-4
0x05 AFX Stream (i) MPEG-4
0x06 Font Data Stream MPEG-4
0x07 Synthetised Texture MPEG-4
0x08 Text Stream MPEG-4
0x09 LASeR Stream MPEG-4
0x0A Simple Aggregation Format (SAF) Stream MPEG-4
0x20 Visual ISO/IEC 14496-2 (c) MPEG-4
0x21 Visual ITU-T Recommendation H.264 | ISO/IEC 14496-10 (g) MPEG-4
0x22 Parameter Sets for ITU-T Recommendation H.264 | ISO/IEC 14496-10 (g) MPEG-4
0x40 Audio ISO/IEC 14496-3 (d) MPEG-4
0x60 Visual ISO/IEC 13818-2 Simple Profile MPEG-4
0x61 Visual ISO/IEC 13818-2 Main Profile MPEG-4
0x62 Visual ISO/IEC 13818-2 SNR Profile MPEG-4
0x63 Visual ISO/IEC 13818-2 Spatial Profile MPEG-4
0x64 Visual ISO/IEC 13818-2 High Profile MPEG-4
0x65 Visual ISO/IEC 13818-2 422 Profile MPEG-4
0x66 Audio ISO/IEC 13818-7 Main Profile MPEG-4
0x67 Audio ISO/IEC 13818-7 LowComplexity Profile MPEG-4
0x68 Audio ISO/IEC 13818-7 Scaleable Sampling Rate Profile MPEG-4
0x69 Audio ISO/IEC 13818-3 MPEG-4
0x6A Visual ISO/IEC 11172-2 MPEG-4
0x6B Audio ISO/IEC 11172-3 MPEG-4
0x6C Visual ISO/IEC 10918-1 MPEG-4
0x6D Portable Network Graphics (f) PNG
0x6E Visual ISO/IEC 15444-1 (JPEG 2000) MPEG-4
0xA0 EVRC Voice 3GPP2
0xA1 SMV Voice 3GPP2
0xA2 3GPP2 Compact Multimedia Format (CMF) 3GPP2
0xA3 SMPTE VC-1 Video SMPTE
0xA4 Dirac Video Coder Dirac
0xA5 AC-3 Audio ETSI
0xA6 Enhanced AC-3 audio ETSI
0xA7 DRA Audio DRA
0xA8 ITU G.719 Audio ITU G.719
0xA9 DTS Coherent Acoustics audio DTS
0xAA DTS-HD High Resolution Audio DTS
0xAB DTS-HD Master Audio DTS
0xAC DTS Express low bit rate audio, also known as DTS LBR DTSE
0xC0 - 0xE0 user private  
0xE1 13K Voice 3GPP2
0xE2 - 0xFE user private  
0xFF no object type specified (e) MPEG-4
  1. This type is used for all 14496-1 streams unless specifically indicated to the contrary. Scene Description scenes, which are identified with StreamType=0x03 (see Table 9 ), using this object type value shall use the BIFSConfig specified in section 9.3.5.2.2  of this specification.
  2. Used, with StreamType=0x03 (see Table 9 ), for Scene Description streams that use the BIFSv2Config. Its use with other StreamTypes is reserved .
  3. Includes associated Amendment(s) and Corrigendum(a). The actual object types are defined in ISO/IEC 14496-2 and are conveyed in the DecoderSpecificInfo as specified in ISO/IEC 14496-2, Annex K.
  4. Includes associated Amendment(s) and Corrigendum(a). The actual object types are defined in ISO/IEC 14496-3 and are conveyed in the DecoderSpecificInfo as specified in ISO/IEC 14496-3 subpart 1 subclause 6.2.1.
  5. Streams with this value with a StreamType indicating a systems stream (values 1,2,3, 6, 7, 8, 9) shall be treated as if the ObjectTypeIndication had been set to 0x01.
  6. For PNG Streams, the following configuration/rules apply:
    • StreamType: 0x04 (visual)
    • No decoder specific info needed
    • The PNG stream shall consist in only one (1) AccessUnit
    • The PNG stream access unit shall contain the complete PNG image/file
    • MNG shall not be used inside PNG streams
  7. Includes associated Amendment(s) and Corrigendum(a). The actual object types are defined in ITU-T Recommendation H.264 | ISO/IEC 14496-10 and are conveyed in the DecoderSpecificInfo.
  8. Used,  with StreamType=0x03, for Scene Description streams that use the BIFSConfigEx; its use with other StreamTypes is reserved. (Was previously reserved for MUCommandStream but not used for that purpose.)
  9. Used,  with StreamType=0x03, for Scene Description streams that use the AFXConfig; its use with other StreamTypes is reserved.
Value StreamType Description
0x00 Forbidden
0x01 ObjectDescriptorStream (see 8.5)
0x02 ClockReferenceStream (see 10.2.5)
0x03 SceneDescriptionStream (see 9.2.1)
0x04 VisualStream
0x05 AudioStream
0x06 MPEG7Stream
0x07 IPMPStream (see 8.3.2)
0x08 ObjectContentInfoStream (see 8.4.2)
0x09 MPEGJStream
0x0A Interaction Stream
0x0B IPMPToolStream
0x0C FontDataStream
0x0D StreamingText
0x20- 0x3F user private
参考:http://www.mp4ra.org/object.html

你可能感兴趣的:(android多媒体)