comparison DOCS/tech/oggless-xiph-codecs.txt @ 19253:d0a35cfca783

alex didnt commit his (very incomplete) rfc conversion of my proposal so i commit mine here dont hesitate to fix typos, do rewordimg and so on for controversial changes please disscuss at nut-devel@mphq first
author michael
date Sun, 30 Jul 2006 09:13:01 +0000
parents
children bc9e95184521
comparison
equal deleted inserted replaced
19252:9757c44cae9a 19253:d0a35cfca783
1 Title Embedding xiph codecs like vorbis in containers other then ogg
2 Version 2006-07-30 (draft)
3 Status this is not a standard or otherwise accepted by xiph or any other
4 group, one day when we have a fully working implementation, did
5 enough testing and so on we might submit it to IETF? to become an
6 RFC ...
7 furthermore this document has been submitted to vorbis-dev and
8 so far has been ignored, maybe they where too busy maybe xiph
9 wants to prevent their open codecs from being used in containers
10 other then their own?
11 Author Michael Niedermayer (michaelni at gmx dot at)
12 License GPL + GFDL + anything neeeded to turn this into a open standard
13 like a RFC
14
15 Minimum container requirments:
16 This appendix only explains how to store xiph codecs in containers which
17 support at least one global header per stream, can seperate individual codec
18 packets and in principle support the codec, so for example in the case of
19 vorbis that would be variable bitrate and variable number of samples/packet
20 Storage in other containers is outside the scope of this appendix
21
22
23 FIXME non vorbis
24 Global header:
25 If the container can store 3 headers per stream in an unambiguos and ordered
26 way then they shall be stored in that way, if OTOH the container is only
27 capable to store a single global header then the 3 codec headers shall be
28 concatenated without any additional header, footer or seperator between them
29 to recover the 3 headers from such a global header the following procedure
30 shall be used:
31
32 1) search for the 1st occurance of 01,'v','o','r','b','i','s'
33 the found match and the following 23 bytes are the 1st header packet
34 2) search for the 1st occurance of 03,'v','o','r','b','i','s' after here
35 3) read an unsigned integer of 32 bits and skip that many bytes
36 4) [user_comment_list_length] = read an unsigned integer of 32 bits
37 5) iterate [user_comment_list_length] times {
38 6) read an unsigned integer of 32 bits and skip that many bytes
39 }
40 7) skip 1 byte
41 8) the match in 2) and what follows until here is the 2nd header packet
42 9) search for the 1st occurance of 05,'v','o','r','b','i','s' after here
43 the matching part and what follows is the 3rd header packet
44 if the container needs an identifer for the global header, for example a 4cc
45 for a global header chunk then glbl shall be used
46
47
48 Storing packets:
49 Each codec packet shall be stored in exactly one "container packet"
50 and one "container packet" must not contain more then one codec packet
51 "container packet" here means the smallest seperateable unit of data in the
52 container
53
54
55 Codec Identifer:
56 xiph-codec 4-cc id long id
57 Vorbis vrbs vorbis
58 Theora ther theora
59 Tarkin trkn tarkin
60 Flac flac flac
61 Speex spex speex
62
63 if the container uses 4-character codes 4-cc identifer from the table above
64 shall be used
65 if the container uses arbitrary length strings as identifers then the long
66 id from the table above shall be used
67
68
69 Examples and Disscussions about specific containers
70 What follows are some notes about specific containers, these notes are just
71 informative as they just repeat what is written above or in the
72 specification of the specific container
73
74
75 Example and Disscussion of the avi container
76 avi supports everything needed to store vorbis, this does not mean that all
77 application will support vorbis in avi as vorbis is rather different from
78 other audio codecs commonly stored in avi ...
79 avi supports a single global header like wav does, the 3 vorbis headers
80 shall be stored in it and only in it as described above
81 dwSampleSize must be set to zero as vorbis is vbr, many applications do
82 this incorrectly for other vbr codecs and consequently vbr audio in avi
83 becomes problematic
84 avi does not have timestamps but each chunk has a constant duration, while
85 vorbis packets can have one of 2 durations, if now the avi header is setup
86 so that each avi chunk has the same duration as the smaller duration of
87 the 2 possibilities in vorbis then simply inserting empty avi chunks will
88 allow every avi chunk to have the correct duration, this is of course
89 not the most beautifull solution but it is the only way to keep things
90 exact, additionally note, that empty chunks have been used since ages
91 in avi to lengthen the duration of video chunks
92
93
94 Example and Disscussion of the asf container
95 asf supports a single global header per stream and has timestamps so
96 storing xiph codecs in it should be possible but asf is patented and
97 microsoft has already threatened individuals so we strongly urge you to
98 avoid this container
99
100
101 Example and Disscussion of the matroska container
102 matroska supports storing 3 headers using a codec specific
103 format, which should be used for storing the 3 headers
104 Note, the above procedure to split one header into 3 works with the
105 vorbis-matroska specific format too
106
107
108 Example and Disscussion of the nut container
109 nut supports a single global header per stream so the 1<->3 merge/split
110 procedure above must be used, except that theres nothing special with
111 storing xiph codecs in nut
112
113
114 Example and Disscussion of mpeg-ps / mpeg-ts container
115 These containers neither support a global header nor provide the neccessary
116 packet seperation / framing, so storing xiph codecs in them is outside the
117 scope of this appendix
118
119
120 Example and Disscussion of wav container
121 wav does not provide the neccessary packet seperation / framing, so storing
122 xiph codecs in it is outside the scope of this appendix
123
124
125 Example and Disscussion of the mov container
126 a single glbl atom shall be placed in the stsd atom in which the the global
127 header shall be stored