Skip to content

Commit 5c30e12

Browse files
Djuffindalecurtis
authored andcommitted
Introducing a new 'quantizer' mode for VideoEncoder
A codec specific quantizer is specified for each video frame for constant quality or fine tuned external rate control.
1 parent 2b856eb commit 5c30e12

File tree

2 files changed

+73
-4
lines changed

2 files changed

+73
-4
lines changed

index.src.html

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@
20732073
HardwareAcceleration hardwareAcceleration = "no-preference";
20742074
AlphaOption alpha = "discard";
20752075
DOMString scalabilityMode;
2076-
BitrateMode bitrateMode = "variable";
2076+
VideoEncoderBitrateMode bitrateMode = "variable";
20772077
LatencyMode latencyMode = "quality";
20782078
};
20792079
</xmp>
@@ -2180,8 +2180,8 @@
21802180

21812181
<dt><dfn dict-member for=VideoEncoderConfig>bitrateMode</dfn></dt>
21822182
<dd>
2183-
Configures encoding to use a {{BitrateMode/constant}} or
2184-
{{BitrateMode/variable}} bitrate as defined by [[MEDIASTREAM-RECORDING]].
2183+
Configures encoding to use one of the rate control modes specified by
2184+
{{VideoEncoderBitrateMode}}.
21852185

21862186
NOTE: The precise degree of bitrate fluctuation in either mode is
21872187
implementation defined.
@@ -2359,6 +2359,9 @@
23592359
};
23602360
</xmp>
23612361

2362+
NOTE: Codec-specific extensions to {{VideoEncoderEncodeOptions}} are described in
2363+
their registrations in the [[WEBCODECS-CODEC-REGISTRY]].
2364+
23622365
<dl>
23632366
<dt><dfn dict-member for=VideoEncoderEncodeOptions>keyFrame</dfn></dt>
23642367
<dd>
@@ -2369,6 +2372,34 @@
23692372
</dl>
23702373

23712374

2375+
VideoEncoderBitrateMode{#video-encoder-bitrate-mode}
2376+
-------------------------------------------
2377+
<xmp class='idl'>
2378+
enum VideoEncoderBitrateMode {
2379+
"constant",
2380+
"variable",
2381+
"quantizer"
2382+
};
2383+
</xmp>
2384+
2385+
<dl>
2386+
<dt><dfn enum-value for=VideoEncoderBitrateMode>constant</dfn></dt>
2387+
<dd>Encode at a constant bitrate. See {{VideoEncoderConfig/bitrate}}.</dd>
2388+
<dt><dfn enum-value for=VideoEncoderBitrateMode>variable</dfn></dt>
2389+
<dd>
2390+
Encode using a variable bitrate, allowing more space to be used for
2391+
complex signals and less space for less complex signals.
2392+
See {{VideoEncoderConfig/bitrate}}.
2393+
</dd>
2394+
<dt><dfn enum-value for=VideoEncoderBitrateMode>quantizer</dfn></dt>
2395+
<dd>
2396+
Encode using a quantizer, that is specified for each video
2397+
frame in codec specific extensions of {{VideoEncoderEncodeOptions}}.
2398+
</dd>
2399+
</dl>
2400+
2401+
2402+
23722403
CodecState{#codec-state}
23732404
------------------------
23742405
<xmp class='idl'>

vp9_codec_registration.src.html

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
(2) the codec-specific {{EncodedVideoChunk}}
1717
{{EncodedVideoChunk/[[internal data]]}} bytes, (3) the
1818
{{VideoDecoderConfig/description|VideoDecoderConfig.description}} bytes,
19-
and (4) the values of {{EncodedVideoChunk}} {{EncodedVideoChunk/[[type]]}}.
19+
(4) the values of {{EncodedVideoChunk}} {{EncodedVideoChunk/[[type]]}}, and
20+
(5) the codec-specific extensions to {{VideoEncoderEncodeOptions}}.
2021

2122
The registration is not intended to include any information on whether a
2223
codec format is encumbered by intellectual property claims. Implementers and
@@ -72,6 +73,43 @@
7273
contain a frame with a `frame_type` of `KEY_FRAME` as defined in Section
7374
7.2 of [[VP9]].
7475

76+
VideoEncoderEncodeOptions extensions {#videoencoderencodeoptions-extensions}
77+
==============================================================
78+
79+
<pre class='idl'>
80+
<xmp>
81+
partial dictionary VideoEncoderEncodeOptions {
82+
VideoEncoderEncodeOptionsForVp9 vp9;
83+
};
84+
</xmp>
85+
</pre>
86+
87+
<dl>
88+
<dt><dfn dict-member for=VideoEncoderEncodeOptions>vp9</dfn></dt>
89+
<dd>
90+
Contains codec specific encode options for the [[VP9]] codec.
91+
</dd>
92+
</dl>
93+
94+
VideoEncoderEncodeOptionsForVp9 {#vp9-encode-options}
95+
--------------------------------------
96+
<pre class='idl'>
97+
<xmp>
98+
dictionary VideoEncoderEncodeOptionsForVp9 {
99+
unsigned short? quantizer;
100+
};
101+
</xmp>
102+
</pre>
103+
104+
<dl>
105+
<dt><dfn dict-member for=VideoEncoderEncodeOptionsForVp9>quantizer</dfn></dt>
106+
<dd>
107+
Sets per-frame quantizer value.
108+
In [[VP9]] the quantizer threshold can be varied from 0 to 63
109+
</dd>
110+
</dl>
111+
112+
75113
Privacy Considerations {#privacy-considerations}
76114
==========================================================================
77115

0 commit comments

Comments
 (0)