RFC 4749
RTP Payload Format for the G.729.1 Audio Codec
RFC 4749: RTP Payload Format for the G.729.1 Audio Codec ๐
okay bestie, here's the deets ๐ this doc is RFC 4749, written by A. Sollaud from France Telecom and dated October 2006. It's a Standards Track doc, so it's an actual internet standard and not just a suggestion ๐ It doesn't obsolete or update anything (nothing is listed in its title block), so it's a brand new thing ๐ธ
Status of This Memo ๐
This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice ยฉ
Copyright (C) The Internet Society (2006).
Abstract โจ
this doc describes a Real-time Transport Protocol (RTP) payload format for the International Telecommunication Union (ITU-T) G.729.1 audio codec ๐ง it also includes a media type registration for this payload format.
Table of Contents ๐๏ธ
1. Introduction ....................................................2
2. Background ......................................................2
3. Embedded Bit Rates Considerations ...............................3
4. RTP Header Usage ................................................3
5. Payload Format ..................................................4
5.1. Payload Structure ..........................................4
5.2. Payload Header: MBS Field ..................................4
5.3. Payload Header: FT Field ...................................6
5.4. Audio Data .................................................6
6. Payload Format Parameters .......................................7
6.1. Media Type Registration ....................................7
6.2. Mapping to SDP Parameters ..................................8
6.2.1. Offer-Answer Model Considerations ...................9
6.2.2. Declarative SDP Considerations .....................11
7. Congestion Control .............................................11
8. Security Considerations ........................................11
9. IANA Considerations ............................................12
10. References ....................................................12
10.1. Normative References .....................................12
10.2. Informative References ...................................12
1. Introduction ๐ฆ
okay so the ITU-T recommendation G.729.1 [1] is a scalable and wideband extension of the G.729 [9] audio codec ๐ this doc lays out the payload format for packing G.729.1 encoded audio signals into the Real-time Transport Protocol (RTP).
the payload format itself lives in Section 5 ๐ the media type registration and the details for using G.729.1 with SDP are in Section 6.
the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be read as described in RFC 2119 [2] ๐
2. Background ๐ธ
G.729.1 is an 8-32 kbps scalable wideband (50-7000 Hz) speech and audio coding algorithm that's interoperable with G.729, G.729 Annex A, and G.729 Annex B ๐ง it gives you a standardized way to do packetized voice, so you can move smoothly from narrowband to wideband telephony. it's giving smooth glow-up energy โจ
the biggest uses are IP telephony and videoconferencing, whether that's for enterprise corporate networks or the mass market (like Public Switched Telephone Network (PSTN) emulation over DSL or wireless access) ๐ the devices that can use it include IP phones or other VoIP handsets, home gateways, media gateways, IP Private Branch Exchange (IPBX), trunking equipment, voice messaging servers, etc. ๐
the scalability feature is the star here ๐ it lets you tune the bit rate versus quality trade-off, and it can even happen dynamically during a session, based on service requirements and network transport constraints. main character energy ๐
the G.729.1 coder makes an embedded bitstream with 12 layers, matching 12 available bit rates between 8 and 32 kbps ๐ซถ the first layer, at 8 kbps, is called the core layer and it's bitstream compatible with the ITU-T G.729/G.729A coder. at 12 kbps, a second layer improves the narrowband quality. the upper layers give you wideband audio (50-7000 Hz) between 14 and 32 kbps, in 2 kbps steps, so quality can improve gracefully ๐ only the core layer is mandatory to decode understandable speech, and the upper layers are there for quality enhancement and wideband enlargement ๐ฅ
the codec works on 20-ms frames, and the default sampling rate is 16 kHz ๐ถ input and output at 8 kHz are also supported, at all bit rates.
3. Embedded Bit Rates Considerations ๐ฆ
the embedded property of G.729.1 streams is what lets you adjust the bandwidth demand ๐ at any time, a sender can change its sending bit rate without any external signalling, and the receiver will still be able to properly decode the frames. this can help control congestion, since you can adjust the bandwidth just by picking another bit rate ๐ซง
it's also handy when you've got a fixed bandwidth link dedicated to voice calls, like in a residential or trunking gateway ๐ in that case, the system can change the bit rates depending on how many calls are happening at once. this only affects the sending bandwidth, though ๐ to adjust the receiving bandwidth as well, there's an in-band signalling method to ask the other party to change its own sending bit rate. this in-band request is called MBS, for Maximum Bit rate Supported, and it's described in Section 5.2 ๐
ngl there's a catch: this is only useful for two-way unicast G.729.1 traffic ๐ญ when A sends an in-band MBS to B to ask B to change its sending bit rate, it's affecting the stream from B to A. if there's no G.729.1 stream in the reverse direction, the MBS won't do anything at all ๐
4. RTP Header Usage ๐
the format of the RTP header is specified in RFC 3550 [3] ๐ฆ this payload format uses the header fields in a way that's consistent with that spec ๐ซถ
the RTP timestamp clock frequency is the same as the default sampling frequency, which is 16 kHz โฐ
G.729.1 can also operate with 8 kHz sampled input/output signals at all bit rates ๐ง this doesn't affect the bitstream, and the decoder doesn't need to know ahead of time what the sampling rate of the original signal was at the encoder's input ๐ so depending on the implementation and the audio capabilities of the devices, the encoder's input and/or the decoder's output can be set to 8 kHz. however, a 16 kHz RTP clock rate MUST always be used ๐
one frame lasts 20 ms, which is 320 samples at 16 kHz, so the timestamp goes up by 320 for each consecutive frame โณ
the M bit MUST be set to zero in all packets ๐ซ
assigning an RTP payload type for this packet format is outside the scope of this document, so it won't be specified here ๐คทโโ๏ธ it's expected that the RTP profile this payload format is used under will either assign a payload type for this codec, or specify that the payload type gets bound dynamically (see Section 6.2) ๐ฆ
5. Payload Format ๐
5.1. Payload Structure ๐งฉ
the full payload is made of a 1-octet payload header, followed by zero or more consecutive audio frames at the same bit rate ๐ฐ
the payload header has two fields: MBS (see Section 5.2) and FT (see Section 5.3) ๐
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| MBS | FT | |
+-+-+-+-+-+-+-+-+ +
: zero or more frames at the same bit rate :
: :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
5.2. Payload Header: MBS Field ๐ซง
MBS (4 bits): maximum bit rate supported. it tells the encoder, at the receiver's site, the max bit rate it can use for this payload. the MBS field value is set using this table:
+-------+--------------+
| MBS | max bit rate |
+-------+--------------+
| 0 | 8 kbps |
| 1 | 12 kbps |
| 2 | 14 kbps |
| 3 | 16 kbps |
| 4 | 18 kbps |
| 5 | 20 kbps |
| 6 | 22 kbps |
| 7 | 24 kbps |
| 8 | 26 kbps |
| 9 | 28 kbps |
| 10 | 30 kbps |
| 11 | 32 kbps |
| 12-14 | (reserved) |
| 15 | NO_MBS |
+-------+--------------+
the MBS is how you tell the other party the max bit rate you can receive ๐ฅ the encoder MUST NOT exceed the sending rate indicated by the received MBS ๐ฆ because the coding scheme is embedded, the encoder can send frames at the MBS rate or any lower rate ๐ as long as it stays under the MBS, the encoder can switch its bit rate at any time with no heads-up ๐จ
the MBS is a codec bit rate, so the actual network bit rate is higher, depending on the overhead of the underlying protocols ๐ฆ
the MBS you received stays valid until the next MBS arrives. a newly received MBS value overrides the previous one ๐
if a payload with a reserved MBS value comes in, the MBS MUST be ignored ๐ โโ๏ธ
the MBS field MUST be set to 15 for packets sent to a multicast group, and it MUST be ignored on packets received from a multicast group ๐ก
the MBS field MUST be set to 15 in all packets when the actual MBS value is sent through non-RTP means. that's out of scope for this spec ๐ง
check Sections 3 and 7 for more on how MBS is used for congestion control ๐ซถ
this is the end of part 1, so stay tuned for the next drop bestie ๐โจ
5.3. Payload Header: FT Field
Okay so the FT field is 4 bits, and it tells you the frame type of the frame(s) in this packet ๐ Here's the whole lineup, bestie:
+-------+---------------+------------+
| FT | encoding rate | frame size |
+-------+---------------+------------+
| 0 | 8 kbps | 20 octets |
| 1 | 12 kbps | 30 octets |
| 2 | 14 kbps | 35 octets |
| 3 | 16 kbps | 40 octets |
| 4 | 18 kbps | 45 octets |
| 5 | 20 kbps | 50 octets |
| 6 | 22 kbps | 55 octets |
| 7 | 24 kbps | 60 octets |
| 8 | 26 kbps | 65 octets |
| 9 | 28 kbps | 70 octets |
| 10 | 30 kbps | 75 octets |
| 11 | 32 kbps | 80 octets |
| 12-14 | (reserved) | |
| 15 | NO_DATA | 0 |
+-------+---------------+------------+
FT value 15 (NO_DATA) means there's no audio data in the payload ๐ฆ This MAY be used to update the MBS value when there's no audio frame to send ๐ The payload then gets reduced to just the payload header, so it's giving minimal ๐ง
๐จ If a payload with a reserved FT value shows up, the whole payload MUST be ignored. No exceptions, periodt ๐
5.4. Audio Data
Okay so audio data in a payload holds one or more consecutive audio frames, all at the same bit rate ๐ธ The frames are packed in order of time, oldest first โฐ ngl it's very organized ๐
The size of one frame comes from the FT field (see the table in Section 5.3), and you can totally work out how many frames there are from the size of the audio data part ๐งฎ
nb_frames = (size_of_audio_data) / (size_of_one_frame).
Only full frames count โจ So if the division leaves a remainder, the leftover bytes in the received payload MUST be ignored ๐
Note that if FT=15, there's no audio frame in the payload at all ๐ซถ
6. Payload Format Parameters
This section defines the parameters that may be used to configure optional features in the G.729.1 RTP transmission โจ These are the knobs you can turn, bestie ๐๏ธ
The parameters are defined here as part of the media subtype registration for the G.729.1 codec ๐ There's also a mapping into the Session Description Protocol (SDP) [5] for apps that use SDP ๐ For control protocols that don't use MIME or SDP, the media type parameters have to be mapped to whatever format that control protocol uses ๐
6.1. Media Type Registration
This registration uses the template defined in RFC 4288 [6] and follows RFC 3555 [7] ๐
Type name: audio
Subtype name: G7291
Required parameters: none
Optional parameters:
maxbitrate: the absolute maximum codec bit rate for the session, in bits per second ๐ฅ Permissible values are 8000, 12000, 14000, 16000, 18000, 20000, 22000, 24000, 26000, 28000, 30000, and 32000. 32000 is implied if this parameter is omitted. The maxbitrate restricts the range of bit rates that can be used. The bit rates indicated by FT and MBS fields in the RTP packets MUST NOT exceed maxbitrate.
mbs: the current maximum codec bit rate supported as a receiver, in bits per second ๐ฆ Permissible values are in the same set as for the maxbitrate parameter, with the constraint that mbs MUST be lower or equal to maxbitrate. If the mbs parameter is omitted, it's set to the maxbitrate value. So if both mbs and maxbitrate are omitted, they're both set to 32000. The mbs parameter corresponds to an MBS value in the RTP packets as per the table in Section 5.2 of RFC 4749. Note that this parameter may be dynamically updated by the MBS field of the RTP packets sent; it is not an absolute value for the session ๐ธ
ptime: the recommended length of time (in milliseconds) represented by the media in a packet. See Section 6 of RFC 4566 [5].
maxptime: the maximum length of time (in milliseconds) that can be encapsulated in a packet. See Section 6 of RFC 4566 [5]
Encoding considerations: This media type is framed and contains binary data; see Section 4.8 of RFC 4288 [6].
Security considerations: See Section 8 of RFC 4749
Interoperability considerations: none
Published specification: RFC 4749
Applications which use this media type: Audio and video conferencing tools ๐
Additional information: none
Person & email address to contact for further information: Aurelien Sollaud, aurelien.sollaud@orange-ftgroup.com
Intended usage: COMMON
Restrictions on usage: This media type depends on RTP framing, and hence is only defined for transfer via RTP [3].
Author: Aurelien Sollaud
Change controller: IETF Audio/Video Transport working group delegated from the IESG ๐
6.2. Mapping to SDP Parameters
The information carried in the media type specification has a specific mapping to fields in the Session Description Protocol (SDP) [5], which is commonly used to describe RTP sessions ๐ When SDP is used to specify sessions employing the G.729.1 codec, the mapping goes like this:
- The media type ("audio") goes in SDP "m=" as the media name.
- The media subtype ("G7291") goes in SDP "a=rtpmap" as the encoding name. The RTP clock rate in "a=rtpmap" MUST be 16000 for G.729.1 โฑ๏ธ
- The parameters "ptime" and "maxptime" go in the SDP "a=ptime" and "a=maxptime" attributes, respectively.
- Any remaining parameters go in the SDP "a=fmtp" attribute, copied directly from the media type string as a semicolon separated list of parameter=value pairs.
Some example SDP session descriptions using G.729.1 encodings follow ๐ง
Example 1: default parameters
m=audio 53146 RTP/AVP 98
a=rtpmap:98 G7291/16000
Example 2: recommended packet duration of 40 ms (=2 frames), maximum bit rate is 12 kbps, and initial MBS set to 8 kbps. It could be a loaded PSTN gateway that can operate at 12 kbps but asks to initially reduce the bit rate to 8 kbps ๐
m=audio 51258 RTP/AVP 99
a=rtpmap:99 G7291/16000
a=fmtp:99 maxbitrate=12000; mbs=8000
a=ptime:40
6.2.1. Offer-Answer Model Considerations
The following considerations apply when using SDP offer-answer procedures [8] to negotiate the use of G.729.1 payload in RTP ๐ค
- Since G.729.1 is an extension of G.729, the offerer SHOULD announce G.729 support in its "m=audio" line, with G.729.1 preferred. This will allow interoperability with both G.729.1 and G.729-only capable parties ๐ซถ
Below is an example of such an offer:
m=audio 55954 RTP/AVP 98 18
a=rtpmap:98 G7291/16000
a=rtpmap:18 G729/8000
If the answerer supports G.729.1, it keeps payload type 98 in its answer, and the conversation is done using G.729.1 โจ Else, if the answerer supports only G.729, it leaves only payload type 18 in its answer, and the conversation is done using G.729 (the payload format for G.729 is defined in Section 4.5.6 of RFC 3551 [4]).
Note that when used at 8 kbps in G.729-compatible mode, the G.729.1 decoder supports G.729 Annex B. Therefore, Annex B can be advertised (by default, annexb=yes for G729 media type; see Section 4.1.9 of RFC 3555 [7]) ๐ธ
- The "maxbitrate" parameter is bi-directional. If the offerer sets a maxbitrate value, the answerer MUST reply with a smaller or equal value. The actual maximum bit rate for the session will be the minimum ๐
- If the received value for "maxbitrate" is between 8000 and 32000 but not in the permissible values set, it SHOULD be read as the closest lower valid value. If the received value is lower than 8000 or greater than 32000, the session MUST be rejected ๐ซ
- The "mbs" parameter is not symmetric. Values in the offer and the answer are independent and take into account local constraints. One party MUST NOT start sending frames at a bit rate higher than the "mbs" of the other party. The parameter lets you announce this value before any packet is sent, so the remote sender can't exceed the MBS at the beginning of the session ๐ง
- If the received value for "mbs" is greater or equal to 8000 but not in the permissible values set, it SHOULD be read as the closest lower valid value. If the received value is lower than 8000, the session MUST be rejected ๐
- The parameters "ptime" and "maxptime" will in most cases not affect interoperability. The SDP offer-answer handling of the "ptime" parameter is described in RFC 3264 [8]. The "maxptime" parameter MUST be handled in the same way ๐
- Any unknown parameter in an offer MUST be ignored by the receiver and MUST NOT be included in the answer ๐
Some special rules apply for mono-directional traffic:
- For sendonly streams, the "mbs" parameter is useless and SHOULD NOT be used ๐
- For recvonly streams, the "mbs" parameter is the only way to communicate the MBS to the sender, since there's no RTP stream towards it. So to request a bit rate change, the receiver will need to use an out-of-band mechanism, like a SIP RE-INVITE ๐
Some special rules apply for multicast:
- The "mbs" parameter MUST NOT be used.
- The "maxbitrate" parameter becomes declarative and MUST NOT be negotiated. This parameter is fixed, and a participant MUST use the configuration that is provided for the session ๐
6.2.2. Declarative SDP Considerations
For declarative use of SDP, such as in SAP [10] and RTSP [11], the following considerations apply ๐ป
- The "mbs" parameter MUST NOT be used.
- The "maxbitrate" parameter is declarative and provides the parameter that SHALL be used when receiving and/or sending the configured stream ๐
7. Congestion Control
Congestion control for RTP SHALL be used in accordance with RFC 3550 [3] and any appropriate profile (for example, RFC 3551 [4]). The embedded and variable bit rates capability of G.729.1 provides a mechanism that may help to control congestion; see Section 3 for more details ๐ฆ
The number of frames encapsulated in each RTP payload influences the overall bandwidth of the RTP stream, due to the header overhead. Packing more frames into each RTP payload can reduce the number of packets sent and hence the header overhead, at the expense of increased delay and reduced error robustness ๐ธ
8. Security Considerations
๐ This one is serious, bestie, so read carefully ๐
RTP packets using the payload format defined in this specification are subject to the general security considerations discussed in the RTP specification [3] and any appropriate profile (for example, RFC 3551 [4]).
As this format transports encoded speech/audio, the main security issues include confidentiality, integrity protection, and authentication of the speech/audio itself. The payload format itself does not have any built-in security mechanisms. Any suitable external mechanisms, such as SRTP [12], MAY be used ๐
This payload format and the G.729.1 encoding do not exhibit any significant non-uniformity in the receiver-end computational load, and thus are unlikely to pose a denial-of-service threat due to the receipt of pathological datagrams ๐ก๏ธ
9. IANA Considerations
IANA has registered audio/G7291 as a media subtype; see Section 6.1 ๐
10. References
10.1. Normative References ๐
okay bestie, these are the must-have reads if you're actually building this thing ๐โจ the ones you need in your back pocket to implement it right. listing them exactly as they appear so you can track them down ๐
[1] International Telecommunications Union, "G.729 based Embedded
Variable bit-rate coder: An 8-32 kbit/s scalable wideband coder
bitstream interoperable with G.729", ITU-T Recommendation
G.729.1, May 2006.
[2] Bradner, S., "Key words for use in RFCs to Indicate Requirement
Levels", BCP 14, RFC 2119, March 1997.
[3] Schulzrinne, H., Casner, S., Frederick, R., and V. Jacobson,
"RTP: A Transport Protocol for Real-Time Applications", STD 64,
RFC 3550, July 2003.
[4] Schulzrinne, H. and S. Casner, "RTP Profile for Audio and Video
Conferences with Minimal Control", STD 65, RFC 3551, July 2003.
[5] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session
Description Protocol", RFC 4566, July 2006.
[6] Freed, N. and J. Klensin, "Media Type Specifications and
Registration Procedures", BCP 13, RFC 4288, December 2005.
[7] Casner, S. and P. Hoschka, "MIME Type Registration of RTP
Payload Formats", RFC 3555, July 2003.
[8] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model with
Session Description Protocol (SDP)", RFC 3264, June 2002.
10.2. Informative References ๐ธ
and these are the extra-credit reads ๐ง ๐ handy background stuff that isn't required to get the core picture, but it's so worth a peek ๐
[9] International Telecommunications Union, "Coding of speech at 8
kbit/s using conjugate-structure algebraic-code-excited linear-
prediction (CS-ACELP)", ITU-T Recommendation G.729, March 1996.
[10] Handley, M., Perkins, C., and E. Whelan, "Session Announcement
Protocol", RFC 2974, October 2000.
[11] Schulzrinne, H., Rao, A., and R. Lanphier, "Real Time Streaming
Protocol (RTSP)", RFC 2326, April 1998.
[12] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K.
Norrman, "The Secure Real-time Transport Protocol (SRTP)",
RFC 3711, March 2004.
Author's Address ๐ง
here's who wrote it, with contact details as they appear in the original ๐
Aurelien Sollaud
France Telecom
2 avenue Pierre Marzin
Lannion Cedex 22307
France
Phone: +33 2 96 05 15 06
EMail: aurelien.sollaud@orange-ftgroup.com
Full Copyright Statement ๐
this is the legal stuff, so I'm keeping it word-for-word, no edits ๐โ๏ธ
Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors
retain all their rights.
This document and the information contained herein are provided on an
"AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property ๐ฆ
the IETF's IP policy, also kept exact so nothing gets lost in translation ๐ชช
The IETF takes no position regarding the validity or scope of any
Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; nor does it represent that it has
made any independent effort to identify any such rights. Information
on the procedures with respect to rights in RFC documents can be
found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use of
such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF at
ietf-ipr@ietf.org.
Acknowledgement ๐ซถ
and last but not least, the shout-out to the people keeping the lights on ๐
Funding for the RFC Editor function is provided by the IETF
Administrative Support Activity (IASA).
that's the whole doc, bestie! ๐โจ you made it through all three parts ๐
๐ฆ where this page comes from
- ietf: rfc4749 2006-10
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms