You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
4.1 KiB
Markdown

3 years ago
# H.264 / WebRTC
This is a new alternative video transfer mode available for Raspberry Pi 4 users with an HDMI-CSI bridge (including PiKVM v3 HAT).
It uses H.264 encoding instead of MJPEG and provides significantly less traffic consumption. ZeroW is NOT supported.
3 years ago
3 years ago
If you use an OS image built after 2021.06.10, this mode will be available by default.
3 years ago
If you are upgrading to an older version of the OS, you will need to manually enable the WebRTC gateway:
3 years ago
3 years ago
```
# systemctl enable --now kvmd-janus
```
3 years ago
Then reload the Web UI and then in the **System** menu you will see the video mode switch.
!!! note
If you do not see the switch, it means that either your browser does not support WebRTC, or the `kvmd-janus` service was not started.
## Basics
3 years ago
3 years ago
The MJPEG video stream uses the same HTTP connection that you use to get the web interface.
3 years ago
This means that for remote access, you just need to forward ports 80 and 443 on your router.
In contrast, WebRTC is a completely different way of transmitting video.
3 years ago
It uses a P2P connection and UDP. This reduces network load, but makes it difficult to configure -
the server needs to know your network configuration in order to use it correctly.
3 years ago
3 years ago
To implement this, the PiKVM checks which of the network interfaces is used for the default gateway,
3 years ago
and also tries to find out your external address using the Google [STUN](https://en.wikipedia.org/wiki/STUN) server.
3 years ago
This is necessary when using [Tailscale](tailscale.md) or so that you can connect to your PiKVM from the external Internet,
3 years ago
since simply forwarding ports 80 and 443 for WebRTC is not enough - it requires a direct connection.
If you don't like using Google (it was chosen as the default for reliability reasons) for this purpose,
3 years ago
you can choose [any other STUN server](https://www.voip-info.org/stun/) at your discretion, or set up your own.
Edit `/etc/kvmd/override.yaml`:
3 years ago
```yaml
janus:
stun:
host: stun.stunprotocol.org
port: 3478
```
3 years ago
... and restart `kvmd-janus` service using `systemctl restart kvmd-janus`.
## Custom Janus config
3 years ago
[Janus](https://janus.conf.meetecho.com) is a WebRTC gateway that is used to transmit the [uStreamer](https://github.com/pikvm/ustreamer) video.
3 years ago
KVMD-Janus is a wrapper around it, configuring and monitoring changes in the network configuration. This is suitable for most users.
3 years ago
However, if your PiKVM is not connected to the Internet and/or you want to use a custom Janus configuration,
3 years ago
then you should use the `kvmd-janus-static` service instead. You should first change the Janus configuration yourself.
3 years ago
You can find it in `/etc/kvmd/janus/janus.jcfg`.
3 years ago
```
3 years ago
# systemctl disable --now kvmd-janus
...
# systemctl enable --now kvmd-janus-static
3 years ago
```
3 years ago
3 years ago
## Troubleshooting
3 years ago
In rare cases, WebRTC may not work. The most common reasons are:
3 years ago
3 years ago
* Tricky IPv6 configuration on the network. IPv6 support for WebRTC in PiKVM is still in its infancy, so if your network has IPv4, it will be easiest to disable IPv6 on PiKVM. To do this, switch the file system to write mode using `rw` command, add option `ipv6.disable_ipv6=1` to `/boot/cmdline.txt` and perform `reboot`. Also see [here](https://wiki.archlinux.org/title/IPv6#Disable_IPv6).
3 years ago
3 years ago
* A paranoid firewall when you try to connect to the PiKVM by forwarding port 443 to the Internet from the internal network. WebRTC is not enough of this, it uses UDP on ports 10000-20000 for a P2P connection. Make sure that the Firewall does not block them.
3 years ago
3 years ago
* If nothing helps, open the browser's JS console and look at the log, and contact our community via [Discord](https://discord.gg/bpmXfz5). Developers and/or experienced users will definitely help you.
3 years ago
* Another option to try is if you have both wifi and eth connected, disable wifi `rfkill list wifi` then `rfkill block X` where is a number that shows in the output. Reason: Arch Linux will choose to route all outgoing packets out wifi by default.
* There are some linux distro's that require more work to be able to use H.264 (WEBRTC MODE), this may include any RedHat variant.
3 years ago
* For instance: On Fedora you can install the rpmfusion repos, then use the `chromium-freeworld` package instead of `chromium`