Skip to content

Commit

Permalink
Introducing a new 'quantizer' mode for VideoEncoder
Browse files Browse the repository at this point in the history
A codec specific quantizer is specified for each video frame for constant
quality or fine tuned external rate control.
  • Loading branch information
Djuffin authored and dalecurtis committed Mar 13, 2023
1 parent 2b856eb commit 5c30e12
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 4 deletions.
37 changes: 34 additions & 3 deletions index.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -2073,7 +2073,7 @@
HardwareAcceleration hardwareAcceleration = "no-preference";
AlphaOption alpha = "discard";
DOMString scalabilityMode;
BitrateMode bitrateMode = "variable";
VideoEncoderBitrateMode bitrateMode = "variable";
LatencyMode latencyMode = "quality";
};
</xmp>
Expand Down Expand Up @@ -2180,8 +2180,8 @@

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

NOTE: The precise degree of bitrate fluctuation in either mode is
implementation defined.
Expand Down Expand Up @@ -2359,6 +2359,9 @@
};
</xmp>

NOTE: Codec-specific extensions to {{VideoEncoderEncodeOptions}} are described in
their registrations in the [[WEBCODECS-CODEC-REGISTRY]].

<dl>
<dt><dfn dict-member for=VideoEncoderEncodeOptions>keyFrame</dfn></dt>
<dd>
Expand All @@ -2369,6 +2372,34 @@
</dl>


VideoEncoderBitrateMode{#video-encoder-bitrate-mode}
-------------------------------------------
<xmp class='idl'>
enum VideoEncoderBitrateMode {
"constant",
"variable",
"quantizer"
};
</xmp>

<dl>
<dt><dfn enum-value for=VideoEncoderBitrateMode>constant</dfn></dt>
<dd>Encode at a constant bitrate. See {{VideoEncoderConfig/bitrate}}.</dd>
<dt><dfn enum-value for=VideoEncoderBitrateMode>variable</dfn></dt>
<dd>
Encode using a variable bitrate, allowing more space to be used for
complex signals and less space for less complex signals.
See {{VideoEncoderConfig/bitrate}}.
</dd>
<dt><dfn enum-value for=VideoEncoderBitrateMode>quantizer</dfn></dt>
<dd>
Encode using a quantizer, that is specified for each video
frame in codec specific extensions of {{VideoEncoderEncodeOptions}}.
</dd>
</dl>



CodecState{#codec-state}
------------------------
<xmp class='idl'>
Expand Down
40 changes: 39 additions & 1 deletion vp9_codec_registration.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
(2) the codec-specific {{EncodedVideoChunk}}
{{EncodedVideoChunk/[[internal data]]}} bytes, (3) the
{{VideoDecoderConfig/description|VideoDecoderConfig.description}} bytes,
and (4) the values of {{EncodedVideoChunk}} {{EncodedVideoChunk/[[type]]}}.
(4) the values of {{EncodedVideoChunk}} {{EncodedVideoChunk/[[type]]}}, and
(5) the codec-specific extensions to {{VideoEncoderEncodeOptions}}.

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

VideoEncoderEncodeOptions extensions {#videoencoderencodeoptions-extensions}
==============================================================

<pre class='idl'>
<xmp>
partial dictionary VideoEncoderEncodeOptions {
VideoEncoderEncodeOptionsForVp9 vp9;
};
</xmp>
</pre>

<dl>
<dt><dfn dict-member for=VideoEncoderEncodeOptions>vp9</dfn></dt>
<dd>
Contains codec specific encode options for the [[VP9]] codec.
</dd>
</dl>

VideoEncoderEncodeOptionsForVp9 {#vp9-encode-options}
--------------------------------------
<pre class='idl'>
<xmp>
dictionary VideoEncoderEncodeOptionsForVp9 {
unsigned short? quantizer;
};
</xmp>
</pre>

<dl>
<dt><dfn dict-member for=VideoEncoderEncodeOptionsForVp9>quantizer</dfn></dt>
<dd>
Sets per-frame quantizer value.
In [[VP9]] the quantizer threshold can be varied from 0 to 63
</dd>
</dl>


Privacy Considerations {#privacy-considerations}
==========================================================================

Expand Down

0 comments on commit 5c30e12

Please sign in to comment.