Recognizes if input is ogg or not.
[xiph.git] / theora / doc / draft-kerr-avt-theora-rtp-00.txt
blob5126152173e72b1ebea78acc9ff8a860fa0791ca
3 AVT Working Group                                                P. Kerr
4 Internet-Draft                                                  Xiph.Org
5 Expires: August 1, 2005                                 January 31, 2005
8                       draft-kerr-avt-theora-rtp-00
9               RTP Payload Format for Theora Encoded Video
11 Status of this Memo
13    This document is an Internet-Draft and is subject to all provisions
14    of section 3 of RFC 3667.  By submitting this Internet-Draft, each
15    author represents that any applicable patent or other IPR claims of
16    which he or she is aware have been or will be disclosed, and any of
17    which he or she become aware will be disclosed, in accordance with
18    RFC 3668.
20    Internet-Drafts are working documents of the Internet Engineering
21    Task Force (IETF), its areas, and its working groups.  Note that
22    other groups may also distribute working documents as
23    Internet-Drafts.
25    Internet-Drafts are draft documents valid for a maximum of six months
26    and may be updated, replaced, or obsoleted by other documents at any
27    time.  It is inappropriate to use Internet-Drafts as reference
28    material or to cite them other than as "work in progress."
30    The list of current Internet-Drafts can be accessed at
31    http://www.ietf.org/ietf/1id-abstracts.txt.
33    The list of Internet-Draft Shadow Directories can be accessed at
34    http://www.ietf.org/shadow.html.
36    This Internet-Draft will expire on August 1, 2005.
38 Copyright Notice
40    Copyright (C) The Internet Society (2005).
42 Abstract
44    This document describes a RTP payload format for transporting Theora
45    encoded video.  It details the RTP encapsulation mechanism for raw
46    Theora data and configuration headers consisting of the quantization
47    matrices and the Huffman codebooks for the DCT coefficients, and a
48    table of limit values for the deblocking filter.
50    Also included within the document are the necessary details for the
51    use of Theora with MIME and Session Description Protocol (SDP).
55 Kerr                     Expires August 1, 2005                 [Page 1]
57 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
60 Editors Note
62    All references to RFC XXXX are to be replaced by references to the
63    RFC number of this memo, when published.
65 Table of Contents
67    1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
68      1.1   Terminology  . . . . . . . . . . . . . . . . . . . . . . .  3
69    2.  Payload Format . . . . . . . . . . . . . . . . . . . . . . . .  4
70      2.1   RTP Header . . . . . . . . . . . . . . . . . . . . . . . .  4
71      2.2   Payload Header . . . . . . . . . . . . . . . . . . . . . .  5
72      2.3   Payload Data . . . . . . . . . . . . . . . . . . . . . . .  6
73      2.4   Example RTP Packet . . . . . . . . . . . . . . . . . . . .  7
74    3.  Frame Packetizing  . . . . . . . . . . . . . . . . . . . . . .  8
75      3.1   Example Fragmented Theora Packet . . . . . . . . . . . . .  9
76    4.  Packet Loss  . . . . . . . . . . . . . . . . . . . . . . . . . 12
77    5.  Configuration Headers  . . . . . . . . . . . . . . . . . . . . 13
78      5.1   In-band Header Transmission  . . . . . . . . . . . . . . . 13
79        5.1.1   Identification Header  . . . . . . . . . . . . . . . . 13
80        5.1.2   Comment Header . . . . . . . . . . . . . . . . . . . . 15
81        5.1.3   Setup Header . . . . . . . . . . . . . . . . . . . . . 16
82      5.2   Packed Headers Delivery  . . . . . . . . . . . . . . . . . 18
83        5.2.1   Packed Headers IANA Considerations . . . . . . . . . . 21
84      5.3   Setup Header Caching . . . . . . . . . . . . . . . . . . . 22
85      5.4   Loss of Configuration Headers  . . . . . . . . . . . . . . 22
86    6.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 23
87      6.1   Mapping MIME Parameters into SDP . . . . . . . . . . . . . 24
88    7.  Security Considerations  . . . . . . . . . . . . . . . . . . . 25
89    8.  Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 25
90    9.  References . . . . . . . . . . . . . . . . . . . . . . . . . . 25
91    9.1   Normative References . . . . . . . . . . . . . . . . . . . . 25
92    9.2   Informative References . . . . . . . . . . . . . . . . . . . 26
93        Author's Address . . . . . . . . . . . . . . . . . . . . . . . 26
94        Intellectual Property and Copyright Statements . . . . . . . . 27
111 Kerr                     Expires August 1, 2005                 [Page 2]
113 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
116 1.  Introduction
118    Theora is a general purpose, lossy video codec.  It is based on the
119    VP3.1 video codec produced by On2 Technologies and has been donated
120    to the Xiph.org Foundation.
122    Theora I is a block-based lossy transform codec that utilizes an 8 x
123    8 Type-II Discrete Cosine Transform and block-based motion
124    compensation.  This places it in the same class of codecs as MPEG-1,
125    MPEG-2, MPEG-4, and H.263.  The details of how individual blocks are
126    organized and how DCT coefficients are stored in the bitstream differ
127    substantially from these codecs, however.  Theora supports only intra
128    frames (I frames in MPEG) and inter frames (P frames in MPEG).
130    Theora provides none of its own framing, synchronization, or
131    protection against transmission errors.  Theora is a free-form
132    variable bit rate (VBR) codec, and packets have no minimum size,
133    maximum size, or fixed/expected size.  Theora packets are thus
134    intended to be used with a transport mechanism that provides
135    free-form framing, synchronization, positioning, and error correction
136    in accordance with these design assumptions, such as Ogg [1].  or
137    RTP/AVP [3].
139    Theora I currently supports progressive video data of arbitrary
140    dimensions at a constant frame rate in one of several YCbCr color
141    spaces.  Three different chroma subsampling formats are supported:
142    4:2:0, 4:2:2, and 4:4:4.  The Theora I format does not support
143    interlaced material, variable frame rates, bit-depths larger than 8
144    bits per component, nor alternate color spaces such as RGB or
145    arbitrary multi-channel spaces.  Black and white content can be
146    efficiently encoded, however, because the uniform chroma planes
147    compress well.
149    Theora is similar to Vorbis audio [9] in that it requires the
150    inclusion of the entire probability model for the DCT coefficients
151    and all the quantization parameters in the bitstream headers to be
152    sent ahead of the video data.  It is therefore impossible to decode
153    any frame in the stream without having previously fetched the codec
154    info and codec setup headers, although Theora can initiate decode at
155    an arbitrary intra-frame packet within a bitstream so long as the
156    codec has been initialized with the setup headers.
158 1.1  Terminology
160    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
161    "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
162    document are to be interpreted as described in RFC 2119 [2].
167 Kerr                     Expires August 1, 2005                 [Page 3]
169 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
172 2.  Payload Format
174    Each frame of digital video is packetized into one or more RTP
175    packets.  If the data for a complete frame exceeds the network MTU,
176    it SHOULD be fragmented into multiple RTP packets, each smaller than
177    the MTU.  A single RTP packet MAY contain data for more than one
178    Theora frame.
180    For RTP based transportation of Theora encoded video the standard RTP
181    header is followed by a 5 octet payload header, then the payload
182    data.
184 2.1  RTP Header
186    The format of the RTP header is specified in [3] and shown in Figure
187    1.  This payload format uses the fields of the header in a manner
188    consistent with that specification.
190        0                   1                   2                   3
191        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
192       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
193       |V=2|P|X|  CC   |M|     PT      |       sequence number         |
194       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
195       |                           timestamp                           |
196       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
197       |           synchronization source (SSRC) identifier            |
198       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
199       |            contributing source (CSRC) identifiers             |
200       |                              ...                              |
201       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
203                           Figure 1: RTP Header
205    The RTP header begins with an octet of fields (V, P, X, and CC) to
206    support specialized RTP uses (see [3] and [4] for details).  For
207    Theora RTP, the following values are used.
209    Version (V): 2 bits
211    This field identifies the version of RTP.  The version used by this
212    specification is two (2).
214    Padding (P): 1 bit
216    Padding MAY be used with this payload format according to section 5.1
217    of [3].
219    Extension (X): 1 bit
223 Kerr                     Expires August 1, 2005                 [Page 4]
225 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
228    The Extension bit is used in accordance with [3].
230    CSRC count (CC): 4 bits
232    The CSRC count is used in accordance with [3].
234    Marker (M): 1 bit
236    The Marker bit is used in accordance with [3].
238    Payload Type (PT): 7 bits
240    An RTP profile for a class of applications is expected to assign a
241    payload type for this format, or a dynamically allocated payload type
242    SHOULD be chosen which designates the payload as Theora.
244    Sequence number: 16 bits
246    The sequence number increments by one for each RTP data packet sent,
247    and may be used by the receiver to detect packet loss and to restore
248    packet sequence.  This field is detailed further in [3].
250    Timestamp: 32 bits
252    A timestamp representing the sampling time of the first sample of the
253    first Theora packet in the RTP packet.  The clock frequency MUST be
254    set to the sample rate of the encoded video data and is conveyed
255    out-of-band as an SDP attribute.
257    SSRC/CSRC identifiers:
259    These two fields, 32 bits each with one SSRC field and a maximum of
260    16 CSRC fields, are as defined in [3].
262 2.2  Payload Header
264    After the RTP Header section the following five octets are the
265    Payload Header.  This header is split into a number of bitfields
266    detailing the format of the following Payload Data packets.
279 Kerr                     Expires August 1, 2005                 [Page 5]
281 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
284        0                   1                   2                   3
285        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
286       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
287       |                       Setup Header Ident                      |
288       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
289       |C|F|0|0|# pkts.|
290       +-+-+-+-+-+-+-+-+
292                         Figure 2: Payload Header
294    Setup Header Ident: 32 bits
296    This 32 bit field is used to associate the Theora data to a decoding
297    Setup Header.  It is created by making a CRC32 checksum of the Setup
298    Header required to decode the particular Theora video stream.
300    Continuation (C): 1 bit
302    Set to one if this is a continuation of a fragmented packet.
304    Fragmented (F): 1 bit
306    Set to one if the payload contains complete packets or if it contains
307    the last fragment of a fragmented packet.
309    The next two bits are currently reserved and MUST be set to 0.
311    The last 4 bits are the number of complete packets in this payload.
312    This provides for a maximum number of 15 Theora packets in the
313    payload.  If the packet contains fragmented data the number of
314    packets MUST be set to 0.
316 2.3  Payload Data
318    Each Theora payload section starts with a three octet header.  The
319    first octet is used to denote what kind of Theora data follows.  Then
320    a two octet length header is used to represent the size of the
321    following data payload, followed by the raw Theora data.
335 Kerr                     Expires August 1, 2005                 [Page 6]
337 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
340        0                   1                   2                   3
341        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
342       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
343       |   Data type   |        Payload Length         | Theora Data  ..
344       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
346                          Figure 3: Payload Data
348    The data type octet is used to signify the payload data type.  If the
349    first bit is set to 0, this indicates the payload is Theora video
350    data.
352    The following values for the Theora payload type are valid:
354       0 = Raw Theora data
355       0x80 = Theora Identification header
356       0x81 = Theora Comment header
357       0x82 = Theora Setup header
360    The Theora packet length header is the length of the Theora data
361    block only and does not count the length octets and payload data type
362    octet.
364    The Theora codec uses relatively unstructured raw packets containing
365    binary integer fields of arbitrary width that often do not fall on an
366    octet boundary.  When this happens the bitstream is packed to an
367    octet boundary.  When a Theora encoder produces packets unused space
368    in the last byte of a packet is always zeroed during the encoding
369    process.  Thus, should this unused space be read, it will return
370    binary zeros.
372    For payloads which consist of multiple Theora packets the payload
373    data consists of the data type field, the payload length field
374    followed by the payload data for each of the Theora packets in the
375    payload.
377 2.4  Example RTP Packet
379    Here is an example RTP packet containing two Theora packets.
381    RTP Packet Header:
391 Kerr                     Expires August 1, 2005                 [Page 7]
393 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
396        0                   1                   2                   3
397        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
398       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
399       | 2 |0|0|  0    |0|      PT     |       sequence number         |
400       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
401       |                 timestamp (in sample rate units)              |
402       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
403       |          synchronisation source (SSRC) identifier             |
404       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
405       |            contributing source (CSRC) identifiers             |
406       |                              ...                              |
407       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
409                       Figure 4: Example RTP Packet
411    Payload Data:
413        0                   1                   2                   3
414        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
415       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
416       |                       Setup Header Ident                      |
417       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
418       |0|1|0|0| 2 pks |      0x80     |        Payload Length         |
419       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
420       |                         Theora data                          ..
421       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
422       ..    data      |        0      |        Payload Length        ..
423       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
424       ..                        Theora data                           |
425       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
427                 Figure 5: Example Theora Payload Packet
429    The payload portion of the packet starts with the 32 bit Setup Header
430    ident field followed by the 8 bit fragment/count fields.  The F bit
431    is set to 1, indicating that this packet contains whole Theora frame
432    data.  The number of whole Theora data packets is set to 2.
434    Each of the payload blocks starts with a Data type field, for the
435    first payload this is set to 0x80 indicating it is an Identification
436    header and the second payload is set to 0 indicating it is raw Theora
437    data.  Then the two octet length field is followed by the variable
438    length Theora data.
440 3.  Frame Packetizing
442    Each RTP packet contains either one complete Theora packet, one
443    Theora packet fragment, or an integer number of complete Theora
447 Kerr                     Expires August 1, 2005                 [Page 8]
449 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
452    packets (up to a max of 15 packets, since the number of packets is
453    defined by a 4 bit value).
455    Any Theora data packet that is less than path MTU SHOULD be bundled
456    in the RTP packet with as many Theora packets as will fit, up to a
457    maximum of 15.  Path MTU is detailed in [6] and [7].
459    If a Theora packet is larger than 65535 octets it MUST be fragmented.
460    A fragmented packet has a zero in the last four bits of the payload
461    header.  Each fragment after the first will also set the Continued
462    (C) bit to one in the payload header.  The RTP packet containing the
463    last fragment of the Theora packet will have the Fragmented (F) bit
464    set to one.  To maintain the correct sequence for fragmented packet
465    reception the timestamp field of fragmented packets MUST be the same
466    as the first packet sent, with the sequence number incremented as
467    normal for the subsequent RTP packets.
469 3.1  Example Fragmented Theora Packet
471    Here is an example fragmented Theora packet split over three RTP
472    packets.  Each packet contains the standard RTP headers as well as
473    the 5 octet Theora headers.
503 Kerr                     Expires August 1, 2005                 [Page 9]
505 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
508       Packet 1:
510        0                   1                   2                   3
511        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
512       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
513       |V=2|P|X|  CC   |M|     PT      |           1000                |
514       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
515       |                             xxxxx                             |
516       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
517       |           synchronization source (SSRC) identifier            |
518       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
519       |            contributing source (CSRC) identifiers             |
520       |                              ...                              |
521       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
522       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
523       |                       Setup Header Ident                      |
524       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
525       |0|0|0|0|      0|       0       |        Payload Length         |
526       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
527       |                         Theora data                          ..
528       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
530              Figure 6: Example Fragmented Packet (Packet 1)
532    In this packet the initial sequence number is 1000 and the timestamp
533    is xxxxx.  The Continuation (C) bit is set to one, indicating it is
534    not the continuation of a fragmented bit, and the Fragmentation (F)
535    is set to 0 indicating it is a fragmented packet.  The number of
536    packets field is set to 0, and as the payload is raw Theora data the
537    Theora payload type field is set to 0.
559 Kerr                     Expires August 1, 2005                [Page 10]
561 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
564       Packet 2:
566        0                   1                   2                   3
567        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
568       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
569       |V=2|P|X|  CC   |M|     PT      |           1001                |
570       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
571       |                             xxxxx                             |
572       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
573       |           synchronization source (SSRC) identifier            |
574       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
575       |            contributing source (CSRC) identifiers             |
576       |                              ...                              |
577       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
578       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
579       |                       Setup Header Ident                      |
580       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
581       |1|0|0|0|      0|       0       |        Payload Length         |
582       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
583       |                         Theora data                          ..
584       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
586              Figure 7: Example Fragmented Packet (Packet 2)
588    The C bit is set to 1 and the number of packets field is set to 0.
589    For large Theora fragments there can be several of these type of
590    payload packets.  The maximum packet size SHOULD be no greater than
591    the path MTU, including all RTP and payload headers.  The sequence
592    number has been incremented by one but the timestamp field remains
593    the same as the initial packet.
615 Kerr                     Expires August 1, 2005                [Page 11]
617 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
620       Packet 3:
622        0                   1                   2                   3
623        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
624       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
625       |V=2|P|X|  CC   |M|     PT      |           1002                |
626       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
627       |                             xxxxx                             |
628       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
629       |           synchronization source (SSRC) identifier            |
630       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
631       |            contributing source (CSRC) identifiers             |
632       |                              ...                              |
633       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
634       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
635       |                       Setup Header Ident                      |
636       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
637       |1|1|0|0|      0|       0       |        Payload Length         |
638       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
639       |                         Theora data                          ..
640       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
642              Figure 8: Example Fragmented Packet (Packet 3)
644    This is the last Theora fragment packet.  The C and F bits are set
645    and the packet count remains set to 0.  As in the previous packets
646    the timestamp remains set to the first packet in the sequence and the
647    sequence number has been incremented.
649 4.  Packet Loss
651    As there is no error correction within the Theora stream, packet loss
652    will result in a loss of signal.  Packet loss is more of an issue for
653    fragmented Theora packets as the client will have to cope with the
654    handling of the C and F flags.  If we use the fragmented Theora
655    packet example above and the first packet is lost the client SHOULD
656    detect that the next packet has the packet count field set to 0 and
657    the C bit is set and MUST drop it.  The next packet, which is the
658    final fragmented packet, SHOULD be dropped in the same manner, or
659    buffered.  Feedback reports on lost and dropped packets MUST be sent
660    back via RTCP.
662    If a particular multicast session has a large number of participants
663    care must be taken to prevent an RTCP feedback implosion, [8], in the
664    event of packet loss from a large number of participants.
671 Kerr                     Expires August 1, 2005                [Page 12]
673 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
676 5.  Configuration Headers
678    To decode a Theora stream three configuration header blocks are
679    needed.  The first header, the Identification Header, indicates the
680    frame dimensions, quality, blocks used and the version of the Theora
681    encoder used.  The second header, the Comment Header, contains stream
682    metadata and the third header, the Setup Header, details which
683    contains dequantization and Huffman tables.
685    As the RTP stream may change certain configuration data mid-session
686    there are two different methods for delivering this configuration
687    data to a client, in-band and SDP which is detailed below.  SDP
688    delivery is used to set-up an initial state for the client
689    application and in-band is used to change state during the session.
690    The changes may be due to different metadata or Setup Header as well
691    as different bitrates of the stream.
693    Out of the two delivery vectors the use of an SDP attribute to
694    indicate an URI where the configuration and Setup Header data can be
695    obtained is preferred as they can be fetched reliably using TCP.  The
696    in-band Setup Header delivery SHOULD only be used in situations where
697    the link between the client is unidirectional or if the SDP-based
698    information is not available.
700    Synchronizing the configuration and Setup Header to the RTP stream is
701    critical.  The 32 bit Setup Header Ident field is used to indicate
702    when a change in the stream has taken place.  The client application
703    MUST have in advance the correct configuration and Setup Headers and
704    if the client detects a change in the Ident value and does not have
705    this information it MUST NOT decode the raw Theora data.
707 5.1  In-band Header Transmission
709    The three header data blocks are sent in-band with the packet type
710    bits set to match the payload type.  Normally the Setup Header and
711    Identification Header are sent once per session if the stream is an
712    encoding of live video, as typically the encoder state will not
713    change, but the encoder state can change at the boundary of chained
714    Theora video files.  Metadata can be sent at the start as well as any
715    time during the life of the session.  Clients MUST be capable of
716    dealing with periodic re-transmission of the configuration headers.
718 5.1.1  Identification Header
720    The Identification Header is a short header with only a few fields
721    used to declare the stream definitively as Theora and provide
722    detailed information about the format of the fully decoded video
723    data.
727 Kerr                     Expires August 1, 2005                [Page 13]
729 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
732        0                   1                   2                   3
733        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
734       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
735       |V=2|P|X|  CC   |M|     PT      |             xxxx              |
736       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
737       |                             xxxxx                             |
738       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
739       |           synchronization source (SSRC) identifier            |
740       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
741       |            contributing source (CSRC) identifiers             |
742       |                              ...                              |
743       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
744       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
745       |                       Setup Header Ident                      |
746       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
747       |0|1|0|0|      1|     0x80      |        Payload Length         |
748       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
749       |     VMAJ      |     VMIN      |     VREV      |     FMBW      |
750       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
751       |     FMBW      |              FMBH             |     NSBS      |
752       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
753       |                     NSBS                      |               |
754       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
755       |                       NBS                             | NMBS  |
756       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
757       |                       NMBS                            | PICW  |
758       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
759       |              PICW             |             PICH              |
760       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
761       | PICH  |     PICX      |      PICY     |         FRN           |
762       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
763       |                FRN                    |         FRD           |
764       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
765       |                FRD                    |         PARN          |
766       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
767       |         PARN          |               PARD                    |
768       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
769       | PARD  |      CS       |PF |             NOMBR                 |
770       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
771       |   NOMBR   |   QUAL    | KFGSHIFT|
772       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
774                     Figure 9: Identification Header
776    The fields listed above have the following meanings:
783 Kerr                     Expires August 1, 2005                [Page 14]
785 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
788       VMAJ     = The major version number.  8 bits.
789       VMIN     = The minor version number.  8 bits.
790       VREV     = The version revision number.  8 bits.
791       FMBW     = The width of the frame in macro blocks.  16 bits.
792       FMBH     = The height of the frame in macro blocks.  16 bits.
793       NSBS     = The total number of super blocks in a frame.  32 bits.
794       NBS      = The total number of blocks in a frame.  36 bits.
795       NMBS     = The total number of macro blocks in a frame.  32 bits.
796       PICW     = The width of the picture region in pixels.  20 bits.
797       PICH     = The height of the picture region in pixels.  20 bits.
798       PICX     = The X offset of the picture region in pixels.  8 bits.
799       PICY     = The Y offset of the picture region in pixels.  8 bits.
800       FRN      = The frame-rate numerator.  32 bits.
801       FRD      = The frame-rate denominator.  32 bits.
802       PARN     = The pixel aspect-ratio numerator.  24 bits.
803       PARD     = The pixel aspect-ratio denominator.  24 bits.
804       CS       = The color space.  8 bits.
805       PF       = The pixel format.  2 bits.
806       NOMBR    = The nominal bitrate of the stream, in bits per second.
807       24 bits.
808       QUAL     = The quality hint.  6 bits.
809       KFGSHIFT = The amount to shift the key frame number by in the
810       granule position.  5 bits.
813 5.1.2  Comment Header
815    The Theora Comment Header is the second of three header packets that
816    begin a Theora stream.  It is meant for short text comments, not
817    arbitrary metadata; arbitrary metadata belongs in a separate logical
818    stream that provides greater structure and machine parseability.  The
819    comment field is meant to be used much like someone jotting a quick
820    note on the label of a video.  It should be a little information to
821    remember the disc or tape by and explain it to others; a short,
822    to-the-point text note that can be more than a couple words, but
823    isn't going to be more than a short paragraph.
839 Kerr                     Expires August 1, 2005                [Page 15]
841 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
844        0                   1                   2                   3
845        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
846       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
847       |V=2|P|X|  CC   |M|     PT      |             xxxx              |
848       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
849       |                             xxxxx                             |
850       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
851       |           synchronization source (SSRC) identifier            |
852       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
853       |            contributing source (CSRC) identifiers             |
854       |                              ...                              |
855       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
856       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
857       |                       Setup Header Ident                      |
858       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
859       |0|1|0|0|      1|     0x81      |        Payload Length         |
860       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
861       |                    User comments list length                  |
862       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
863       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
864       |                       User comment length                     |
865       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
866       |                          User comment                        ..
867       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
868       ..                         User comment                         |
869       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
872                        Figure 10: Comment Header
874    The format for the data takes the form of a 32 bit field denoting the
875    number of user comments.  Each of the user comments is prefixed by a
876    32 bit length field followed by the comment text encoded in UTF-8.
878 5.1.3  Setup Header
880    The Theora setup header contains the limit values used to drive the
881    loop filter, the base matrices and scale values used to build the
882    dequantization tables, and the Huffman tables used to unpack the DCT
883    tokens.  Because the contents of this header are specific to Theora,
884    no concessions have been made to keep the fields octet-aligned for
885    easy parsing.
895 Kerr                     Expires August 1, 2005                [Page 16]
897 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
900        0                   1                   2                   3
901        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
902       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
903       |V=2|P|X|  CC   |M|     PT      |             xxxx              |
904       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
905       |                             xxxxx                             |
906       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
907       |           synchronization source (SSRC) identifier            |
908       +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
909       |            contributing source (CSRC) identifiers             |
910       |                              ...                              |
911       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
912       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
913       |                       Setup Header Ident                      |
914       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
915       |0|1|0|0|      1|     0x82      |        Payload Length         |
916       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
917       |                      Setup Header Length                      |
918       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
919       |                         Setup Header                         ..
920       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
921       ..                        Setup Header                          |
922       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
924                         Figure 11: Setup Header
927 5.1.3.1  Setup Header CRC32 Generation
929    In order for different implementations of Theora RTP clients and
930    servers to interoperate with each other a common format for the
931    production of the CRC32 hash is required.  The polynomial is
932    X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0.
934    The following C code function SHOULD be used by implementations, if
935    not then the code responsible for generating the CRC32 value MUST use
936    the polynomial function above.
938    unsigned int crc32 (int length, unsigned char *crcdata)
939    {
940        int index, loop;
941        unsigned int byte, crc, mask;
943        index = 0;
944        crc = 0xFFFFFFFF;
946        while (index < length) {
947            byte = crcdata [index];
951 Kerr                     Expires August 1, 2005                [Page 17]
953 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
956            crc = crc ^ byte;
958            for (loop = 7; loop >= 0; loop--) {
959                mask = -(crc & 1);
960                crc = (crc >> 1) ^ (0xEDB88320 & mask);
961            }
962            index++;
963        }
964        return ~crc;
965    }
968 5.2  Packed Headers Delivery
970    As mentioned above the RECOMMENDED delivery vector for Theora
971    configuration data is via an SDP attribute as this retrieval method
972    can be performed using a reliable transport protocol.
974       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
975       |                     Number of packed headers                  |
976       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
977       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
978       |                          Packed header                        |
979       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
980       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
981       |                          Packed header                        |
982       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
984                    Figure 12: Packed Headers Overview
986    As the RTP headers are not required for this method of delivery the
987    structure of the configuration data is slightly different.  The
988    packed header starts with a 32 bit count field which details the
989    number of packed headers that are contained in the bundle.  Next is
990    the packed header payload for each chained Theora file.
1007 Kerr                     Expires August 1, 2005                [Page 18]
1009 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1012        0                   1                   2                   3
1013        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
1014       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1015       |                         Header Length                         |
1016       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1017       |                       Setup Header Ident                      |
1018       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1019       |                     Identification Header                    ..
1020       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1021       ..                    Identification Header                     |
1022       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1023       |                         Comment Header                       ..
1024       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1025       ..                        Comment Header                        |
1026       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1027       |                          Setup Header                        ..
1028       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1029       ..                         Setup Header                         |
1030       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1032                     Figure 13: Packed Headers Detail
1034    The key difference between the in-band format is there is no need for
1035    the payload header octet and Setup Header Ident field.  Below are
1036    examples of the packed headers format.
1063 Kerr                     Expires August 1, 2005                [Page 19]
1065 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1068        0                   1                   2                   3
1069        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
1070       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1071       |     VMAJ      |     VMIN      |     VREV      |     FMBW      |
1072       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1073       |     FMBW      |              FMBH             |     NSBS      |
1074       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1075       |                     NSBS                      |               |
1076       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1077       |                       NBS                             | NMBS  |
1078       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1079       |                       NMBS                            | PICW  |
1080       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1081       |              PICW             |             PICH              |
1082       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1083       | PICH  |     PICX      |      PICY     |         FRN           |
1084       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1085       |                FRN                    |         FRD           |
1086       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1087       |                FRD                    |         PARN          |
1088       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1089       |         PARN          |               PARD                    |
1090       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1091       | PARD  |      CS       |PF |             NOMBR                 |
1092       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1093       |   NOMBR   |   QUAL    | KFGSHIFT|
1094       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1096                 Figure 14: Packed Identification Header
1098    The alignment of the packed Identification Header is slightly
1099    different from the RTP payload type as the payload header is not
1100    used.
1119 Kerr                     Expires August 1, 2005                [Page 20]
1121 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1124        0                   1                   2                   3
1125        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
1126       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1127       |                    User comments list length                  |
1128       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1129       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1130       |                       User comment length                     |
1131       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1132       |                          User comment                        ..
1133       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1134       ..                         User comment                         |
1135       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1137                     Figure 15: Packed Comment Header
1139    The packed Comment Header also as a slightly different structure to
1140    that of the RTP payload type with the payload header not being used.
1142        0                   1                   2                   3
1143        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
1144       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1145       |                      Setup Header Length                      |
1146       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1147       |                         Setup Header                         ..
1148       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1149       ..                        Setup Header                          |
1150       +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1152                      Figure 16: Packed Setup Header
1154    The packed Setup Header also has a slightly different structure to
1155    that of the RTP payload type.  The Setup Header Ident field that is
1156    normally part of this structure is moved to the second field of the
1157    overall packed structure.
1159 5.2.1  Packed Headers IANA Considerations
1161    The following IANA considerations MUST only be applied to the packed
1162    headers.
1164    MIME media type name: video
1166    MIME subtype: theora-config
1168    Required Parameters:
1170    None.
1175 Kerr                     Expires August 1, 2005                [Page 21]
1177 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1180    Optional Parameters:
1182    None.
1184    Encoding considerations:
1186    This type is only defined for transfer via HTTP as specified in RFC
1187    XXXX.
1189    Security Considerations:
1191    See Section 6 of RFC 3047.
1193    Interoperability considerations: none
1195    Published specification:
1197    See RFC XXXX for details.
1199    Applications which use this media type:
1201    Theora encoded video, configuration data.
1203    Additional information: none
1205    Person & email address to contact for further information:
1207    Phil Kerr: <phil@plus24.com>
1209    Intended usage: COMMON
1211    Author/Change controller:
1213    Author: Phil Kerr
1215    Change controller: IETF AVT Working Group
1217 5.3  Setup Header Caching
1219    Setup Header caching allows clients that have previously connected to
1220    a stream to re-use the associated Setup Header and configuration
1221    data.  When a client receives a Setup Header it may store it locally
1222    and can compare the CRC32 key with that of the new stream and begin
1223    decoding before it has received any of the headers.
1225 5.4  Loss of Configuration Headers
1227    Unlike the loss of raw Theora payload data, loss of a configuration
1231 Kerr                     Expires August 1, 2005                [Page 22]
1233 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1236    header can lead to a situation where it will not be possible to
1237    successfully decode the stream.
1239    Out of the three headers, loss of either the Setup Header or
1240    Identification Headers MUST result in the halting of stream decoding.
1241    Loss of the Comment header SHOULD NOT be regarded as fatal for
1242    decoding.  Loss of any of the headers SHOULD be reported to the
1243    client as well as a loss report sent via RTCP.
1245 6.  IANA Considerations
1247    MIME media type name: video
1249    MIME subtype: theora
1251    Required Parameters:
1253    sampling: Determines the chroma subsampling format.
1255    width: Determines the number of pixels per line.  This is an integer
1256    between 1 and 1048561 and MUST be in multiples of 16.
1258    height: Determines the number of lines per frame.  This is an integer
1259    between 1 and 1048561 and MUST be in multiples of 16.
1261    header: Indicates the URI of the decoding configuration headers.
1263    Optional Parameters:
1265    None.
1267    Encoding considerations:
1269    This type is only defined for transfer via RTP as specified in RFC
1270    XXXX.
1272    Security Considerations:
1274    See Section 6 of RFC 3047.
1276    Interoperability considerations: none
1278    Published specification:
1280    See the Theora documentation [11] for details.
1282    Applications which use this media type:
1287 Kerr                     Expires August 1, 2005                [Page 23]
1289 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1292    Video streaming and conferencing tools
1294    Additional information: none
1296    Person & email address to contact for further information:
1298    Phil Kerr: <phil@plus24.com>
1300    Intended usage: COMMON
1302    Author/Change controller:
1304    Author: Phil Kerr
1306    Change controller: IETF AVT Working Group
1308 6.1  Mapping MIME Parameters into SDP
1310    The information carried in the MIME media type specification has a
1311    specific mapping to fields in the Session Description Protocol (SDP)
1312    [5], which is commonly used to describe RTP sessions.  When SDP is
1313    used to specify sessions the mapping are as follows:
1315    o  The MIME type ("video") goes in SDP "m=" as the media name.
1317    o  The MIME subtype ("THEORA") goes in SDP "a=rtpmap" as the encoding
1318       name.
1320    o  The parameter "rate" also goes in "a=rtpmap" as clock rate.
1322    o  The parameter "channels" also goes in "a=rtpmap" as channel count.
1324    o  The parameter "header" goes in the SDP "a=fmpt" attribute.
1326    If the stream comprises chained Theora files the configuration and
1327    Setup Headers for each file SHOULD be packaged together and passed to
1328    the client using the headers attribute if all the files to be played
1329    are known in advance.
1331    Example:
1333       c=IN IP4/6
1334       m=video  RTP/AVP 98
1335       a=rtpmap:98 theora/90000
1336       a=fmtp:98 sampling=YCbCr-4:2:2; width=1280; height=720;
1337       header=<URI of configuration header>
1343 Kerr                     Expires August 1, 2005                [Page 24]
1345 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1348 7.  Security Considerations
1350    RTP packets using this payload format are subject to the security
1351    considerations discussed in the RTP specification [3].  This implies
1352    that the confidentiality of the media stream is achieved by using
1353    encryption.  Because the data compression used with this payload
1354    format is applied end-to-end, encryption may be performed on the
1355    compressed data.  Where the size of a data block is set care MUST be
1356    taken to prevent buffer overflows in the client applications.
1358 8.  Acknowledgments
1360    Thanks to the AVT, Ogg Theora Communities / Xiph.org, Fluendo, Ralph
1361    Giles.
1363 9.  References
1365 9.1  Normative References
1367    [1]  Pfeiffer, S., "The Ogg Encapsulation Format Version 0", RFC
1368         3533.
1370    [2]  Bradner, S., "Key words for use in RFCs to Indicate Requirement
1371         Levels", RFC 2119.
1373    [3]  Schulzrinne, H., Casner, S., Frederick, R. and V. Jacobson,
1374         "RTP: A Transport Protocol for real-time applications", RFC
1375         3550.
1377    [4]  Schulzrinne, H. and S. Casner, "RTP Profile for video and Video
1378         Conferences with Minimal Control.", RFC 3551.
1380    [5]  Handley, M. and V. Jacobson, "SDP: Session Description
1381         Protocol", RFC 2327.
1383    [6]  Mogul et al., J., "Path MTU Discovery", RFC 1063.
1385    [7]  McCann et al., J., "Path MTU Discovery for IP version 6", RFC
1386         1981.
1388    [8]  Ott, J., Wenger, S., Sato, N., Burmeister, C. and J. Rey,
1389         "Extended RTP Profile for RTCP-based Feedback (RTP/AVPF)",
1390         Internet Draft (draft-ietf-avt-rtcp-feedback-11: Work in
1391         progress).
1393    [9]  Kerr, P., "RTP Payload Format for Vorbis Encoded Audio -
1394         draft-ietf-avt-vorbis-rtp-00", Internet Draft (Work in
1395         progress).
1399 Kerr                     Expires August 1, 2005                [Page 25]
1401 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1404 9.2  Informative References
1406    [10]  "libTheora: Available from the Xiph website,
1407          http://www.xiph.org".
1409    [11]  "Ogg Theora I spec:  Codec setup and packet decode.
1410          http://www.xiph.org/ogg/Theora/doc/Theora-spec-ref.html".
1413 Author's Address
1415    Phil Kerr
1416    Xiph.Org
1418    EMail: phil@plus24.com
1419    URI:   http://www.xiph.org/
1455 Kerr                     Expires August 1, 2005                [Page 26]
1457 Internet-Draft        draft-kerr-avt-theora-rtp-00          January 2005
1460 Intellectual Property Statement
1462    The IETF takes no position regarding the validity or scope of any
1463    Intellectual Property Rights or other rights that might be claimed to
1464    pertain to the implementation or use of the technology described in
1465    this document or the extent to which any license under such rights
1466    might or might not be available; nor does it represent that it has
1467    made any independent effort to identify any such rights.  Information
1468    on the procedures with respect to rights in RFC documents can be
1469    found in BCP 78 and BCP 79.
1471    Copies of IPR disclosures made to the IETF Secretariat and any
1472    assurances of licenses to be made available, or the result of an
1473    attempt made to obtain a general license or permission for the use of
1474    such proprietary rights by implementers or users of this
1475    specification can be obtained from the IETF on-line IPR repository at
1476    http://www.ietf.org/ipr.
1478    The IETF invites any interested party to bring to its attention any
1479    copyrights, patents or patent applications, or other proprietary
1480    rights that may cover technology that may be required to implement
1481    this standard.  Please address the information to the IETF at
1482    ietf-ipr@ietf.org.
1485 Disclaimer of Validity
1487    This document and the information contained herein are provided on an
1488    "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
1489    OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
1490    ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
1491    INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
1492    INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
1493    WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
1496 Copyright Statement
1498    Copyright (C) The Internet Society (2005).  This document is subject
1499    to the rights, licenses and restrictions contained in BCP 78, and
1500    except as set forth therein, the authors retain all their rights.
1503 Acknowledgment
1505    Funding for the RFC Editor function is currently provided by the
1506    Internet Society.
1511 Kerr                     Expires August 1, 2005                [Page 27]