Network Working Group M. Niedermayer Internet-Draft FFmpeg Project Expires: January 30, 2007 A. Beregszaszi Siqon July 29, 2006 Using Xiph codecs outside the Ogg container draft-xiph-oggless-00.xml Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC 2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet- Drafts. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. This Internet-Draft will expire on January 30, 2007. Copyright Notice Copyright (C) The Internet Society (2006). All Rights Reserved. Abstract This document describes a way for using codecs made by Xiph in other container formats than their own Ogg format. Niedermayer & Beregszaszi Expires January 30, 2007 [Page 1] Internet-Draft Xiph codecs without Ogg July 2006 Table of Contents 1. Requirements notation . . . . . . . . . . . . . . . . . . . . . 3 2. Security Considerations . . . . . . . . . . . . . . . . . . . . 3 3. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 4. Minimum container requirements . . . . . . . . . . . . . . . . 3 5. Storing global header . . . . . . . . . . . . . . . . . . . . . 4 6. Storing packets . . . . . . . . . . . . . . . . . . . . . . . . 4 7. Codec identifier . . . . . . . . . . . . . . . . . . . . . . . 4 8. Example use in common containers . . . . . . . . . . . . . . . 4 8.1. AVI . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 8.2. ASF . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 8.3. Matroska . . . . . . . . . . . . . . . . . . . . . . . . . 5 8.4. NUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 8.5. MPEG-PS and MPEG-TS . . . . . . . . . . . . . . . . . . . . 6 8.6. WAV . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 8.7. Quicktime / MPEG4 . . . . . . . . . . . . . . . . . . . . . 6 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 7 Intellectual Property and Copyright Statements . . . . . . . . . . 8 Niedermayer & Beregszaszi Expires January 30, 2007 [Page 2] Internet-Draft Xiph codecs without Ogg July 2006 1. Requirements notation The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. 2. Security Considerations None. 3. Introduction The Xiph Foundation develops and maintains several audio and video codecs. All of these codecs are bound technically to their container format Ogg [RFC3533]. The Ogg container format organizes only data packets, but has no knowledge of the content of these packets. Different codec outputs are stored in these packets. It neither has a field for storing global headers of these codecs, if they may present. Headers are just stored the same way as other data packets, without any notation. Vorbis - an audio codec developed by Xiph - and Theora - a video codec based upon VP3 - are designed to be stored in the Ogg container format. Both have more headers, at most three of them. These headers are stored in individual packets. Other container formats have a global header section and packets only container frame data and no headers. Such formats include AVI, ASF, Matroska and NUT. Quicktime/MPEG4 and other MPEG formats are lack of this hiearachy too. With this proposal it will be possible to losslessly move Vorbis and Theora data between Ogg and the above mentioned formats which support global headers. 4. Minimum container requirements This appendix only explains how to store Vorbis in containers which support at least one global header per stream, can seperate individual Vorbis packets and support variable bitrate and variable number of samples/packet. Storage of Vorbis in other containers is outside the scope of this appendix. Niedermayer & Beregszaszi Expires January 30, 2007 [Page 3] Internet-Draft Xiph codecs without Ogg July 2006 5. Storing global header If the container can store three headers per stream in an unambiguos and ordered way then they shall be stored in that way. If on the other hand the container is only capable to store a single global header then the three Vorbis headers shall be concatenated without any additional header, footer or seperator between them to recover the three headers from such a global header the following procedure shall be used: 1. search for the first occurance of 01,'v','o','r','b','i','s' the found match and the following 23 bytes are the 1st header packet 2. search for the 1st occurance of 03,'v','o','r','b','i','s' after here * read an unsigned integer of 32 bits and skip that many bytes * [user_comment_list_length] = read an unsigned integer of 32 bits * iterate [user_comment_list_length] times { * read an unsigned integer of 32 bits and skip that many bytes * } * skip 1 byte 3. the match in 2. and what follows until here is the 2nd header packet 4. search for the 1st occurance of 05,'v','o','r','b','i','s' after here the matching part and what follows is the 3rd header packet 6. Storing packets 7. Codec identifier If the container uses four character codes (FOURCC; AVI [RFC2361] and Fourcc.org [FOURCC]), then "vbrs" shall be used as an identifier. If the container uses arbitrary length strings as identifiers, then "vorbis" shall be used as an identifier. 8. Example use in common containers What follows are some notes about specific containers. These notes are just informative as they just repeat what is written above or in the specification of the specific container. Niedermayer & Beregszaszi Expires January 30, 2007 [Page 4] Internet-Draft Xiph codecs without Ogg July 2006 8.1. AVI AVI supports everything needed to store Vorbis. This does not mean that all application will support Vorbis in AVI, as Vorbis is rather different from other audio codecs commonly stored in AVI. AVI supports a single global header like WAV does, the three Vorbis headers shall be stored in it and only in it as described above dwSampleSize must be set to zero as Vorbis is VBR, many applications do this incorrectly for other VBR codecs and consequently VBR audio in avi becomes problematic AVI does not have timestamps, but each chunk has a constant duration, while Vorbis packets can have one of two durations. If now the AVI header is setup so that each AVI chunk has the same duration as the smaller duration of the two possibilities in Vorbis, then simply inserting empty AVI chunks will allow every AVI chunk to have the correct duration. This is of course not the most beautifull solution, but it is the only way to keep things exact. Additionally note, that empty chunks have been used since ages in AVI to lengthen the duration of video chunks. 8.2. ASF ASF supports a single global header per stream and has timestamps so storing vorbis in it should be possible. As a side note: ASF is patented, and Microsoft has already threatened individuals so we strongly urge you to avoid this container. 8.3. Matroska Matroska supports storing three headers using a Vcorbis-Matroska specific format, which should be used. Note, the above procedure to split one header into three works with the Vorbis-Matroska specific format too. 8.4. NUT NUT supports a single global header per stream so the 3->1 merge and and the 1->3 split procedure above must be used. In addition to that, there is nothing special with storing Vorbis in NUT. Niedermayer & Beregszaszi Expires January 30, 2007 [Page 5] Internet-Draft Xiph codecs without Ogg July 2006 8.5. MPEG-PS and MPEG-TS These containers neither support a global header, nor provide the neccessary packet seperation or framing, so storing Vorbis in them is outside the scope of this document. 8.6. WAV WAV does not provide the neccessary packet seperation or framing, so storing Vorbis in it is outside the scope of this document. 8.7. Quicktime / MPEG4 Quicktime lacks an unambigous place for a global header so its outside the scope of this document. 9. References [FOURCC] "Fourcc.org, a collection of four character codes. http://www.fourcc.org/". [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC2361] Fleischman, E., "WAVE and AVI Codec Registries", RFC 2361. [RFC3533] Pfeiffer, S., "The Ogg Encapsulation Format Version 0", RFC 3533. Niedermayer & Beregszaszi Expires January 30, 2007 [Page 6] Internet-Draft Xiph codecs without Ogg July 2006 Authors' Addresses Michael Niedermayer FFmpeg Project Alex Beregszaszi Siqon Email: alex@siqon.com URI: http://www.siqon.com/ Niedermayer & Beregszaszi Expires January 30, 2007 [Page 7] Internet-Draft Xiph codecs without Ogg July 2006 Intellectual Property Statement The IETF takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on the IETF's procedures with respect to rights in standards-track and standards-related documentation can be found in BCP 11. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementors or users of this specification can be obtained from the IETF Secretariat. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. Please address the information to the IETF Executive Director. Full Copyright Statement Copyright (C) The Internet Society (2006). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assignees. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION Niedermayer & Beregszaszi Expires January 30, 2007 [Page 8] Internet-Draft Xiph codecs without Ogg July 2006 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Acknowledgment Funding for the RFC Editor function is currently provided by the Internet Society. Niedermayer & Beregszaszi Expires January 30, 2007 [Page 9]