Skip to content

H.264 / WebRTC

H.264 Video

About H.264

H.264 (also called MPEG-4 AVC) is an efficient video compression standard widely used for streaming. Compared to MJPEG, H.264 offers:

  • Lower bandwidth usage
  • Better compression efficiency
  • Audio support
  • Lower latency

Implementation Options

One-KVM provides two H.264 encoding options:

Libx264 (Recommended)

Libx264 is a high-performance H.264 encoder by VideoLAN. This option:

  • Is integrated and enabled by default in recent versions
  • Performs well and is easy to use
  • Supports real-time WebRTC streaming
  • Source code is available in the ustreamer branch
FFmpeg (EOL)

This option uses FFmpeg software encoding and is no longer maintained due to performance issues:

  • High CPU usage
  • Poor experience on low-performance devices
  • Kept for historical reference only

WebRTC Configuration

WebRTC

WebRTC uses P2P connections and UDP transport to:

  • Reduce latency
  • Lower server load
  • Improve real-time performance

Default configuration

WebRTC uses Google's STUN server by default. The config is in /etc/kvmd/override.yaml:

1
2
3
4
5
6
7
janus:
    stun:
        host: stun.l.google.com
        port: 19302
        retries: 5
        retries_delay: 5.0
        timeout: 5.0

Remote access

Two options are supported:

  1. Port mapping (not recommended)

    • Requires mapping UDP ports 20000-40000
    • Complex and less secure

    Port forwarding

  2. Mesh networking (recommended)

    • Use tools like Tailscale to build a secure tunnel
    • Simple and more secure
    • No need to map large port ranges

    Tailscale

Video Quality Tuning

Quality tuning

If video quality is not ideal, try:

  1. Adjust H.264 bitrate in the top-right system menu
  2. Adjust resolution based on network conditions
  3. Choose a suitable quality preset

Demo Video