RTP Payload Format and File Storage Format for the Adaptive Multi-Rate (AMR) and Adaptive Multi-Rate Wideband (AMR-WB) Audio Codecs
obsoletes
- rfc-3267 — Real-Time Transport Protocol (RTP) Payload Format and File Storage Format for the Adaptive Multi-Rate (AMR) and Adaptive Multi-Rate Wideband (AMR-WB) Audio Codecs
Extracted elements (32)
IP endpoints SHOULD NOT set the CMR field based on packet losses or congestion because (a) the remote end may be a gateway to a non-IP radio network that uses CMR for radio-link optimization, and (b) IP congestion management is the sender's responsibility—feedback via RTCP is the correct mechanism, allowing the sender to choose among codec mode change, FEC reduction, or frame packing.
Only the octet-aligned mode supports robust sorting, interleaving, and per-frame CRC because these features require independently octet-aligned fields. Bandwidth-efficient mode omits these features to minimize overhead, making it preferable for conversational services over constrained links.
The built-in redundant transmission scheme (piggy-backing earlier frame-blocks) provides equivalent functionality to RFC 2198 and is more efficient for spreads up to 5 frames. RFC 2198 is preferred only when the time spread exceeds 5 frames or a non-AMR codec is needed for the redundant encoding.
For GSM interoperability, encoders SHOULD only perform codec mode changes to neighboring modes and in multiples of 40 ms (two frame-blocks), but decoders SHOULD accept mode changes at any time. The mode-change-period and mode-change-capability parameters in SDP signal these constraints.
The Q (frame quality) bit and NO_DATA/SPEECH_LOST frame type indicators are included for interoperability with the ITU-T I.366.2 ATM payload format, the 3GPP UMTS Iu interface, and other non-IP AMR transport formats, enabling damaged frames to be forwarded to the decoder for error concealment rather than dropped.
A given speech frame MUST NOT be encoded as speech in one packet and as comfort noise parameters in another packet.
A receiver MUST be prepared to receive any speech frame multiple times (exact duplicates, different AMR rate modes, or data present vs. absent). If multiple versions of the same speech frame are received, it is RECOMMENDED that the mode with the highest rate be used by the speech decoder.
An application implementing this payload format MUST understand all payload parameters in the out-of-band signaling (e.g., all SDP/media-type parameters defined in this document). To achieve basic interoperability, implementations SHOULD support both bandwidth-efficient and octet-aligned modes.
For a payload with N channels and K speech frame-blocks, there MUST be exactly N*K entries in the ToC; the first N entries are from the first frame-block, the next N from the second, and so on.
If a received CMR value is outside the signaled subset of modes, it MUST be ignored. If receiving a payload with a CMR value that is not a speech mode or NO_DATA, the CMR MUST be ignored by the receiver.
If the receiver finds that the calculated payload length (based on payload type information and payload header field values) does not match the received packet size, the receiver SHOULD discard the packet to avoid severe speech quality degradation.
ILL and ILP fields MUST be present in each packet of a session if interleaving is signaled out-of-band. Interleaving MUST be performed on a frame-block basis, not on a frame basis, in a multi-channel session.
Non-received speech frames or frame-blocks between SID updates during non-speech periods MUST be stored as NO_DATA frames (FT=15) in the storage format. Frames lost in transmission MUST be stored as NO_DATA or SPEECH_LOST frames to maintain synchronization.
The CMR field MUST be set to 15 (no mode request) for all packets sent to a multicast group. The encoder SHOULD ignore codec mode requests when sending to a multicast session but MAY use RTCP feedback as a hint.
The extra comfort noise frame types GSM-EFR CN, IS-641 CN, and PDC-EFR CN (frame types beyond the general AMR SID) MUST NOT be used in this RTP payload format.
The RTP header marker bit (M) SHALL be set to 1 if the first frame-block in the packet contains a speech frame that is the first in a talkspurt; otherwise M SHALL be set to 0.
The single-channel AMR storage file magic number MUST be the ASCII string "#!AMR\n" (0x2321414d520a). The single-channel AMR-WB magic number MUST be "#!AMR-WB\n" (0x2321414d522d57420a). The "\n" MUST be included in the comparison.
When frame CRC is used, the CRC MUST be calculated only over all class A bits in the AMR or AMR-WB frame; class B and C bits MUST NOT be included. If the recalculated CRC mismatches the received value, the receiver SHALL consider class A bits damaged and MUST clear the Q flag (set to 0).
The AMR/AMR-WB RTP payload consists of three parts in order: a payload header (CMR field), a payload table of contents (list of per-frame ToC entries), and speech data. Payloads carrying more than one speech frame-block are called compound payloads.
The robust sorting order interleaves octets of all speech frames at the octet level in a compound payload: the first octet of each frame in turn, then the second octet of each frame, and so on. This concentrates the perceptually most sensitive bits (which appear first within each frame) near the beginning of the packet, enabling UEP/UED coverage with a partial checksum.
The RTP timestamp for AMR increments by 160 samples (8 kHz, 20 ms frame) per frame-block, and by 320 samples (16 kHz, 20 ms frame) per frame-block for AMR-WB. The timestamp corresponds to the first sample of the first frame-block in the packet.
This document registers the 'audio/AMR' media type with IANA. Key parameters include: octet-align, crc, robust-sorting, interleaving, ptime, channels, mode-set, mode-change-period, mode-change-neighbor, mode-change-capability, maxptime, and ptime.
This document registers the 'audio/AMR-WB' media type with IANA. Parameters mirror those of audio/AMR except that mode-set values 0–8 reflect AMR-WB's nine coding modes (6.6–23.85 kbps).
Authentication and integrity of AMR/AMR-WB RTP payloads SHOULD be provided by SRTP. Without authentication, an attacker can inject or modify packets, potentially degrading speech quality or causing denial of service. The CMR field is particularly sensitive as an attacker could force inefficient codec modes.
Confidentiality for AMR/AMR-WB RTP payloads SHOULD be achieved using the Secure Real-time Transport Protocol (SRTP). The payload format itself does not define encryption mechanisms.
Each speech frame in the storage format begins with a 1-octet frame header: P (1 bit, padding/reserved), FT (4 bits, frame type), Q (1 bit, quality), and 2 padding bits. Speech bits follow, octet-aligned, with the last octet zero-padded.
In bandwidth-efficient mode, each ToC entry is 6 bits: F (1 bit, more-frames flag), FT (4 bits, frame type index), Q (1 bit, frame quality indicator). Entries are packed contiguously without octet boundaries.
In bandwidth-efficient mode, the payload header is a single 4-bit CMR (Codec Mode Request) field packed into the most significant bits of the first octet, shared with the first ToC entry bits. The entire payload is octet-aligned by appending 0–7 zero padding bits at the end.
In octet-aligned mode, each ToC entry occupies exactly 1 octet: F (1 bit), FT (4 bits), Q (1 bit), and 2 padding bits (PP) that MUST be set to zero and ignored on reception.
In octet-aligned mode, the payload header is 8 bits: CMR (4 bits) followed by 4 reserved R bits (MUST be zero). If interleaving is signaled, an additional 8-bit interleaving header follows: ILL (4 bits) and ILP (4 bits).
The optional frame CRC in octet-aligned mode is 8 bits per speech frame, calculated only over the class A bits of that frame using cyclic generator polynomial C(x) = 1 + x^2 + x^3 + x^4 + x^8 (binary 101110001). One CRC octet is included for each ToC entry where FT is neither 14 nor 15.
The storage format multi-channel header consists of a magic number ("#!AMR_MC1.0\n" for AMR or "#!AMR-WB_MC1.0\n" for AMR-WB) followed by a 32-bit channel description field whose 4 least-significant bits (CHAN) encode the number of audio channels; all other bits are reserved and MUST be zero.