You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 74846be
Browse filesBrowse the repository at this point in the historyBrowse files
feat: encode VP9 in hardware on Windows, when turned on
Intel GPUs have a Media Foundation VP9 encoder. The hardware encoder
factory uses it for VP9 (profile 0), the way it uses the others, when the
system property webrtc.hardware.vp9Encoder is true as the factory is
created. It is off by default: the encoder has not been tested on an Intel
GPU, and once on, it would take over VP9 from libvpx. Without the property,
or where there is no VP9 encoder, VP9 is encoded with libvpx, and a
hardware encoder that fails to start, or a stream that asks for SVC, falls
back to libvpx as well. VP9 is offered by the software encoders anyway, so
turning it on changes nothing that is negotiated.
EncoderOutputProcessor passes VP9 frames on as they come, with the VP9
information of a single layer that the Java encoders get too (the group
of frames with every key frame), parses their QP, and uses the VP9 quality
scaling thresholds of the Java encoders.
On a machine with an Intel VP9 encoder registered but no Intel GPU, it
fails to start and libvpx takes over, which the test of the property saw.
Hardware encoders produce a single layer. A stream that asks for SVC, such as an AV1 stream with a scalability mode like `L1T3`, is encoded in software.
34
34
35
+
VP9 can be encoded in hardware too, on Windows with the Media Foundation VP9 encoder of the GPU driver, which Intel GPUs have. It is off by default, since it has not been tested on such a GPU yet; turn it on with a system property before the factory is created:
Where the GPU has no VP9 encoder, or the stream asks for SVC, VP9 is still encoded with libvpx.
42
+
35
43
NVENC needs an NVIDIA driver of version 522 or newer on Windows, 520 or newer on Linux. VA-API needs libva 2 and a driver that encodes H.264, such as Intel's `intel-media-va-driver` (iHD) or Mesa's `mesa-va-drivers` for AMD, and access to a render node in `/dev/dri`. All of them are loaded at run time, so nothing needs to be installed on machines without them.
36
44
37
45
The hardware encoders take over H.264 Constrained Baseline and Baseline with packetization mode 1, and AV1 profile 0, formats the software encoders offer too, so encoding these in hardware never changes what is negotiated. H.265 (Main profile) has no software encoder: it is offered after the other codecs, only where the hardware encodes it, so the codec a peer connection prefers stays the same, and a call uses H.265 only if it is preferred (e.g. with `RTCRtpTransceiver.setCodecPreferences()`) and the other end decodes it. On macOS, VideoToolbox is required to encode H.265 in hardware, and never falls back to its software encoder; a Mac without a hardware HEVC encoder does not offer H.265. When a hardware encoder fails to start, for example because the GPU has no encoder sessions left, or fails while encoding, the stream switches to the next encoder in line (e.g. from NVENC to Media Foundation on Windows), and finally to the software encoder, and continues with a key frame. On a machine without a hardware encoder, the factory encodes like `DefaultVideoEncoderFactory`.
0 commit comments