AAC Configuration
AAC is MPEG4 part 3 and it comes with a configuration data before it can be decoded by a decoder. This configuration data can usually be found in the SDP, under audio track -> config. Normally, it is a 2 bytes in hexadecimal. Below is a sample of the information which may be contains in the configuration data.
1210 = 0001 0010 0001 0000
5 bits for object type = 00010 = 2 = AAC low complexity
4 bits for sampling rate = 0100 = 44100hz
4 bit for channel = 0010 = 2 channel
1 bit for frame length flag = 0 for 1024 sample
1 bit for depends on core coder = 0
1 bit for extension flag = 0
frame length flag:
0: Each packet contains 1024 samples
1: Each packet contains 960 samples
See http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio for complete list.
1210 = 0001 0010 0001 0000
5 bits for object type = 00010 = 2 = AAC low complexity
4 bits for sampling rate = 0100 = 44100hz
4 bit for channel = 0010 = 2 channel
1 bit for frame length flag = 0 for 1024 sample
1 bit for depends on core coder = 0
1 bit for extension flag = 0
frame length flag:
0: Each packet contains 1024 samples
1: Each packet contains 960 samples
The full specification for AudioSpecificConfig is stated in ISO 14496-3 Section 1.6.2.1
See http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio for complete list.
As Object Type has only 5. How to i represent object type = 39 . I need to send AOT = 39 ,48khz,1 channel. How can i send in config param ? Please help me.
ReplyDeleteI meant Object Type has only 5 bits. Max of 32 can be sent. how can i send 39 (AAC-ELD)
ReplyDeleteFor AOT > 30, you have to set first 5 bit as AOT = 31. Then, the next 6 bit + 32 represents the AOT value
ReplyDelete5 bits: object type
if (object type == 31)
6 bits + 32: object type
4 bits: frequency index
if (frequency index == 15)
24 bits: frequency
4 bits: channel configuration
var bits: AOT Specific Config
See http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio
as per above calculation does config = B98C00 has 960 samples... can you please confirm, i am struck here.
ReplyDeleteif i need 1024, i need to send config = B97C00 .. please confirm.
Yup B98C is using 960 sample
ReplyDeleteThanks a lot Thompson for your immediate reply and constant help.
ReplyDeleteI am trying to decode AAC LD stream, what i found out from AAC Payload- it has 2 bytes of Frame AU header, followed by two bytes of AU header for each AU unit and than followed by AU Data. I did not find any other values/Field. I am following RFC 3640... Can you please comment on my understand.
Any softclient/open source which supports AAC LD ?
Thanks a lot.
AAC LD (AAC low delay) should not affect anything in RFC 3640. In another word, RFC 3640 packet data independently.
ReplyDeleteIn your case, you seems to have a rtp packets that contains multiple AAC data.
In that case, your first 2 bytes is AU headers length.
And since you said that it is a 2 bytes AU header, you are using HBR mode. You should verify this from your sdp. This also means that the first 13 bits of your AU header is your AU data length in bytes.
If you want to find your first AU data unit, do the following with your RTP packet (just one of the solution off my mind)
1. Read in first 2 bytes to find out the number of bits that represent the AU headers length. For example, it is 32 bits
2. Base on point 1, figure out the number of AU headers. For example, since each AU header is 2 bytes, 32 bits / (2 * 8) = 2. That is 2 AU unit
3. Then, from your first AU header 13 bits, you can figure out the length of the AU data.
4. Then, extract your first AU data by RTP length - AU header length (2 bytes) - N Au header size (depend on the number of AU headers your have). That will give you the offset of your first AU data. From this offset to the AU data length at point 3, you should be able to get your AAC data.
VLC support AAC LD if I am not wrong
Thanks, I am depacketizing as you mentioned above. Decoding is succesfull but there is no sound. I am using Fraunhofer library to decode and passing RAW AU frames. it generates no sound.
ReplyDeleteDo i need to add any extra information/header to AU Unit and than pass it to decoder or Raw AU frame ?
VLC does not support AAC, there is ticket opened for it.
http://trac.videolan.org/vlc/ticket/3157
I tried in Mplayer.FAAD decoder.. nothing help . tried hard for AAC LD streamer..
This comment has been removed by the author.
ReplyDeleteHi,
ReplyDeletei have one doubt. I captured packets while audio streaming was done with pc. when i see packets for each and every audio packet RTP header+4-Bytes+frame_payload.
There 4-Bytes is unknown thing for me. Are those 4-Bytes same as AAC_Audio_specific config ??.
thanks in advance...
I'm sorry, but isn't
ReplyDelete1210 = 0000 0100 1011 1010 ?
Then
5 bits = 00000 = null
4 bits = 1001 = 9 = 12000 sampling freq
4 bits = 0111 = 7 = 7 + 1 channels
No. These are hexadecimal values. It's 0x1210 not 1210 (0x4BA).
Delete