# OpenH264

H.264 through Cisco’s OpenH264 binary, downloaded on request.

OpenH264 Video Codec provided by Cisco Systems, Inc.

[`install()`](#webrtc.openh264.install) downloads Cisco’s prebuilt binary for macOS (x64, arm64), Linux (x64, arm64, glibc 2.34 or newer)
or Windows (x64), checks its SHA-256 and loads it.

Cisco’s patent license covers the binary only under the conditions of its license (see THIRD_PARTY_LICENSES.md).
The application must let its users enable and disable it, show [`NOTICE`](#webrtc.openh264.NOTICE) where they do, and reproduce
[`LICENSE`](#webrtc.openh264.LICENSE) where it presents licensing information.

### webrtc.openh264.LICENSE

Cisco’s license of the binary, which applications must reproduce where they present licensing information

### webrtc.openh264.NOTICE *= 'OpenH264 Video Codec provided by Cisco Systems, Inc.'*

The text Cisco’s license requires where users enable or disable H.264

### webrtc.openh264.VERSION *= '2.6.0'*

The OpenH264 release the extension is built against, and that [`install()`](#webrtc.openh264.install) downloads

### webrtc.openh264.disable()

Stops offering H.264, until [`install()`](#webrtc.openh264.install) is called again.

OpenH264 Video Codec provided by Cisco Systems, Inc.

Connections created earlier keep their codecs. The binary stays in the cache.

### *async* webrtc.openh264.install(cache_dir=None, \*, print_notice=True)

Enables H.264, downloading Cisco’s OpenH264 binary first if it isn’t cached.

OpenH264 Video Codec provided by Cisco Systems, Inc.

Calling it is the opt-in Cisco’s license requires, and it re-enables H.264 after [`disable()`](#webrtc.openh264.disable). Call it before
creating peer connections, because the codecs of a connection are fixed when it’s created. The download runs in a
thread, so the event loop keeps running. It’s skipped when the binary is already in the cache.

* **Parameters:**
  * **cache_dir** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str), optional) – The directory the binary is kept in. Defaults to `openh264-<VERSION>` in
    the cache directory. That is `WRTC_CACHE_DIR`, else `python-webrtc` in `LOCALAPPDATA` or
    `XDG_CACHE_HOME`, else `~/.cache/python-webrtc`.
  * **print_notice** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), optional) – Whether to print [`NOTICE`](#webrtc.openh264.NOTICE). Pass [`False`](https://docs.python.org/3/builtins/constants.html#False) only when the
    application shows [`NOTICE`](#webrtc.openh264.NOTICE) itself where its users enable and disable H.264, as Cisco’s license
    requires.
* **Returns:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str) – The version of the loaded binary.
* **Raises:**
  [**RuntimeError**](https://docs.python.org/3/builtins/exceptions.html#RuntimeError) – If Cisco has no binary for this platform (on Linux, it needs glibc 2.34 or newer), or it can’t
      be downloaded, doesn’t match its SHA-256, or can’t be loaded.
* **Return type:**
  [str](https://docs.python.org/3/builtins/stdtypes.html#str)

### webrtc.openh264.isEnabled()

Alias for [`is_enabled()`](#webrtc.openh264.is_enabled)

* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)

### webrtc.openh264.is_enabled()

Whether H.264 through OpenH264 is offered to new connections.

* **Returns:**
  [`bool`](https://docs.python.org/3/builtins/functions.html#bool) – [`True`](https://docs.python.org/3/builtins/constants.html#True) after [`install()`](#webrtc.openh264.install), until [`disable()`](#webrtc.openh264.disable).
* **Return type:**
  [bool](https://docs.python.org/3/builtins/functions.html#bool)
