Video modes¶
PiKVM V3, V4 Plus/Mini and all DIY devices based on HDMI-CSI bridge provides three video streaming modes. This page explains the key differences between them and helps you to achieve optimal video performance.
The video mode can be switched in the System menu in the Web UI. If you don't see the switch, probably your browser does not support H.264 video.
Quick tips
-
Good network: use
WebRTC
orDirect
mode, setH.264 gop = 0
. -
Bad network and
WebRTC
mode: SetH.264 gop = 30
. -
Bad network and
Direct
mode: SetH.264 gop = 0
. -
If the
WebRTC
mode is not working, try theDirect
. -
The
Direct
mode doesn't support audio yet. If you need audio, butWebRTC
is not working, follow this guide.
Settings¶
-
H.264 kbps (Bitrate) - with a large value, the video quality will be better, but the network traffic will increase.
-
H.264 gop (Group of Pictures) - the number of frames between which a reference frame must be forcibly added. The recommended values are described above.
WebRTC H.264 mode¶
This is the default mode. It'is using the efficient H.264 encoding to save traffic. The video is streamed over WebRTC protocol which you may have encountered when you used video calls in Discord or Google Chat. Since WebRTC does not use HTTP for video, establishing a connection is quite tricky (but PiKVM automates 99% of cases). If you have problems with the WebRTC mode, please check this guide.
Advantages / Disadvantages
-
✅ Supported by all modern browsers.
-
✅ Provides two-way audio on PikVM V3 and V4 Plus/Mini.
-
❌ The video may be lost due to a poor connection (like mobile internet, bad Wi-Fi, etc.), or because of the router settings, when WebRTC is given low priority.
-
❌ It may be blocked at all in some networks.
-
❌ Sometimes the latency may increase slightly due to the peculiarities of WebRTC processing in all browsers.
Direct H.264 mode¶
The new experimental mode for real-time streaming, introduced by PiKVM. It also uses H.264 encoding, but streams the video over regular HTTP (WebSocket).
Advantages / Disadvantages
-
✅ Very stable on poor networks, better than WebRTC (based on our tests and user reviews).
-
✅ It is not blocked by firewalls because it appears to be regular HTTPS traffic.
-
✅ The latency is low and stable too.
-
❌ No audio support right now (but it will).
-
❌ Some older browsers doesn't have the WebCodes support needed for this mode.
Legacy MJPEG mode¶
Good old Motion JPEG. This is the way IP cameras have been streaming videos to browsers since ancient times.
The stream is just infinite queue of JPEGs that replace each other in <img>
HTML tag.
There is no point in using it now if one of the previous modes is working.
Advantages / Disadvantages
-
✅ Sometimes the H.264 is disabled in a browser by OS license limitations (for example, in Red Had Linux or Debian). But MJPEG is working always.
-
✅ It is not blocked by firewalls because it appears to be regular HTTPS traffic.
-
✅ Low latency if you have a good network.
-
❌ No audio support.
-
❌❌❌ Consumes a HUGE amount of traffic. No Wi-Fi, no mobile, nothing but cable connection will work.
What if H.264 is not supported by browser at all¶
There are some Linux distro's that require more work to be able to use H.264, this may include any RedHat or Debian variant. Here some examples:
-
In case of Chromium on Fedora, you can connect the RPM Fusion repo and then install the
chromium-freeworld
package instead ofchromium
. -
On Debian GNU/Linux and Firefox, make sure the OpenH264 Plugin both exists and is enabled. Press
Ctrl+Shift+A
to open theAdd-on Manager
, then pressPlugins
. There you should see OpenH264 Video Codec provided by Cisco Systems, Inc. Make sure it is enabled by pressing the "more options" button (tree dots), then pressingAlways Activate
.
Video recording¶
At the moment, it is not possible to record videos in a convenient way from the Web UI, but a small trick in the console can be used to record videos without sound. It's only available on same PiKVM models which support H.264 video.
Recording video from terminal
-
Update OS:
Updating PiKVM OS
To update, run following commands under the
root
user:[root@pikvm ~]# pikvm-update
If you encounter an error like:
[root@pikvm ~]# pikvm-update bash: pikvm-update: command not found
It's most likely you have an old OS release. You can update the OS as follows:
[root@pikvm ~]# rw [root@pikvm ~]# pacman -Syy [root@pikvm ~]# pacman -S pikvm-os-updater [root@pikvm ~]# pikvm-update
Next time you will be able to use the usual method with
pikvm-update
. -
Install
ffmpeg
package and reboot:[root@pikvm ~]# rw [root@pikvm ~]# pacman -S ffmpeg [root@pikvm ~]# reboot
-
After reboot, switch filesystem to RW-mode again using the
rw
command -
To record a video, open the Web UI (i.e. stream should be running) or connect via VNC. Next, run the recording process in the current directory:
[root@pikvm ~]# ustreamer-dump --sink kvmd::ustreamer::h264 --output - | ffmpeg -use_wallclock_as_timestamps 1 -i pipe: -c:v copy my_video.mp4
-
Press
Ctrl+C
to stop the recording, and don't forget to switch filesystem to read-only mode using thero
command.
Take a screenshot from terminal
To take a screenshot, switch filesystem to RW-mode like in previous example and run the stream.
Next, take a screenshot:
[root@pikvm ~]# curl --unix-socket /run/kvmd/ustreamer.sock http://localhost/snapshot -o /tmp/screen.jpg