ADTS: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
m (Cross reference MPEG-4 Audio)
(Add a diagram and use a table)
Line 3: Line 3:
=== Structure ===
=== Structure ===


Header consists of 7 or 9 bytes (with or without CRC).
AAAAAAAA AAAABCCD EEFFFFGH HHIJKLMM MMMMMMMM MMMOOOOO OOOOOOPP (QQQQQQQQ QQQQQQQQ)


* 12 bits of syncword 0xFFF, all bits '''must''' be 1
Header consists of 7 or 9 bytes (without or with CRC).
* 1 bit of field ID. 0 for MPEG-4, 1 for MPEG-2
 
* 2 bits of MPEG layer. If you send AAC in MPEG-TS, set to 0
{|
* 1 bit of protection absense. '''Warning''', set to 1 if there is no CRC and 0 if there is CRC
|-
* 2 bits of profile code. The [[MPEG-4_Audio#Audio_Object_Types|MPEG-4 Audio Object Type]] minus 1
! Letter
* 4 bits of sample rate code. [[MPEG-4_Audio#Sampling_Frequencies |MPEG-4 Sampling Frequency Index]] (15 is not allowed)
! Length (bits)
* 1 bit of private stream. Set to 0
! Description
* 3 bits of channels code. [[MPEG-4_Audio#Channel Configurations|MPEG-4 Channel Configuration]] (in the case of 0, the channel configuration is sent via an inband PCE)
|-
* 1 bit of originality. Set to 0
| A
* 1 bit of home. Set to 0
| 12
* 1 bit of copyrighted stream. Ignore it on read and set to 0
| syncword 0xFFF, all bits '''must''' be 1
* 1 bit of copyright start. Set to 0
|-
* 13 bits of frame length. This value must include 7 or 9 bytes of header length:  FrameLength = (ProtectionAbsent == 1 ? 7 : 9) + size(AACFrame)
| B
* 11 bits of some data. unknown yet
| 1  
* 2 bits of frames count in one packet. Set to 0
| MPEG Version: 0 for MPEG-4, 1 for MPEG-2
* aac frame going.
|-
| C
| 2
| Layer: always 0
|-
| D
| 1
| protection absent, '''Warning''', set to 1 if there is no CRC and 0 if there is CRC
|-
| E
| 2
| profile, the [[MPEG-4_Audio#Audio_Object_Types|MPEG-4 Audio Object Type]] minus 1
|-
| F
| 4
| [[MPEG-4_Audio#Sampling_Frequencies|MPEG-4 Sampling Frequency Index]] (15 is forbidden)
|-
| G
| 1  
| private stream, set to 0 when encoding, ignore when decoding
|-
| H
| 3
| [[MPEG-4_Audio#Channel Configurations|MPEG-4 Channel Configuration]] (in the case of 0, the channel configuration is sent via an inband PCE)
|-
| I
| 1  
| originality, set to 0 when encoding, ignore when decoding
|-
| J
| 1
| home, set to 0 when encoding, ignore when decoding
|-
| K
| 1
| copyrighted stream, set to 0 when encoding, ignore when decoding
|-
| L
| 1
| copyright start, set to 0 when encoding, ignore when decoding
|-
| M
| 13
| frame length, this value must include 7 or 9 bytes of header length:  FrameLength = (ProtectionAbsent == 1 ? 7 : 9) + size(AACFrame)
|-
| O
| 11
| Buffer fullness
|-
| P
| 2
| Number of AAC frames (RDBs) in ADTS frame '''minus 1''', for maximum compatibility always use 1 AAC frame per ADTS frame
|-
| Q
| 16
| CRC if ''protection absent'' is 0
|}


=== Usage in MPEG-TS ===
=== Usage in MPEG-TS ===

Revision as of 14:44, 9 July 2011

Audio Data Transport Stream (ADTS) is a format, used by MPEG TS or Shoutcast to stream audio, usually AAC.

Structure

AAAAAAAA AAAABCCD EEFFFFGH HHIJKLMM MMMMMMMM MMMOOOOO OOOOOOPP (QQQQQQQQ QQQQQQQQ)

Header consists of 7 or 9 bytes (without or with CRC).

Letter Length (bits) Description
A 12 syncword 0xFFF, all bits must be 1
B 1 MPEG Version: 0 for MPEG-4, 1 for MPEG-2
C 2 Layer: always 0
D 1 protection absent, Warning, set to 1 if there is no CRC and 0 if there is CRC
E 2 profile, the MPEG-4 Audio Object Type minus 1
F 4 MPEG-4 Sampling Frequency Index (15 is forbidden)
G 1 private stream, set to 0 when encoding, ignore when decoding
H 3 MPEG-4 Channel Configuration (in the case of 0, the channel configuration is sent via an inband PCE)
I 1 originality, set to 0 when encoding, ignore when decoding
J 1 home, set to 0 when encoding, ignore when decoding
K 1 copyrighted stream, set to 0 when encoding, ignore when decoding
L 1 copyright start, set to 0 when encoding, ignore when decoding
M 13 frame length, this value must include 7 or 9 bytes of header length: FrameLength = (ProtectionAbsent == 1 ? 7 : 9) + size(AACFrame)
O 11 Buffer fullness
P 2 Number of AAC frames (RDBs) in ADTS frame minus 1, for maximum compatibility always use 1 AAC frame per ADTS frame
Q 16 CRC if protection absent is 0

Usage in MPEG-TS

ADTS packet must be a content of PES packet. Pack AAC data inside ADTS frame, than pack inside PES packet, then mux by TS packetizer.

Usage in Shoutcast

ADTS frames goes one by one in TCP stream. Look for syncword, parse header and look for next syncword after.