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