Certainly! Below are step-by-step guides for both:
1. Setting up TigerVNC/x11vnc with H.264 encoding on Linux
Step 1: Install TigerVNC server and viewer
On Ubuntu/Debian:
sudo apt update
sudo apt install tigervnc-standalone-server tigervnc-viewer
On Fedora:
sudo dnf install tigervnc-server tigervnc
Step 2: Configure and run TigerVNC server
TigerVNC supports the -SecurityTypes option and has limited direct support for H.264 encoding itself, but TigerVNC 1.11+ has improved video encoding support such as tight and hextile— which are better than default VNC.
To get H.264 encoding support you may consider alternatives below (like x11vnc with ffmpeg), but let's configure TigerVNC first.
- Create a password for TigerVNC:
vncpasswd
# follow prompt to set password
- Start the TigerVNC server for your current user:
tigervncserver
It will start on a display like :1, typically port 5901.
You can stop with:
tigervncserver -kill :1
Step 3: Connect with TigerVNC client from another device
vncviewer <server-ip>:5901
Notes on H.264 encoding support:
- TigerVNC does not directly support H.264 encoding as VNC protocol is inherently not designed for high-efficiency codecs.
- Some patches/forks and newer VNC implementations try to support it, but generally it's not mainstream in TigerVNC.
- x11vnc can be combined with ffmpeg or VLC to enable H.264 streaming (covered next section).
- For better quality & low latency VNC, try using
-quality and -encoding options or switch to RDP or specialized protocol.
Alternative: Use x11vnc + ffmpeg to stream desktop with H.264 encoding (video-only streaming)
This is closer to the next section. So let’s move to the ffmpeg streaming method since direct H.264 in VNC is not commonly supported.
2. Streaming Linux Desktop (video-only) with ffmpeg + H.264 over HTTP or UDP
This method streams your desktop as an H.264-encoded video stream that can be viewed live with minimal latency but is not interactive (i.e., no mouse or keyboard input).
Step 1: Install ffmpeg
Ubuntu/Debian:
sudo apt update
sudo apt install ffmpeg
Fedora:
sudo dnf install ffmpeg
Step 2: Find your screen resolution
Run:
xdpyinfo | grep dimensions
Example output:
dimensions: 1920x1080 pixels (508x285 millimeters)
Step 3: Run ffmpeg to capture desktop and stream using H.264
You have multiple protocols you could stream with:
- UDP streaming (low latency, but clients must support udp stream)
- HTTP live streaming (higher latency, but easy to view in browser/player)
- RTSP streaming (widely supported in media players)
Example: UDP streaming
Choose a client IP on your LAN (or replace with multicast address if desired):
ffmpeg -f x11grab -s 1920x1080 -i :0.0 \
-vcodec libx264 -preset ultrafast -tune zerolatency -f mpegts udp://<client-ip>:1234
Replace:
1920x1080 with your display resolution
<client-ip> with the IP of the viewing client on your LAN
Step 4: On the client, view the stream
Use VLC player:
vlc udp://@:1234
Or
ffplay udp://@:<port>
Alternative: HTTP streaming via FFmpeg's built-in HTTP server
This requires using ffmpeg to stream to a local MP4 file or HLS segment folder served via a webserver — more complex and higher latency.
Step 5: (Optional) Stream with audio
You can grab audio from your source with ffmpeg if desired, but this step can be complicated given pulsesrc or alsa devices — you can ask me if needed.
Summary for ffmpeg streaming command explained:
ffmpeg -f x11grab -s <width>x<height> -i :0.0 \
-vcodec libx264 -preset ultrafast -tune zerolatency -f mpegts udp://<client-ip>:1234
-f x11grab — capture X11 display
-s — screen size
-i :0.0 — input display (default X11 display)
-vcodec libx264 — use h.264 video codec (CPU based compression)
-preset ultrafast — fastest encoding, lowest latency, bigger filesize
-tune zerolatency — reduce latency tuning
-f mpegts — mpeg transport stream container to allow streaming over UDP
udp://<client-ip>:1234 — send stream to client
Optional improvements:
- Use hardware accelerated encoding instead of CPU-based
libx264 to reduce load and latency, e.g.:
ffmpeg -f x11grab -s 1920x1080 -i :0.0 -vcodec h264_nvenc -preset fast -tune zerolatency -f mpegts udp://<client-ip>:1234
(requires NVIDIA GPU and proprietary drivers)
If you want, I can help you set up hardware acceleration and more advanced streaming options.
Summary
| Method | How To Start | Viewer | Pros | Cons |
|---|
| TigerVNC/X11VNC (normal) | tigervncserver / x11vnc | VNC viewer app (e.g. RealVNC) | Interactive desktop sharing | No native H.264, moderate latency |
| FFmpeg streaming (video-only) | ffmpeg x11grab + udp stream | VLC or ffplay udp stream | Low latency, excellent quality | Not interactive (video-only) |
If you want interactive desktop + H.264-like quality & performance, consider RDP with xrdp or solutions using GPU streaming like Moonlight on NVIDIA hardware.
Let me know if you'd like help setting those up!