On Fri, Apr 12, 2024 at 01:06:10PM +0200, Dan wrote: > Hello, > > Intringuing this subject from my daughter watching mum doing > lessons at the computer using her mobile. It came out that from > her sparkling mind mum need to connect her mobile to the laptop > (an old 2011 mac) to watch to her student. > > Do you think remote the possibility to have some screen mirroring > functionalities embedded in our favorit desktop environemnt under > OpenBSD? > > I imagine a more *flexible* desk environment where sort of universal > screen mirroring is allowed among devices exacly how today we can > do in our livingroom on Samsung or other brand TVs.. > > -Dan >
You can use ffmpeg to capture the screen and then multicast the video/audio stream. You can choose to stream only a specific window by using `xwininfo` to pick which one first, e.g.: #!/bin/sh IP=239.255.0.1 PORT=9000 eval `xwininfo | awk ' /Absolute.*X:/ { print "XOFFSET="$4 } /Absolute.*Y/ { print "YOFFSET="$4 } /Width/ { print "WIDTH="$2} /Height/ { print "HEIGHT="$2 } '` ffmpeg -f x11grab -s ${WIDTH}x${HEIGHT} -grab_x $XOFFSET -grab_y $YOFFSET \ -framerate 10 -i :0.0 \ -vcodec libx264 -x264-params nal-hrd=cbr:force-cfr=1:keyint=250 \ -preset medium -profile high -pix_fmt yuv420p -tune zerolatency \ -b:v 2000K -minrate 2000K -maxrate 2000K -bufsize 4000k \ -f mpegts "udp://${IP}:${PORT}?ttl=12&pkg_size=1316" Note: you have to enable multicasting, and consider this as untested. It's been a loooong time since I wrote and used it. You can adapt it easily to capture the whole screen. I also have a different version that uses Xephyr to simulate an entirely new desktop on a smaller window. There are a lot of variants for this out there, much more polished that this. Just search for "ffmpeg screencast", and you're bound to find a few. --