RTP Payload Format for 3rd Generation Partnership Project (3GPP) Timed Text
Extracted elements (30)
Character count and character offset fields were deliberately omitted from fragment headers. The working group consensus was that partial error correction (displaying '#' for lost characters with exact count) is not worth the cost of two additional fields given that full error correction via FEC, retransmission, or repetition is preferred for captioning/subtitle applications.
Header fields were reduced from 32-bit to narrower widths (8-bit SIDX, 24-bit SDUR, 16-bit SLEN/LEN) to minimize payload overhead for the low-bitrate mobile streaming use case. Extension mechanisms (SIDX wraparound, sample splitting for long SDUR) compensate for the reduced maximum values.
The LEN field is included in the common header primarily to ease interoperability with RFC 3640, which requires an Access Unit length indication. For standalone RTP use, UDP already provides length information, so LEN is redundant but retained for interoperability.
TOTAL/THIS fragment indexing is used instead of a byte or character offset. A byte offset would consume an extra byte and would not convey character offset for variable-width UTF-8/UTF-16 strings. Using LEN and SLEN alone would not specify fragment order, which is needed when packets are repeated.
RFC 2793 (RTP Payload for Text Conversation) addresses a different use case (real-time text conversation) and is not a replacement for this format. Both formats may coexist in a session; this document notes the distinction to prevent confusion.
This payload format is designed to interoperate with RFC 3640 (RTP Payload Format for Transport of MPEG-4 Elementary Streams). The unit structure (common header + TYPE-specific header + payload) maps directly to RFC 3640 Access Units, enabling shared transport infrastructure for MPEG-4 and 3GPP timed text.
A default timestamp clockrate of 1000 Hz is RECOMMENDED for live streaming. Other clockrates MAY be used, in which case the typical behavior is to match the timed text clockrate to an associated audio or video stream.
Aggregate payloads MUST conform to one of three ordered configurations: (1) TYPE 5 units then TYPE 1 units; (2) TYPE 5 units then at most one TYPE 3 or TYPE 4 unit; (3) TYPE 5 units, at most one TYPE 2, at most one TYPE 3, both from the same sample. Other aggregations SHALL NOT be used.
Congestion control MUST be applied for timed text streams. Senders MUST react to signs of congestion by reducing the transmission rate, following RFC 2914. The use of UDP for RTP timed text does not exempt senders from this requirement.
In an aggregate payload, TYPE 1 units MUST be placed in play-out order (earliest first). The timestamp of each subsequent TYPE 1 unit MUST be obtained by adding the preceding unit's SDUR to its timestamp. TYPE 5 unit timestamps reflect when the description becomes available, not play-out time.
SDUR=0 is reserved to signal unknown duration. Text samples of unknown duration SHALL be displayed until the next text sample becomes active. Upon storing such a sample in a 3GP file, SDUR MUST be replaced with the effective duration, which MUST be greater than zero.
Static sample descriptions MUST be buffered at the client for at least the duration of the session. If dynamic sample descriptions are used, their buffering and SIDX value updates MUST follow the sliding-window wraparound algorithm in Section 4.2.1.
Static SIDX values MUST fall in the closed interval [129,254] and MUST be sent out-of-band; they remain active for the whole session. Dynamic SIDX values MUST fall in [0,127] and are sent in-band. SIDX values 128 and 255 are reserved.
Text strings MUST be split at character boundaries when fragmented, so that individual fragments are displayable. Sample descriptions SHALL NOT be fragmented because they may be referenced by multiple text samples.
The reserved R field MUST be set to zero by senders and MUST be ignored by receivers. Units with LEN values that do not comply with the per-TYPE minimums MUST be discarded, though remaining units in the payload remain valid.
The RTP marker bit SHALL be set to 1 if the packet includes one or more whole text samples or the last fragment of a text sample; otherwise it is set to zero.
The RTP timestamp MUST indicate the sampling instant of the earliest (or only) unit in the packet. The initial value SHOULD be randomly determined as specified in RTP. Timestamp clockrates MUST be signaled out-of-band at session setup.
UTF-16 text strings transported by this payload format MUST be serialized in big endian (network byte) order. Little endian serialization is explicitly not supported. Senders MUST set the U bit to zero in TYPE 3, TYPE 4, and TYPE 5 headers.
When reassembling a fragmented UTF-16 text sample, the receiver MUST prepend the Byte Order Mark (0xFEFF, big endian) to the reassembled string before passing it to the timed text decoder, because the BOM is not transported in RTP payloads.
Five unit types are defined: TYPE 1 (whole text sample), TYPE 2 (text string fragment), TYPE 3 (whole modifiers or first modifier fragment), TYPE 4 (subsequent modifier fragment), TYPE 5 (sample description). TYPE values 0, 6, and 7 are reserved for future extensions. Receivers SHALL ignore unrecognized TYPE values without invalidating timestamp calculation.
Resilient transport mechanisms supported include: redundant transmission (sending the same sample in multiple consecutive packets), retransmission per RFC 4588, and forward error correction per RFC 2733. Senders SHOULD send multiple copies of sample descriptions (TYPE 5) because they may be referenced by multiple subsequent samples and loss is not recoverable without retransmission.
The SLEN field (16 bits) in TYPE 2 units specifies the total byte size of the original text sample (text string plus modifiers, excluding BOM and text string byte count). Receivers MAY use SLEN to pre-allocate buffer space for remaining fragments.
TOTAL (4 bits) and THIS (4 bits) fields in TYPE 2, 3, and 4 units indicate the total fragment count and the current fragment index respectively. If THIS > TOTAL or TOTAL = 0, the fragment SHALL be discarded. For TYPE 3 units carrying the last modifier fragment, TOTAL MUST equal THIS and MUST be greater than one.
RTP packets carrying 3GPP timed text are subject to the general RTP security considerations. Implementors SHOULD use SRTP to provide confidentiality, integrity, and authentication. Timed text content with hyperlinks or scripts could be used to exploit receiving applications if not properly sanitized.
The dynamic SIDX wraparound mechanism uses a sliding window of 64 active values out of 128. When a sample description with a new SIDX=Z in the inactive half arrives, X is set to Z, the window shifts to mark [X+1, X+64] inactive and [X+65, X] active. Active descriptions SHALL NOT be overwritten; redundant copies are silently discarded.
The common payload header is 3 bytes: U (1 bit, UTF flag), R (4 bits, reserved), TYPE (3 bits, unit type), and LEN (16 bits, length of this header plus all following fields excluding the initial U/R/TYPE byte). All fields follow network byte order.
The TYPE 1 header carries a whole text sample and adds SIDX (8 bits, sample description index), SDUR (24 bits, sample duration in RTP timestamp units), and TLEN (16 bits, text string byte count) after the common header. LEN MUST always be >= 8.
The TYPE 2 header carries a text string fragment and adds TOTAL (4 bits) and THIS (4 bits) fragment counters, SDUR (24 bits), SIDX (8 bits), and SLEN (16 bits, original whole text sample size). LEN MUST always be > 9.
The TYPE 5 header carries a sample description in-band and contains only SIDX (8 bits) after the common header. LEN MUST be > 3. The SIDX value MUST be in the dynamic range [0,127].
TYPE 3 and TYPE 4 headers carry modifier (decoration) fragments. Both contain TOTAL (4 bits), THIS (4 bits), and SDUR (24 bits) after the common header; neither includes SLEN or SIDX. LEN MUST be > 6 for both types.