forked from w3c/media-source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mp2t-byte-stream-format-respec.html
236 lines (200 loc) · 11.9 KB
/
mp2t-byte-stream-format-respec.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html SYSTEM "about:legacy-compat">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>MPEG-2 TS Byte Stream Format</title>
<script src="https://www.w3.org/Tools/respec/respec-w3c-common" class="remove"></script>
<!--<script src="respec-w3c-common.js" class="remove"></script>-->
<script src="media-source.js" class="remove"></script>
<script class="remove">
(function() {
var mp2tContainerSpecDefinitions = {
'iso-13818-1': { fragment: 'http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=44169', link_text: 'ISO/IEC 13818-1', },
'mpeg2ts-timestampOffset': { helper_type: 'var', fragment: '#mpeg2ts-timestampOffset', link_text: 'MPEG2TS_timestampOffset', },
};
mediaSourceAddDefinitionInfo("mp2t-byte-stream-format", "", mp2tContainerSpecDefinitions);
})();
</script>
<script class="remove">
var respecConfig = {
// specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
specStatus: "ED",
// the specification's short name, as in http://www.w3.org/TR/short-name/
shortName: "mse-byte-stream-format-mp2t",
// if there a publicly available Editor's Draft, this is the link
edDraftURI: "https://w3c.github.io/media-source/mp2t-byte-stream-format.html",
// if this is a LCWD, uncomment and set the end of its review period
// lcEnd: "2009-08-05",
//publishDate: "2015-03-09",
prevVersion: "http://www.w3.org/2013/12/byte-stream-format-registry/mp2t-byte-stream-format.html",
// editors, add as many as you like
// only "name" is required
editors: [
{ name: "Matthew Wolenetz", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
{ name: "Jerry Smith", url: "", company: "Microsoft Corporation", companyURL: "http://www.microsoft.com/" },
{ name: "Mark Watson", url: "", company: "Netflix Inc.", companyURL: "http://www.netflix.com/" },
{ name: "Aaron Colwell (until April 2015)", url: "", company: "Google Inc.", companyURL: "http://www.google.com/" },
{ name: "Adrian Bateman (until April 2015)", url: "", company: "Microsoft Corporation", companyURL: "http://www.microsoft.com/" },
],
mseDefGroupName: "mp2t-byte-stream-format",
mseUnusedGroupNameExcludeList: ["media-source"],
mseContributors: [
"Bob Lund",
"Alex Giladi",
"Duncan Rowden",
"Mark Vickers",
"Glenn Adams",
"Michael Thornburgh",
"David Singer",
],
// name of the WG
wg: "HTML Media Extensions Working Group",
// URI of the public WG page
wgURI: "https://www.w3.org/html/wg/",
// name (without the @w3c.org) of the public mailing to which comments are due
wgPublicList: "public-html-media",
// URI of the patent status for this WG, for Rec-track documents
// !!!! IMPORTANT !!!!
// This is important for Rec-track documents, do not copy a patent URI from a random
// document unless you know what you're doing. If in doubt ask your friendly neighbourhood
// Team Contact.
wgPatentURI: "https://www.w3.org/2004/01/pp-impl/40318/status",
noIDLIn: true,
scheme: "https",
otherLinks: [{
key: 'Repository',
data: [{
value: 'We are on GitHub',
href: 'https://github.com/w3c/media-source/'
}, {
value: 'File a bug',
href: 'https://github.com/w3c/media-source/issues'
}, {
value: 'Commit history',
href: 'https://github.com/w3c/media-source/commits/gh-pages/mp2t-byte-stream-format-respec.html'
}]
},{
key: 'Mailing list',
data: [{
value: 'public-html-media@w3.org',
href: 'https://lists.w3.org/Archives/Public/public-html-media/'
}]
}],
preProcess: [ mediaSourceAddMainSpecDefinitionInfos, mediaSourcePreProcessor ],
// Empty definitions for objects declared in the document are here to
// prevent error messages from being displayed for references to these objects.
definitionMap: {},
postProcess: [ mediaSourcePostProcessor ],
localBiblio: {
"INBANDTRACKS": {
title: "Sourcing In-band Media Resource Tracks from Media Containers into HTML",
href: "https://dev.w3.org/html5/html-sourcing-inband-tracks/",
authors: ["Bob Lund", "Silvia Pfeiffer"],
publisher: "W3C",
}
}
};
</script>
<!-- script to register bugs -->
<!-- Disabled unless/until it supports GitHub issues.
<script src="https://w3c.github.io/webcomponents/assets/scripts/bug-assist.js"></script>
<meta name="bug.short_desc" content="[MSE] ">
<meta name="bug.product" content="HTML WG">
<meta name="bug.component" content="Media Source Extensions">
-->
<link rel="stylesheet" href="mse.css">
</head>
<body>
<section id="abstract">
This specification defines a <a def-id="mse-spec"></a> [[!MEDIA-SOURCE]] byte stream format specification based on MPEG-2 Transport Streams.
</section>
<section id="sotd">
<p>The working group maintains <a href="https://github.com/w3c/media-source/issues">a list of all bug reports that the editors have not yet tried to address</a>; there may also be open bugs in the <a href="http://w3.org/brief/Mjcw">previous bug tracker</a>.</p>
<p>Implementors should be aware that this specification is not stable. <strong>Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways.</strong> Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the mailing list mentioned below and take part in the discussions.</p>
</section>
<section id="introduction">
<h2>Introduction</h2>
<p>This specification defines segment formats for implementations that choose to support MPEG-2 Transport Streams
[[!MPEG2TS]].</p> It defines the MIME-type parameters used to signal codecs, and provides
the necessary format specific definitions for <a def-id="init-segments"></a>, <a def-id="media-segments"></a>, and <a def-id="random-access-points"></a> required by
the <a def-id="byte-stream-formats-section"></a> of the Media Source Extensions spec. This document also defines extra behaviors and state that only apply to this
byte stream format.</p>
</section>
<section id="mime-parameters">
<h2>MIME-type info</h2>
<p>The MIME-type/subtype pair of "video/MP2T", as specified in [[!RFC3551]], MUST be used for byte streams that conform
to this specification.</p>
<p>This following parameters can be used in the MIME-type passed to <a def-id="isTypeSupported"></a> or <a def-id="addSourceBuffer"></a>.</p>
<dl>
<dt>codecs</dt>
<dd>
A comma separated list of codec IDs used to specify what codecs will be used in the byte stream. Implementations SHOULD accept IDs in the form specified by [[!RFC6381]].
<div class="note">Implementations MAY only implement a subset of the codecs and profiles mentioned in the RFC.</div>
</dd>
</dl>
</section>
<section id="mpeg2ts-general">
<h4>General Transport Stream Requirements</h4>
<p>MPEG-2 TS media and initialization segments MUST conform to the MPEG-2 TS Adaptive Profile (ISO/IEC 13818-1:2012 Amd. 2).</p>
<p>The user agent MUST run the <a def-id="append-decode-error-algorithm"></a> if any of the following conditions are met:</p>
<ol>
<li>Segments do not contain complete MPEG-2 TS packets.</li>
<li>Segments do not contain complete PES packets and sections.</li>
<li>Segments contain more than one program.</li>
<li>At least one MPEG-2 TS packet has a non-zero transport_error_indicator.</li>
</ol>
</section>
<section id="mpeg2ts-init-segments">
<h4>Initialization Segments</h4>
<p>An MPEG-2 TS initialization segment consists of a single PAT and a single PMT.</p>
<p>The user agent MUST run the <a def-id="append-decode-error-algorithm"></a> if any of the following conditions are met:</p>
<ol>
<li>A PAT is not present in the <a def-id="init-segment"></a></li>
<li>A PMT is not present in the <a def-id="init-segment"></a></li>
</ol>
<p>The user agent MUST accept and ignore other SI, such as CAT, that are invariant for all subsequent media segments.</p>
<p>The user agent MUST source attribute values for id, kind, label and language for <a def-id="audio-track"></a>, <a def-id="video-track"></a> and
<a def-id="text-track"></a> objects as described for MPEG-2 Transport Streams in the in-band tracks spec [[INBANDTRACKS]].</p>
</section>
<section id="mpeg2ts-media-segments">
<h4>Media Segments</h4>
<p>The user agent MUST run the <a def-id="append-decode-error-algorithm"></a> if any of the following conditions are met:</p>
<ol>
<li>A media segment relies on initialization information in another media segment.</li>
<li>At least one PES packet does not have a PTS timestamp.</li>
<li>PCR is not present in the Segment prior to the first byte of a TS packet payload containing media data.</li>
</ol>
The user agent will accept and ignore PSI that is identical to the information in the last initialization segment which may appear repeatedly throughout the segment.
</section>
<section id="mpeg2ts-random-access-points">
<h4>Random Access Points</h4>
<p>A random access point as defined in this specification corresponds to Elementary Stream Random Access Point as defined in
[[!MPEG2TS]].</p>
</section>
<section id="mpeg2ts-discontinuities">
<h4>Timestamp Rollover & Discontinuities</h4>
<p>Timestamp rollovers and discontinuities MUST be handled by the UA. The UA's MPEG-2 TS implementation MUST maintain an internal offset
variable, <dfn id="mpeg2ts-timestampOffset">MPEG2TS_timestampOffset</dfn>, to keep track of the offset that needs to be applied to timestamps
that have rolled over or are part of a discontinuity. <var>MPEG2TS_timestampOffset</var> is initially set to 0 when the <a class="externalDFN">SourceBuffer</a> is
created. This offset MUST be applied to the timestamps as part of the conversion process from MPEG-2 TS packets
into <a def-id="coded-frames"></a> for the <a def-id="coded-frame-processing-algorithm"></a>. This results in the coded frame timestamps
for a packet being computed by the following equations:</p>
<pre>
Coded Frame Presentation Timestamp = (MPEG-2 TS presentation timestamp) + <var>MPEG2TS_timestampOffset</var>
Coded Frame Decode Timestamp = (MPEG-2 TS decode timestamp) + <var>MPEG2TS_timestampOffset</var></pre>
<p><a def-id="mpeg2ts-timestampOffset"></a> is updated in the following ways:</p>
<ul>
<li>Each time a timestamp rollover is detected, 2^33 MUST be added to <a def-id="mpeg2ts-timestampOffset"></a>.</li>
<li>When a discontinuity is detected, <a def-id="mpeg2ts-timestampOffset"></a> MUST be adjusted to make the timestamps after the discontinuity appear
to come immediately after the timestamps before the discontinuity.</li>
<li>When <a def-id="abort"></a> is called, <a def-id="mpeg2ts-timestampOffset"></a> MUST be set to 0.</li>
<li>When <a def-id="timestampOffset"></a> is successfully set, <a def-id="mpeg2ts-timestampOffset"></a> MUST be set to 0.</li>
</ul>
</section>
<section id="conformance"></section>
<section id="acknowledgements">
<h2>Acknowledgments</h2>
The editors would like to thank <a def-id="contributors"></a> for their contributions to this specification.
</section>
</body>
</html>