draft-kerr-avt-theora-rtp-00.xml 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278
  1. <?xml version='1.0'?>
  2. <!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
  3. <?rfc toc="yes" ?>
  4. <?rfc compact='yes'?>
  5. <rfc ipr="full3667" docName="RTP Payload Format for Theora Encoded Video">
  6. <front>
  7. <title>draft-kerr-avt-theora-rtp-00</title>
  8. <author initials="P" surname="Kerr" fullname="Phil Kerr">
  9. <organization>Xiph.Org</organization>
  10. <address>
  11. <email>phil@plus24.com</email>
  12. <uri>http://www.xiph.org/</uri>
  13. </address>
  14. </author>
  15. <date day="31" month="January" year="2005" />
  16. <area>General</area>
  17. <workgroup>AVT Working Group</workgroup>
  18. <keyword>I-D</keyword>
  19. <keyword>Internet-Draft</keyword>
  20. <keyword>Theora</keyword>
  21. <keyword>RTP</keyword>
  22. <abstract>
  23. <t>
  24. This document describes a RTP payload format for transporting Theora encoded video. It details the RTP encapsulation mechanism
  25. for raw Theora data and configuration headers consisting of the quantization matrices and the Huffman codebooks for the DCT
  26. coefficients, and a table of limit values for the deblocking filter.
  27. </t>
  28. <t>
  29. Also included within the document are the necessary details for the use of Theora with MIME and Session Description Protocol
  30. (SDP).
  31. </t>
  32. </abstract>
  33. <note title="Editors Note">
  34. <t>
  35. All references to RFC XXXX are to be replaced by references to the RFC number of this memo, when published.
  36. </t>
  37. </note>
  38. </front>
  39. <middle>
  40. <section anchor="Introduction" title="Introduction">
  41. <t>
  42. Theora is a general purpose, lossy video codec. It is based on the VP3.1 video codec produced by On2 Technologies and has been donated to the Xiph.org Foundation.
  43. </t>
  44. <t>
  45. Theora I is a block-based lossy transform codec that utilizes an 8 x 8 Type-II Discrete Cosine Transform and block-based motion
  46. compensation. This places it in the same class of codecs as MPEG-1, MPEG-2, MPEG-4, and H.263. The details of how individual
  47. blocks are organized and how DCT coefficients are stored in the bitstream differ substantially from these codecs, however. Theora
  48. supports only intra frames (I frames in MPEG) and inter frames (P frames in MPEG).
  49. </t>
  50. <t>
  51. Theora provides none of its own framing, synchronization, or protection against transmission errors. Theora is a free-form
  52. variable bit rate (VBR) codec, and packets have no minimum size, maximum size, or fixed/expected size. Theora packets are thus
  53. intended to be used with a transport mechanism that provides free-form framing, synchronization, positioning, and error correction
  54. in accordance with these design assumptions, such as Ogg <xref target="rfc3533"></xref>. or RTP/AVP <xref target="rfc3550"></xref>.
  55. </t>
  56. <t>
  57. Theora I currently supports progressive video data of arbitrary dimensions at a constant frame rate in one of several YCbCr color
  58. spaces.
  59. Three different chroma subsampling formats are supported: 4:2:0, 4:2:2, and 4:4:4. The Theora I format does not support interlaced
  60. material, variable frame rates, bit-depths larger than 8 bits per component, nor alternate color spaces such as RGB or arbitrary
  61. multi-channel spaces. Black and white content can be efficiently encoded, however, because the uniform chroma planes compress well.
  62. </t>
  63. <t>
  64. Theora is similar to Vorbis audio <xref target="vorbisrtp"></xref> in that it requires the inclusion of the entire probability
  65. model for the DCT coefficients and all the quantization parameters in the bitstream headers to be sent ahead of the video data. It
  66. is therefore impossible to decode any frame in the stream without having previously fetched the codec info and codec setup headers,
  67. although Theora can initiate decode at an arbitrary intra-frame packet within a bitstream so long as the codec has been initialized
  68. with the setup headers.
  69. </t>
  70. <section anchor="Terminology" title="Terminology">
  71. <t>
  72. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
  73. and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 <xref target="rfc2119"></xref>.
  74. </t>
  75. </section>
  76. </section>
  77. <section anchor="Payload Format" title="Payload Format">
  78. <t>
  79. Each frame of digital video is packetized into one or more RTP packets. If the data for a complete frame exceeds the network
  80. MTU, it SHOULD be fragmented into multiple RTP packets, each smaller than the MTU. A single RTP packet MAY contain
  81. data for more than one Theora frame.
  82. </t>
  83. <t>
  84. For RTP based transportation of Theora encoded video the standard RTP header is followed by a 5 octet payload header, then the
  85. payload data.
  86. </t>
  87. <section anchor="RTP Header" title="RTP Header">
  88. <t>
  89. The format of the RTP header is specified in <xref target="rfc3550"></xref> and shown in Figure 1. This payload format uses
  90. the fields of the header in a manner consistent with that specification.
  91. </t>
  92. <figure anchor="RTP Header Figure" title="RTP Header">
  93. <artwork><![CDATA[
  94. 0 1 2 3
  95. 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
  96. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  97. |V=2|P|X| CC |M| PT | sequence number |
  98. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  99. | timestamp |
  100. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  101. | synchronization source (SSRC) identifier |
  102. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  103. | contributing source (CSRC) identifiers |
  104. | ... |
  105. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  106. ]]></artwork>
  107. </figure>
  108. <t>
  109. The RTP header begins with an octet of fields (V, P, X, and CC) to support specialized RTP uses (see <xref target="rfc3550">
  110. </xref> and <xref target="rfc3551"></xref> for details). For Theora RTP, the following values are used.
  111. </t>
  112. <t>
  113. Version (V): 2 bits</t><t>
  114. This field identifies the version of RTP. The version used by this specification is two (2).
  115. </t>
  116. <t>
  117. Padding (P): 1 bit</t><t>
  118. Padding MAY be used with this payload format according to section 5.1 of <xref target="rfc3550"></xref>.
  119. </t>
  120. <t>
  121. Extension (X): 1 bit</t><t>
  122. The Extension bit is used in accordance with <xref target="rfc3550"></xref>.
  123. </t>
  124. <t>
  125. CSRC count (CC): 4 bits</t><t>
  126. The CSRC count is used in accordance with <xref target="rfc3550"></xref>.
  127. </t>
  128. <t>
  129. Marker (M): 1 bit</t><t>
  130. The Marker bit is used in accordance with <xref target="rfc3550"></xref>.
  131. </t>
  132. <t>
  133. Payload Type (PT): 7 bits</t><t>
  134. An RTP profile for a class of applications is expected to assign a payload type for this format, or a dynamically allocated
  135. payload type SHOULD be chosen which designates the payload as Theora.
  136. </t>
  137. <t>
  138. Sequence number: 16 bits</t><t>
  139. The sequence number increments by one for each RTP data packet sent, and may be used by the receiver to detect packet loss and
  140. to restore packet sequence. This field is detailed further in <xref target="rfc3550"></xref>.
  141. </t>
  142. <t>
  143. Timestamp: 32 bits</t><t>
  144. A timestamp representing the sampling time of the first sample of the first Theora packet in the RTP packet. The clock frequency
  145. MUST be set to the sample rate of the encoded video data and is conveyed out-of-band as an SDP attribute.
  146. </t>
  147. <t>
  148. SSRC/CSRC identifiers: </t><t>
  149. These two fields, 32 bits each with one SSRC field and a maximum of 16 CSRC fields, are as defined in
  150. <xref target="rfc3550"></xref>.
  151. </t>
  152. </section>
  153. <section anchor="Payload Header" title="Payload Header">
  154. <t>
  155. After the RTP Header section the following five octets are the Payload Header.
  156. This header is split into a number of bitfields detailing the format of the following Payload Data packets.
  157. </t>
  158. <figure anchor="Payload Header Figure" title="Payload Header">
  159. <artwork><![CDATA[
  160. 0 1 2 3
  161. 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
  162. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  163. | Setup Header Ident |
  164. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  165. |C|F|0|0|# pkts.|
  166. +-+-+-+-+-+-+-+-+
  167. ]]></artwork>
  168. </figure>
  169. <t>
  170. Setup Header Ident: 32 bits</t>
  171. <t>
  172. This 32 bit field is used to associate the Theora data to a decoding Setup Header. It is created by making a CRC32 checksum
  173. of the Setup Header required to decode the particular Theora video stream.
  174. </t>
  175. <t>
  176. Continuation (C): 1 bit</t>
  177. <t>
  178. Set to one if this is a continuation of a fragmented packet.
  179. </t>
  180. <t>
  181. Fragmented (F): 1 bit</t>
  182. <t>
  183. Set to one if the payload contains complete packets or if it contains the last fragment of a fragmented packet.
  184. </t>
  185. <t>
  186. The next two bits are currently reserved and MUST be set to 0.
  187. </t>
  188. <t>
  189. The last 4 bits are the number of complete packets in this payload. This provides for a maximum number of 15 Theora
  190. packets in the payload. If the packet contains fragmented data the number of packets MUST be set to 0.
  191. </t>
  192. </section>
  193. <section anchor="Payload Data" title="Payload Data">
  194. <t>
  195. Each Theora payload section starts with a three octet header. The first octet is used to denote what kind of Theora data follows.
  196. Then a two octet length header is used to represent the size of the following data payload, followed by the raw Theora data.
  197. </t>
  198. <figure anchor="Payload Data Figure" title="Payload Data">
  199. <artwork><![CDATA[
  200. 0 1 2 3
  201. 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
  202. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  203. | Data type | Payload Length | Theora Data ..
  204. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  205. ]]></artwork>
  206. </figure>
  207. <t>
  208. The data type octet is used to signify the payload data type. If the first bit is set to 0, this indicates the payload is
  209. Theora video data.
  210. </t>
  211. <t>
  212. The following values for the Theora payload type are valid:
  213. </t>
  214. <vspace blankLines="1" />
  215. <list style="empty">
  216. <t> 0 = Raw Theora data</t>
  217. <t> 0x80 = Theora Identification header</t>
  218. <t> 0x81 = Theora Comment header</t>
  219. <t> 0x82 = Theora Setup header</t>
  220. </list>
  221. <vspace blankLines="1" />
  222. <t>
  223. The Theora packet length header is the length of the Theora data block only and does not count the length octets and payload
  224. data type octet.
  225. </t>
  226. <t>
  227. The Theora codec uses relatively unstructured raw packets containing binary integer fields of arbitrary width that often do not fall on an octet boundary. When this happens the bitstream is packed to an octet boundary. When a Theora encoder produces packets unused space in the last byte of a packet is always zeroed during the encoding process. Thus, should this unused space be read, it will return binary zeros.
  228. </t>
  229. <t>
  230. For payloads which consist of multiple Theora packets the payload data consists of the data type field, the payload length field
  231. followed by the payload data for each of the Theora packets in the payload.
  232. </t>
  233. </section>
  234. <section anchor="Example RTP Packet" title="Example RTP Packet">
  235. <t>
  236. Here is an example RTP packet containing two Theora packets.
  237. </t>
  238. <t>
  239. RTP Packet Header:
  240. </t>
  241. <figure anchor="Example RTP Packet Figure" title="Example RTP Packet">
  242. <artwork><![CDATA[
  243. 0 1 2 3
  244. 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
  245. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  246. | 2 |0|0| 0 |0| PT | sequence number |
  247. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  248. | timestamp (in sample rate units) |
  249. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  250. | synchronisation source (SSRC) identifier |
  251. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  252. | contributing source (CSRC) identifiers |
  253. | ... |
  254. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  255. ]]></artwork>
  256. </figure>
  257. <t>
  258. Payload Data:
  259. </t>
  260. <figure anchor="Example Theora Payload Figure" title="Example Theora Payload Packet">
  261. <artwork><![CDATA[
  262. 0 1 2 3
  263. 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
  264. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  265. | Setup Header Ident |
  266. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  267. |0|1|0|0| 2 pks | 0x80 | Payload Length |
  268. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  269. | Theora data ..
  270. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  271. .. data | 0 | Payload Length ..
  272. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  273. .. Theora data |
  274. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  275. ]]></artwork>
  276. </figure>
  277. <t>
  278. The payload portion of the packet starts with the 32 bit Setup Header ident field followed by the 8 bit fragment/count fields. The F
  279. bit is set to 1, indicating that this packet contains whole Theora frame data. The number of whole Theora data packets is set to
  280. 2.
  281. </t>
  282. <t>
  283. Each of the payload blocks starts with a Data type field, for the first payload this is set to 0x80 indicating it is an
  284. Identification header and the second payload is set to 0 indicating it is raw Theora data. Then the two octet length field is
  285. followed by the variable length Theora data.
  286. </t>
  287. </section>
  288. </section>
  289. <section anchor="Frame Packetizing" title="Frame Packetizing">
  290. <t>
  291. Each RTP packet contains either one complete Theora packet, one Theora packet fragment, or an integer number of complete Theora
  292. packets (up to a max of 15 packets, since the number of packets is defined by a 4 bit value).
  293. </t>
  294. <t>
  295. Any Theora data packet that is less than path MTU SHOULD be bundled in the RTP packet with as many Theora packets as will
  296. fit, up to a maximum of 15. Path MTU is detailed in <xref target="rfc1063"></xref> and <xref target="rfc1981"></xref>.
  297. </t>
  298. <t>
  299. If a Theora packet is larger than 65535 octets it MUST be fragmented. A fragmented packet has a zero in the last four bits
  300. of the payload header. Each fragment after the first will also set the Continued (C) bit to one in the payload header. The
  301. RTP packet containing the last fragment of the Theora packet will have the Fragmented (F) bit set to one. To maintain the
  302. correct sequence for fragmented packet reception the timestamp field of fragmented packets MUST be the same as the first
  303. packet sent, with the sequence number incremented as normal for the subsequent RTP packets.
  304. </t>
  305. <section anchor="Example Fragmented Theora Packet" title="Example Fragmented Theora Packet">
  306. <t>
  307. Here is an example fragmented Theora packet split over three RTP packets. Each packet contains the standard RTP headers as
  308. well as the 5 octet Theora headers.
  309. </t>
  310. <figure anchor="Example Fragmented Packet (Packet 1)" title="Example Fragmented Packet (Packet 1)">
  311. <artwork><![CDATA[
  312. Packet 1:
  313. 0 1 2 3
  314. 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
  315. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  316. |V=2|P|X| CC |M| PT | 1000 |
  317. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  318. | xxxxx |
  319. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  320. | synchronization source (SSRC) identifier |
  321. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  322. | contributing source (CSRC) identifiers |
  323. | ... |
  324. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  325. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  326. | Setup Header Ident |
  327. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  328. |0|0|0|0| 0| 0 | Payload Length |
  329. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  330. | Theora data ..
  331. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  332. ]]></artwork>
  333. </figure>
  334. <t>
  335. In this packet the initial sequence number is 1000 and the timestamp is xxxxx. The Continuation (C) bit is set to one,
  336. indicating it is not the continuation of a fragmented bit, and the Fragmentation (F) is set to 0 indicating it is a fragmented
  337. packet. The number of packets field is set to 0, and as the payload is raw Theora data the Theora payload type field is set to 0.
  338. </t>
  339. <figure anchor="Example Fragmented Packet (Packet 2)" title="Example Fragmented Packet (Packet 2)">
  340. <artwork><![CDATA[
  341. Packet 2:
  342. 0 1 2 3
  343. 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
  344. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  345. |V=2|P|X| CC |M| PT | 1001 |
  346. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  347. | xxxxx |
  348. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  349. | synchronization source (SSRC) identifier |
  350. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  351. | contributing source (CSRC) identifiers |
  352. | ... |
  353. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  354. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  355. | Setup Header Ident |
  356. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  357. |1|0|0|0| 0| 0 | Payload Length |
  358. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  359. | Theora data ..
  360. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  361. ]]></artwork>
  362. </figure>
  363. <t>
  364. The C bit is set to 1 and the number of packets field is set to 0. For large Theora fragments there can be several of these type
  365. of payload packets. The maximum packet size SHOULD be no greater than the path MTU, including all RTP and payload headers. The
  366. sequence number has been incremented by one but the timestamp field remains the same as the initial packet.
  367. </t>
  368. <figure anchor="Example Fragmented Packet (Packet 3)" title="Example Fragmented Packet (Packet 3)">
  369. <artwork><![CDATA[
  370. Packet 3:
  371. 0 1 2 3
  372. 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
  373. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  374. |V=2|P|X| CC |M| PT | 1002 |
  375. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  376. | xxxxx |
  377. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  378. | synchronization source (SSRC) identifier |
  379. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  380. | contributing source (CSRC) identifiers |
  381. | ... |
  382. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  383. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  384. | Setup Header Ident |
  385. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  386. |1|1|0|0| 0| 0 | Payload Length |
  387. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  388. | Theora data ..
  389. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  390. ]]></artwork>
  391. </figure>
  392. <t>
  393. This is the last Theora fragment packet. The C and F bits are set and the packet count remains set to 0. As in the previous
  394. packets the timestamp remains set to the first packet in the sequence and the sequence number has been incremented.
  395. </t>
  396. </section>
  397. </section>
  398. <section anchor="Packet Loss" title="Packet Loss">
  399. <t>
  400. As there is no error correction within the Theora stream, packet loss will result in a loss of signal. Packet loss is more of an
  401. issue for fragmented Theora packets as the client will have to cope with the handling of the C and F flags. If we use the
  402. fragmented Theora packet example above and the first packet is lost the client SHOULD detect that the next packet has the packet
  403. count field set to 0 and the C bit is set and MUST drop it. The next packet, which is the final fragmented packet, SHOULD
  404. be dropped in the same manner, or buffered. Feedback reports on lost and dropped packets MUST be sent back via RTCP.
  405. </t>
  406. <t>
  407. If a particular multicast session has a large number of participants care must be taken to prevent an RTCP feedback implosion,
  408. <xref target="rtcp-feedback"></xref>, in the event of packet loss from a large number of participants.
  409. </t>
  410. </section>
  411. <section anchor="Configuration Headers" title="Configuration Headers">
  412. <t>
  413. To decode a Theora stream three configuration header blocks are needed. The first header, the Identification Header, indicates
  414. the frame dimensions, quality, blocks used and the version of the Theora encoder used. The second header, the Comment Header, contains stream metadata and the third header, the Setup Header, details which contains dequantization and Huffman tables.
  415. </t>
  416. <t>
  417. As the RTP stream may change certain configuration data mid-session there are two different methods for delivering this
  418. configuration data to a client, in-band and SDP which is detailed below. SDP delivery is used to set-up an initial
  419. state for the client application and in-band is used to change state during the session. The changes may be due to
  420. different metadata or Setup Header as well as different bitrates of the stream.
  421. </t>
  422. <t>
  423. Out of the two delivery vectors the use of an SDP attribute to indicate an URI where the configuration and Setup Header data
  424. can be obtained is preferred as they can be fetched reliably using TCP. The in-band Setup Header delivery SHOULD
  425. only be used in situations where the link between the client is unidirectional or if the SDP-based information is not available.
  426. </t>
  427. <t>
  428. Synchronizing the configuration and Setup Header to the RTP stream is critical. The 32 bit Setup Header Ident field is used
  429. to indicate when a change in the stream has taken place. The client application MUST have in advance the correct configuration
  430. and Setup Headers and if the client detects a change in the Ident value and does not have this information it MUST NOT
  431. decode the raw Theora data.
  432. </t>
  433. <section anchor="In-band Header Transmission" title="In-band Header Transmission">
  434. <t>
  435. The three header data blocks are sent in-band with the packet type bits set to match the payload type. Normally the Setup Header
  436. and Identification Header are sent once per session if the stream is an encoding of live video, as typically
  437. the encoder state will not change, but the encoder state can change at the boundary of chained Theora video files. Metadata
  438. can be sent at the start as well as any time during the life of the session. Clients MUST be capable of dealing with periodic
  439. re-transmission of the configuration headers.
  440. </t>
  441. <section anchor="Identification Header" title="Identification Header">
  442. <t>
  443. The Identification Header is a short header with only a few fields used to declare the stream definitively as Theora and provide detailed information about the format of the fully decoded video data.</t>
  444. <figure anchor="Identification Header Figure" title="Identification Header">
  445. <artwork><![CDATA[
  446. 0 1 2 3
  447. 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
  448. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  449. |V=2|P|X| CC |M| PT | xxxx |
  450. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  451. | xxxxx |
  452. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  453. | synchronization source (SSRC) identifier |
  454. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  455. | contributing source (CSRC) identifiers |
  456. | ... |
  457. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  458. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  459. | Setup Header Ident |
  460. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  461. |0|1|0|0| 1| 0x80 | Payload Length |
  462. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  463. | VMAJ | VMIN | VREV | FMBW |
  464. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  465. | FMBW | FMBH | NSBS |
  466. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  467. | NSBS | |
  468. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  469. | NBS | NMBS |
  470. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  471. | NMBS | PICW |
  472. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  473. | PICW | PICH |
  474. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  475. | PICH | PICX | PICY | FRN |
  476. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  477. | FRN | FRD |
  478. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  479. | FRD | PARN |
  480. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  481. | PARN | PARD |
  482. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  483. | PARD | CS |PF | NOMBR |
  484. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  485. | NOMBR | QUAL | KFGSHIFT|
  486. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  487. ]]></artwork>
  488. </figure>
  489. <t>
  490. The fields listed above have the following meanings:
  491. </t>
  492. <vspace blankLines="1" />
  493. <vspace blankLines="1" />
  494. <list style="empty">
  495. <t> VMAJ = The major version number. 8 bits.</t>
  496. <t> VMIN = The minor version number. 8 bits.</t>
  497. <t> VREV = The version revision number. 8 bits.</t>
  498. <t> FMBW = The width of the frame in macro blocks. 16 bits.</t>
  499. <t> FMBH = The height of the frame in macro blocks. 16 bits.</t>
  500. <t> NSBS = The total number of super blocks in a frame. 32 bits.</t>
  501. <t> NBS = The total number of blocks in a frame. 36 bits.</t>
  502. <t> NMBS = The total number of macro blocks in a frame. 32 bits.</t>
  503. <t> PICW = The width of the picture region in pixels. 20 bits.</t>
  504. <t> PICH = The height of the picture region in pixels. 20 bits.</t>
  505. <t> PICX = The X offset of the picture region in pixels. 8 bits.</t>
  506. <t> PICY = The Y offset of the picture region in pixels. 8 bits.</t>
  507. <t> FRN = The frame-rate numerator. 32 bits.</t>
  508. <t> FRD = The frame-rate denominator. 32 bits.</t>
  509. <t> PARN = The pixel aspect-ratio numerator. 24 bits.</t>
  510. <t> PARD = The pixel aspect-ratio denominator. 24 bits.</t>
  511. <t> CS = The color space. 8 bits.</t>
  512. <t> PF = The pixel format. 2 bits.</t>
  513. <t> NOMBR = The nominal bitrate of the stream, in bits per second. 24 bits.</t>
  514. <t> QUAL = The quality hint. 6 bits.</t>
  515. <t> KFGSHIFT = The amount to shift the key frame number by in the granule position. 5 bits.</t>
  516. </list>
  517. <vspace blankLines="1" />
  518. </section>
  519. <section anchor="Comment Header" title="Comment Header">
  520. <t>
  521. The Theora Comment Header is the second of three header packets that begin a Theora stream. It is meant for short text comments,
  522. not arbitrary metadata; arbitrary metadata belongs in a separate logical stream that provides greater structure and machine
  523. parseability. The comment field is meant to be used much like someone jotting a quick note on the label of a video. It should be a
  524. little information to remember the disc or tape by and explain it to others; a short, to-the-point text note that can be more than
  525. a couple words, but isn't going to be more than a short paragraph.</t>
  526. <figure anchor="Comment Header Figure" title="Comment Header">
  527. <artwork><![CDATA[
  528. 0 1 2 3
  529. 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
  530. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  531. |V=2|P|X| CC |M| PT | xxxx |
  532. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  533. | xxxxx |
  534. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  535. | synchronization source (SSRC) identifier |
  536. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  537. | contributing source (CSRC) identifiers |
  538. | ... |
  539. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  540. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  541. | Setup Header Ident |
  542. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  543. |0|1|0|0| 1| 0x81 | Payload Length |
  544. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  545. | User comments list length |
  546. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  547. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  548. | User comment length |
  549. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  550. | User comment ..
  551. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  552. .. User comment |
  553. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  554. ]]></artwork>
  555. </figure>
  556. <t>
  557. The format for the data takes the form of a 32 bit field denoting the number of user comments. Each of the user comments is prefixed by a 32 bit length field followed by the comment text encoded in UTF-8.
  558. </t>
  559. </section>
  560. <section anchor="Setup Header" title="Setup Header">
  561. <t>
  562. The Theora setup header contains the limit values used to drive the loop filter, the base matrices and scale values used to build the dequantization tables, and the Huffman tables used to unpack the DCT tokens. Because the contents of this header are specific to Theora, no concessions have been made to keep the fields octet-aligned for easy parsing.
  563. </t>
  564. <figure anchor="Setup Header Figure" title="Setup Header">
  565. <artwork><![CDATA[
  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 | xxxx |
  570. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  571. | xxxxx |
  572. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  573. | synchronization source (SSRC) identifier |
  574. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  575. | contributing source (CSRC) identifiers |
  576. | ... |
  577. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  578. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  579. | Setup Header Ident |
  580. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  581. |0|1|0|0| 1| 0x82 | Payload Length |
  582. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  583. | Setup Header Length |
  584. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  585. | Setup Header ..
  586. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  587. .. Setup Header |
  588. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  589. ]]></artwork>
  590. </figure>
  591. <section anchor="Setup Header CRC32 Generation" title="Setup Header CRC32 Generation">
  592. <t>
  593. In order for different implementations of Theora RTP clients and servers to interoperate with each other a common format
  594. for the production of the CRC32 hash is required. The polynomial is 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.
  595. </t>
  596. <t>
  597. The following C code function SHOULD be used by implementations, if not then the code responsible for generating the CRC32
  598. value MUST use the polynomial function above.
  599. </t>
  600. <artwork><![CDATA[
  601. unsigned int crc32 (int length, unsigned char *crcdata)
  602. {
  603. int index, loop;
  604. unsigned int byte, crc, mask;
  605. index = 0;
  606. crc = 0xFFFFFFFF;
  607. while (index < length) {
  608. byte = crcdata [index];
  609. crc = crc ^ byte;
  610. for (loop = 7; loop >= 0; loop--) {
  611. mask = -(crc & 1);
  612. crc = (crc >> 1) ^ (0xEDB88320 & mask);
  613. }
  614. index++;
  615. }
  616. return ~crc;
  617. }
  618. ]]></artwork>
  619. </section>
  620. </section>
  621. </section>
  622. <section anchor="Packed Headers Delivery" title="Packed Headers Delivery">
  623. <t>
  624. As mentioned above the RECOMMENDED delivery vector for Theora configuration data is via an SDP attribute as this retrieval method
  625. can be performed using a reliable transport protocol.
  626. </t>
  627. <figure anchor="Packed Headers Overview Figure" title="Packed Headers Overview">
  628. <artwork><![CDATA[
  629. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  630. | Number of packed headers |
  631. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  632. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  633. | Packed header |
  634. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  635. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  636. | Packed header |
  637. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  638. ]]></artwork>
  639. </figure>
  640. <t>
  641. As the RTP headers are not required for this method of delivery the
  642. structure of the configuration data is slightly different. The packed header starts with a 32 bit count field which details the number of packed headers that are contained in the bundle. Next is the packed header payload for each chained Theora file.
  643. </t>
  644. <figure anchor="Packed Headers Detail Figure" title="Packed Headers Detail">
  645. <artwork><![CDATA[
  646. 0 1 2 3
  647. 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
  648. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  649. | Header Length |
  650. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  651. | Setup Header Ident |
  652. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  653. | Identification Header ..
  654. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  655. .. Identification Header |
  656. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  657. | Comment Header ..
  658. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  659. .. Comment Header |
  660. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  661. | Setup Header ..
  662. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  663. .. Setup Header |
  664. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  665. ]]></artwork>
  666. </figure>
  667. <t>The key difference between the in-band format is there is no need for the payload header octet and Setup Header Ident field.
  668. Below are examples of the packed headers format.
  669. </t>
  670. <figure anchor="Packed Identification Header Figure" title="Packed Identification Header">
  671. <artwork><![CDATA[
  672. 0 1 2 3
  673. 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
  674. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  675. | VMAJ | VMIN | VREV | FMBW |
  676. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  677. | FMBW | FMBH | NSBS |
  678. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  679. | NSBS | |
  680. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  681. | NBS | NMBS |
  682. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  683. | NMBS | PICW |
  684. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  685. | PICW | PICH |
  686. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  687. | PICH | PICX | PICY | FRN |
  688. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  689. | FRN | FRD |
  690. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  691. | FRD | PARN |
  692. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  693. | PARN | PARD |
  694. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  695. | PARD | CS |PF | NOMBR |
  696. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  697. | NOMBR | QUAL | KFGSHIFT|
  698. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  699. ]]></artwork>
  700. </figure>
  701. <t>
  702. The alignment of the packed Identification Header is slightly different from the RTP payload type as the payload header is not
  703. used.
  704. </t>
  705. <figure anchor="Packed Comment Header Figure" title="Packed Comment Header">
  706. <artwork><![CDATA[
  707. 0 1 2 3
  708. 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
  709. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  710. | User comments list length |
  711. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  712. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  713. | User comment length |
  714. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  715. | User comment ..
  716. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  717. .. User comment |
  718. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  719. ]]></artwork>
  720. </figure>
  721. <t>
  722. The packed Comment Header also as a slightly different structure to that of the RTP payload type with the payload header not being
  723. used.
  724. </t>
  725. <figure anchor="Packed Setup Header Figure" title="Packed Setup Header">
  726. <artwork><![CDATA[
  727. 0 1 2 3
  728. 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
  729. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  730. | Setup Header Length |
  731. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  732. | Setup Header ..
  733. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  734. .. Setup Header |
  735. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  736. ]]></artwork>
  737. </figure>
  738. <t>
  739. The packed Setup Header also has a slightly different structure to that of the RTP payload type. The Setup Header Ident field
  740. that is normally part of this structure is moved to the second field of the overall packed structure.
  741. </t>
  742. <section anchor="Packed Headers IANA Considerations" title="Packed Headers IANA Considerations">
  743. <t>
  744. The following IANA considerations MUST only be applied to the packed headers.
  745. </t>
  746. <t>
  747. MIME media type name: video
  748. </t>
  749. <t>
  750. MIME subtype: theora-config
  751. </t>
  752. <t>
  753. Required Parameters:</t><t>
  754. None.
  755. </t>
  756. <t>
  757. Optional Parameters: </t><t>
  758. None.
  759. </t>
  760. <t>
  761. Encoding considerations:</t><t>
  762. This type is only defined for transfer via HTTP as specified in RFC XXXX.
  763. </t>
  764. <t>
  765. Security Considerations:</t><t>
  766. See Section 6 of RFC 3047.
  767. </t>
  768. <t>
  769. Interoperability considerations: none
  770. </t>
  771. <t>
  772. Published specification:</t>
  773. <t>See RFC XXXX for details.</t>
  774. <t>
  775. Applications which use this media type:</t><t>
  776. Theora encoded video, configuration data.
  777. </t>
  778. <t>
  779. Additional information: none
  780. </t>
  781. <t>
  782. Person &amp; email address to contact for further information:</t><t>
  783. Phil Kerr: &lt;phil@plus24.com&gt;
  784. </t>
  785. <t>
  786. Intended usage: COMMON
  787. </t>
  788. <t>Author/Change controller:</t>
  789. <t>Author: Phil Kerr</t>
  790. <t>Change controller: IETF AVT Working Group</t>
  791. </section>
  792. </section>
  793. <section anchor="Setup Header Caching" title="Setup Header Caching">
  794. <t>
  795. Setup Header caching allows clients that have previously connected to a stream to re-use the associated Setup Header and
  796. configuration data. When a client receives a Setup Header it may store it locally and can compare the CRC32 key with that of the
  797. new stream and begin decoding before it has received any of the headers.
  798. </t>
  799. </section>
  800. <section anchor="Loss of Configuration Headers" title="Loss of Configuration Headers">
  801. <t>
  802. Unlike the loss of raw Theora payload data, loss of a configuration header can lead to a situation where it will not be possible
  803. to successfully decode the stream.
  804. </t>
  805. <t>
  806. Out of the three headers, loss of either the Setup Header or Identification Headers MUST result in the halting of stream
  807. decoding. Loss of the Comment header SHOULD NOT be regarded as fatal for decoding. Loss of any of the headers SHOULD be reported
  808. to the client as well as a loss report sent via RTCP.
  809. </t>
  810. </section>
  811. </section>
  812. <section anchor="IANA Considerations" title="IANA Considerations">
  813. <t>MIME media type name: video</t>
  814. <t>MIME subtype: theora</t>
  815. <t>Required Parameters:</t>
  816. <t>
  817. sampling: Determines the chroma subsampling format.
  818. </t>
  819. <t>
  820. width: Determines the number of pixels per line. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
  821. </t>
  822. <t>
  823. height: Determines the number of lines per frame. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
  824. </t>
  825. <t>
  826. header: Indicates the URI of the decoding configuration headers.
  827. </t>
  828. <t>
  829. Optional Parameters: </t><t>
  830. None.
  831. </t>
  832. <t>
  833. Encoding considerations:</t><t>
  834. This type is only defined for transfer via RTP as specified in RFC XXXX.
  835. </t>
  836. <t>
  837. Security Considerations:</t><t>
  838. See Section 6 of RFC 3047.
  839. </t>
  840. <t>
  841. Interoperability considerations: none
  842. </t>
  843. <t>
  844. Published specification:</t>
  845. <t>See the Theora documentation <xref target="Theora-spec-ref"></xref> for details.</t>
  846. <t>
  847. Applications which use this media type:</t><t>
  848. Video streaming and conferencing tools
  849. </t>
  850. <t>
  851. Additional information: none
  852. </t>
  853. <t>
  854. Person &amp; email address to contact for further information:</t><t>
  855. Phil Kerr: &lt;phil@plus24.com&gt;
  856. </t>
  857. <t>
  858. Intended usage: COMMON
  859. </t>
  860. <t>Author/Change controller:</t>
  861. <t>Author: Phil Kerr</t>
  862. <t>Change controller: IETF AVT Working Group</t>
  863. <section anchor="Mapping MIME Parameters into SDP" title="Mapping MIME Parameters into SDP">
  864. <t>
  865. The information carried in the MIME media type specification has a specific mapping to fields in the Session Description
  866. Protocol (SDP) <xref target="rfc2327"></xref>, which is commonly used to describe RTP sessions. When SDP is used to specify
  867. sessions the mapping are as follows:
  868. </t>
  869. <vspace blankLines="1" />
  870. <list style="symbols">
  871. <t>The MIME type ("video") goes in SDP "m=" as the media name.</t>
  872. <vspace blankLines="1" />
  873. <t>The MIME subtype ("THEORA") goes in SDP "a=rtpmap" as the encoding name.</t>
  874. <vspace blankLines="1" />
  875. <t>The parameter "rate" also goes in "a=rtpmap" as clock rate.</t>
  876. <vspace blankLines="1" />
  877. <t>The parameter "channels" also goes in "a=rtpmap" as channel count.</t>
  878. <vspace blankLines="1" />
  879. <t>The parameter "header" goes in the SDP "a=fmpt" attribute.</t>
  880. </list>
  881. <t>
  882. If the stream comprises chained Theora files the configuration and Setup Headers for each file SHOULD be packaged together
  883. and passed to the client using the headers attribute if all the files to be played are known in advance.
  884. </t>
  885. <t>Example:</t>
  886. <vspace blankLines="1" />
  887. <list style="empty">
  888. <t>c=IN IP4/6 </t>
  889. <t>m=video RTP/AVP 98</t>
  890. <t>a=rtpmap:98 theora/90000</t>
  891. <t>a=fmtp:98 sampling=YCbCr-4:2:2; width=1280; height=720; header=&lt;URI of configuration header&gt;</t>
  892. </list>
  893. </section>
  894. </section>
  895. <!--section anchor="IANA Considerations old" title="IANA Considerations old">
  896. <t>MIME media type name: video</t>
  897. <t>MIME subtype: theora</t>
  898. <t>Required Parameters:</t>
  899. <t>
  900. sampling: Determines the chroma subsampling format.
  901. </t>
  902. <t>
  903. width: Determines the number of pixels per line. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
  904. </t>
  905. <t>
  906. height: Determines the number of lines per frame. This is an integer between 1 and 1048561 and MUST be in multiples of 16.
  907. </t>
  908. <t>
  909. header: Indicates the URI of the decoding configuration headers.
  910. </t>
  911. <t>
  912. Optional Parameters: </t><t>
  913. None.
  914. </t>
  915. <t>
  916. Encoding considerations:</t><t>
  917. This type is only defined for transfer via RTP as specified in RFC XXXX.
  918. </t>
  919. <t>
  920. Security Considerations:</t><t>
  921. See Section 6 of RFC 3047.
  922. </t>
  923. <t>
  924. Interoperability considerations: none
  925. </t>
  926. <t>
  927. Published specification:</t>
  928. <t>See the Theora documentation <xref target="Theora-spec-ref"></xref> for details.</t>
  929. <t>
  930. Applications which use this media type:</t><t>
  931. video streaming and conferencing tools
  932. </t>
  933. <t>
  934. Additional information: none
  935. </t>
  936. <t>
  937. Person &amp; email address to contact for further information:</t><t>
  938. Phil Kerr: &lt;phil@plus24.com&gt;
  939. </t>
  940. <t>
  941. Intended usage: COMMON
  942. </t>
  943. <t>Author/Change controller:</t>
  944. <t>Author: Phil Kerr</t>
  945. <t>Change controller: IETF AVT Working Group</t>
  946. </section-->
  947. <section anchor="Security Considerations" title="Security Considerations">
  948. <t>
  949. RTP packets using this payload format are subject to the security considerations discussed in the RTP specification
  950. <xref target="rfc3550"></xref>. This implies that the confidentiality of the media stream is achieved by using
  951. encryption. Because the data compression used with this payload format is applied end-to-end, encryption may be performed on the
  952. compressed data. Where the size of a data block is set care MUST be taken to prevent buffer overflows in the client applications.
  953. </t>
  954. </section>
  955. <section anchor="Acknowledgments" title="Acknowledgments">
  956. <t>
  957. Thanks to the AVT, Ogg Theora Communities / Xiph.org, Fluendo, Ralph Giles.
  958. </t>
  959. </section>
  960. </middle>
  961. <back>
  962. <references title="Normative References">
  963. <reference anchor="rfc3533">
  964. <front>
  965. <title>The Ogg Encapsulation Format Version 0</title>
  966. <author initials="S." surname="Pfeiffer" fullname="Silvia Pfeiffer"></author>
  967. </front>
  968. <seriesInfo name="RFC" value="3533" />
  969. </reference>
  970. <reference anchor="rfc2119">
  971. <front>
  972. <title>Key words for use in RFCs to Indicate Requirement Levels </title>
  973. <author initials="S." surname="Bradner" fullname="Scott Bradner"></author>
  974. </front>
  975. <seriesInfo name="RFC" value="2119" />
  976. </reference>
  977. <reference anchor="rfc3550">
  978. <front>
  979. <title>RTP: A Transport Protocol for real-time applications</title>
  980. <author initials="H." surname="Schulzrinne" fullname=""></author>
  981. <author initials="S." surname="Casner" fullname=""></author>
  982. <author initials="R." surname="Frederick" fullname=""></author>
  983. <author initials="V." surname="Jacobson" fullname=""></author>
  984. </front>
  985. <seriesInfo name="RFC" value="3550" />
  986. </reference>
  987. <reference anchor="rfc3551">
  988. <front>
  989. <title>RTP Profile for video and Video Conferences with Minimal Control.</title>
  990. <author initials="H." surname="Schulzrinne" fullname=""></author>
  991. <author initials="S." surname="Casner" fullname=""></author>
  992. </front>
  993. <date month="July" year="2003" />
  994. <seriesInfo name="RFC" value="3551" />
  995. </reference>
  996. <reference anchor="rfc2327">
  997. <front>
  998. <title>SDP: Session Description Protocol</title>
  999. <author initials="M." surname="Handley" fullname="Mark Handley"></author>
  1000. <author initials="V." surname="Jacobson" fullname="Van Jacobson"></author>
  1001. </front>
  1002. <seriesInfo name="RFC" value="2327" />
  1003. </reference>
  1004. <reference anchor="rfc1063">
  1005. <front>
  1006. <title>Path MTU Discovery</title>
  1007. <author initials="J." surname="Mogul et al." fullname="J. Mogul et al."></author>
  1008. </front>
  1009. <seriesInfo name="RFC" value="1063" />
  1010. </reference>
  1011. <reference anchor="rfc1981">
  1012. <front>
  1013. <title>Path MTU Discovery for IP version 6</title>
  1014. <author initials="J." surname="McCann et al." fullname="J. McCann et al."></author>
  1015. </front>
  1016. <seriesInfo name="RFC" value="1981" />
  1017. </reference>
  1018. <reference anchor="rtcp-feedback">
  1019. <front>
  1020. <title>Extended RTP Profile for RTCP-based Feedback (RTP/AVPF)</title>
  1021. <author initials="J." surname="Ott" fullname="Joerg Ott"></author>
  1022. <author initials="S." surname="Wenger" fullname="Stephan Wenger"></author>
  1023. <author initials="N." surname="Sato" fullname="Noriyuki Sato"></author>
  1024. <author initials="C." surname="Burmeister" fullname="Carsten Burmeister"></author>
  1025. <author initials="J." surname="Rey" fullname="Jose Rey"></author>
  1026. </front>
  1027. <seriesInfo name="Internet Draft" value="(draft-ietf-avt-rtcp-feedback-11: Work in progress)" />
  1028. </reference>
  1029. <reference anchor="vorbisrtp">
  1030. <front>
  1031. <title>RTP Payload Format for Vorbis Encoded Audio - draft-ietf-avt-vorbis-rtp-00</title>
  1032. <author initials="P." surname="Kerr" fullname="P. Kerr"></author>
  1033. </front>
  1034. <seriesInfo name="Internet Draft" value="(Work in progress)" />
  1035. </reference>
  1036. </references>
  1037. <references title="Informative References">
  1038. <reference anchor="libTheora">
  1039. <front>
  1040. <title>libTheora: Available from the Xiph website, http://www.xiph.org</title>
  1041. </front>
  1042. </reference>
  1043. <reference anchor="Theora-spec-ref">
  1044. <front>
  1045. <title>Ogg Theora I spec: Codec setup and packet decode. http://www.xiph.org/ogg/Theora/doc/Theora-spec-ref.html</title>
  1046. </front>
  1047. </reference>
  1048. </references>
  1049. </back>
  1050. </rfc>