Way to broadcast / stream desktop over LAN?

I’m part time employed at public school and I’m looking for a way to broadcast a stream of my desktop so the students would see what I’m doing. So it also means the delay between what I’m doing and what students see on their PCs shouldn’t be bigger than 3-4sec. It also should work without needing an Internet connection (should work over LAN) - school’s network is being handled by one guy (not me) and he is there part time too, so often WAN does not work.
As it is public school and resources are limited I’ve started investigating how can I do it on a tight budget. Subscription services (#$@!) are not an option - but I’m willing to spend some of my own cash to purchase an app if it turns out it is not doable reliably with open source.

Initially I thought about ffmpeg and multicast - I thought I could use my beefy OpenSUSE PC (so I know it can handle encoding) and stream it using one of the multicast IPs. I’ve had some success with:

ffmpeg -loglevel debug -f x11grab -s 1920x1080 -r 30 -i :1.0 -c:v h264_nvenc -preset:v llhq -rc:v vbr_minqp -qmin:v 30 -f mpegts udp://236.0.0.1:2000

  • but it has one serious flaw. I might be missing something (ffmpeg is a beast) but I don’t see a way to sync the stream. This means that while initially everything seems ok, but after a while it is a mess. Especially when I start doing something that has multiple fast moving objects - clients see garbled mess with enormous delay. And I don’t think it is a network bandwidth issue - I’ve tried it at home with 2 PCs wired to router and still I encountered this.

Any suggestions what can I try ?

Which desktop environment are you using?

For KDE Plasma 5, launch Krfb server application (eg via Menu > System > Krfb). You’ll see that it will provide a server address and password that needs to be used for the client machines that you which to share the desktop with. The other consideration is the firewall operating on the server (if applicable). If necessary, you’ll need to open the appropriate port (5900 by default). Also when connecting client machines, you can configure to prevent keyborad/mouse control if all you want to share a desktop screen, and instead of being prompted every time a client machine wants to connect, it is possible to configure Krfb to run in ‘Unattended’ mode, so that machines with the correct credentials can just connect. The client machines can connect via vncviewer (or remmina).

The Gnome desktop offers a similar screen sharing functionality, (assuming running under Xorg)…
https://www.linux.com/learn/intro-to-linux/2017/11/how-set-easy-remote-desktop-access-linux
https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.vnc.html

thx deano! Can VNC stream desktop to multiple clients at the same time? I’ve always thought it was 1 to 1 type of thing.

If you can get team viewer 12 (13 is still beta in Linux and not complete). You can invite multiple viewers. It is easy to use and setup but they do want to sell you the commercial version which is assume. Also nomachine may work ok

It usually is considered “one-to-one”, but AFAIU the server should be capable of supporting multiple concurrent sessions with clients. Some experimentation required. I’d make sure if ‘Allow remote connections to control your desktop’ is turned off so that students can only view (and not control) the shared desktop. Give it a whirl.

Similar question asked here…

https://superuser.com/questions/972816/x11-forwarding-how-to-share-desktop-on-many-clients-simultaneously?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Depending on your exact requirements and how dynamic/sophisitcated the desktop sharing needs to be, you may also try live-stream your desktop via VLC , (with students watching via a browser for example)…

https://www.howtogeek.com/120202/how-to-record-your-desktop-to-a-file-or-stream-it-over-the-internet-with-vlc/

YMMV

TeamViewer won’t do the trick - it is subscription only and educational institution are not eligible for free tier (if it was a one time purchase I’d probably fund it from my own pocket).

I’ve tried the VLC option - even before trying ffmpeg. It has the same issue - enormous delay or display going completely out of sync after a while.

I’m currently experimenting with TurboVNC and it is slowly driving me nuts. After some fiddling I managed to make it work, but there are issues:

  1. I have no clue how to set it up so it would display my current session, not create new one (I’m on 1.0, but when I start vncserver it creates 2.0).

  2. I can’t figure out howto make VirtualGL to work (without it 3d apps are super choppy on the clients). When I try:

vglrun glxgears

I get:

*Invalid MIT-MAGIC-COOKIE-1 keyInvalid MIT-MAGIC-COOKIE-1 key[VGL] ERROR: Could not open display :0.

I’ve tried some options on the host:
vglrun -d :1.0 glxgears

*but I got memory protection error. When I tried it on a client (with -d :2.0 instead , because as mentioned clients launch in its own session / display - don’t know correct term) I get a different one:
[VLG] ERROR: in OGLDrawable–
[VGL] 82: Could not create Pbuffer

I’ve noticed this when running vglserver_config:

IMPORTANT NOTE: Your system uses modprobe.d to set device permissions. You
must execute rmmod nvidia with the display manager stopped in order for the
new device permission settings to become effective.

-but I can’t do rmmod nvidia (and also have no clue what it does) as I got info that several others modules are in place.

So, yeah, I’m waaaaaay over my head.
Any suggestions how can I make it work? Or maybe other solutions I could try ?

First,
Unless your classroom is the size of a campus (several typical sized classroooms) you wouldn’t want to do multi-cast, it’d be unnecessarily complex. Do unicast, which should be fine for 20 or so connections over something at fast as Fast Ethernet… Since VNC scrren updates <should> be ony changes and the screen shouldn’t have to be re-written continuously (assuming typical Desktop stuff and not for instance a full screen video).

I haven’t set up VNC for a large number of simultaneous Users, but I don’t know of any change over the years that would prevent this from being set up.
And, it should be simple to do.
By default, TigerVNC is set up on openSUSE with sharing enabled.
You just need to have every client login using the same IP address, port an display.
Remember to set all connections read only or suffer the consequences of a classroom having fun with what you’re presenting.

Otherwise,
I can see that there are a large number of experimental and new products on the Internet that say they offer Desktop sharing and collaborative solutions, but I can’t recommend any at the moment… But, if your needs are very basic, some of them might be a simple solution.

TSU

@tsu2 : you’re right on that I’ll need only rather basic setup - I have usually 15-20 students in the class.

I’ve managed to get some of this working. Namely VirtualGL part. On the host it started working after reboot. On the client side it was a matter of setting -d option to use correct display for rendering. So in my case when I’m starting the app I need to use:

*vglrun -d :1.0 appname

*And ****, the difference is huge - 3d apps are buttery smooth, over LAN it feels like using those natively.

But I can’t figure out VNC part entirely. As mentioned I’m trying to make it work with TurboVNC - as it is tuned for 3d and video. And this is exactly scenario I’m using it for. I recall trying similar setup a year ago (when I didn’t know TurboVNC existed) and it didn’t work well with TigerVNC (it was ok for desktop navigation , but not for 3d / video).

The part I’m struggling with is I don’t know howto set it up so it would display contents of what I’m doing on the host machine, on “real” display (if I understand things correctly - on 0.1 display) rather than another “session” with separate display (0.2 in the test scenario).

Maybe some WebRTC app, that does screen sharing ?

This one maybe? https://github.com/fcwu/desktop-mirror

In case you haven’t seen this here are VNC Leap 15 docs:

https://doc.opensuse.org/documentation/leap/reference/html/book.opensuse.reference/cha.vnc.html

Section 4.4 is what you need on the server side.

thank you Knurpht, will give desktop-mirror app a shot :slight_smile: . If it can sync between the broadcaster and clients it will be fine. As for WebRTC - I’ve been searching a bit and so far haven’t found something that would over LAN or wouldn’t be this awful “software as service” thing. But maybe I’ve been just searching in a wrong way.

Not giving up on VNC though - as so far it was the most promising solution.
The problem atm narrows down to the “simple” thing - I have no clue howto make connected clients see the same thing that person sitting on the actual, barebones host PC does. The clients get separate display (display 2.0) - so the user is the same (the one that starts vncserver - a person that directly uses host PC), but the direct user has display 1.0 , clients have 2.0 . Would love for them to have the same.
In theory I could use a workaround - after starting vncserver on the host I can immediately open vncviewer and use the session from there. So this way both host and client would use vnc to interact with the system. BUt it is dumb - and has a performance penalty.

When creating VNC server I get this:

Warning: domek1.domek:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server domek1.domek:1


You will require a password to access your desktops.


Password:
Verify:
Would you like to enter a view-only password (y/n)? y
Password:
Verify:
xauth: (stdin):1:  bad display name "domek1.domek:2" in "add" command


New 'domek1.domek:2 (przemek)' desktop is domek1.domek:2


Creating default startup script /home/przemek/.vnc/xstartup
Creating default config /home/przemek/.vnc/config
Starting applications specified in /home/przemek/.vnc/xstartup
Log file is /home/przemek/.vnc/domek1.domek:2.log

Here’s start of the log:


TurboVNC Server (Xvnc) 64-bit v2.1.2 (build 20170925)
Copyright (C) 1999-2017 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC


03/06/2018 22:29:56 Using auth configuration file /etc/turbovncserver-security.conf
03/06/2018 22:29:56 Enabled authentication method 'tlsvnc'
03/06/2018 22:29:56 Enabled authentication method 'tlsotp'
03/06/2018 22:29:56 Enabled authentication method 'tlsplain'
03/06/2018 22:29:56 Enabled authentication method 'x509vnc'
03/06/2018 22:29:56 Enabled authentication method 'x509otp'
03/06/2018 22:29:56 Enabled authentication method 'x509plain'
03/06/2018 22:29:56 Enabled authentication method 'vnc'
03/06/2018 22:29:56 Enabled authentication method 'otp'
03/06/2018 22:29:56 Enabled authentication method 'unixlogin'
03/06/2018 22:29:56 Enabled authentication method 'plain'
03/06/2018 22:29:56 Desktop name 'TurboVNC: domek1.domek:2 (przemek)' (domek1.domek:2)
03/06/2018 22:29:56 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
03/06/2018 22:29:56 Listening for VNC connections on TCP port 5902
03/06/2018 22:29:56   Interface 0.0.0.0
03/06/2018 22:29:56 Listening for HTTP connections on TCP port 5802
03/06/2018 22:29:56   URL http://domek1.domek:5802
03/06/2018 22:29:56   Interface 0.0.0.0
03/06/2018 22:29:56 Framebuffer: BGRX 8/8/8/8
03/06/2018 22:29:56 Maximum clipboard transfer size: 1048576 bytes
03/06/2018 22:29:56 VNC extension running!
/usr/bin/startxfce4: X server already running on display :2
xfce4-session: GNOME compatibility is enabled and gnome-keyring-daemon is found on the system. Skipping gpg/ssh-agent startup.

(xfce4-session:5230): xfce4-session-WARNING **: xfsm_manager_load_session: Something wrong with /home/przemek/.cache/sessions/xfce4-session-domek1.domek:2, Does it exist? Permissions issue?
gnome-keyring-daemon: insufficient process capabilities, unsecure memory might get used
gnome-keyring-daemon: insufficient process capabilities, unsecure memory might get used
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
gnome-keyring-daemon: insufficient process capabilities, unsecure memory might get used
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
gnome-keyring-daemon: insufficient process capabilities, unsecure memory might get used
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh

When I try to start tvncconfig I get:

No VNC extension on display :1.0

Any ideas what’s wrong?

That’s the same openSUSE reference page I linked to back in my initial reply. Anyway, last night I found time to share an openSUSE guest desktop with the bridged host (Windows with VNC Viewer) and a another openSUSE machine on my LAN. It seemed to work ok for me, albeit with a small lag (under a second for the most part). I wasn’t doing anything exotic, just opening a few folders, moving them, and running simple commands in a terminal. Hopefully, this can work for the OP when scaled-up to the number of clients required in a classroom situation.

got admit Deano that if those pages contain solution I can’t find it. I see user Donnied saying he achieved it by I don’t know how.
As written I can start vncserver, but the display “sessions” (sorry if I mess the terms up) get the next available number, not the one that is used by the user using the host machine directly (the one that wishes to broadcast the desktop to clients). He gets :1, clients get :2 .

Did you try just enabling desktop sharing via your desktop yet? As a KDE user, I just fired up Krfb, and then started some VNC clients on a couple of machines I had available. (I haven’t tried the vncserver/vncmanager methods outlined in the openSUSE guide.)

Don’t see anything liek desktop sharing on Xfce. Installed Krfb. I can use it for desktop sharing but performance is nowhere near to TurboVNC and I get visual artifact (large parts of some windows are blue). So at least it seems to show it is doable. Still no clue howto set vnc to get desktop sharing not remote access.

Sounds like similar question: https://forums.opensuse.org/showthread.php/531360-serve-VGA-screen-via-vncserver-KDE