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:
Remote access
Two options are supported:
-
Port mapping (not recommended)
- Requires mapping UDP ports 20000-40000
- Complex and less secure
-
Mesh networking (recommended)
- Use tools like Tailscale to build a secure tunnel
- Simple and more secure
- No need to map large port ranges
Video Quality Tuning¶
Quality tuning
If video quality is not ideal, try:
- Adjust H.264 bitrate in the top-right system menu
- Adjust resolution based on network conditions
- Choose a suitable quality preset

