-
Notifications
You must be signed in to change notification settings - Fork 30
Real display ssh based remote desktop
License
kokoko3k/ssh-rdp
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
------------------------------------------------------------------------------ ssh-rdp ------------------------------------------------------------------------------ ssh-rdp.sh is a shell script that allow you control an X11 remote desktop from an X11 session with minimum latency with support for video and audio streaming. Since the input control happens at low level by using netevent, (https://github.com/Blub/netevent) every input device can actually be forwarded to the remote host. This means keyboards,mouses,joypads,racing wheels and so on, thus allowing you to actually remotely play. Apart from the ssh server, ssh-rdp does not require a specific server running on the remote side, but a set of tools needs to be present remotely and others locally. Software requirements: * Local and Remote: bash,ffmpeg,openssh,netevent * Local: wmctrl, mpv >=0.29, taskset * Remote: xdpyinfo,pulseaudio * If you see Invalid MIT-MAGIC-COOKIE-1 key among the errors, then probably the remote system won't allow remote users to start local X11 applications. The easiest way to solve this is to execute the following command on the remote side: "xhost +local:" A convenient way to do that is via an autostart script executed automatically by your Desktop environment when the user does the local login. Special requirements for input forwarding: * Local user need to access files under /dev/input, so make sure it is in the input group. * Remote user need access to special device /dev/uinput You can do that by install the provided 70-uinput.rules into /etc/udev/rules.d on the remote side and reboot it. Usage: To make it work, first start it with the "inputconfig" option and pay attention to what it asks you. Next, start it with -h parameter alone to see all the options. There are other tunables you can find in the script. Caveats: * Due to network problems, sometimes the audio could be desyncronized, it will recover by itself by speeding up, and could hear high-pitched sound. * Just clicking in the remote window does not pass the control to it, because that is the player, so hitting the choosed hotkey is mandatory. Suggestions: * For remote gaming, turning on cpu encoder may give better results than gpu encoder, if the gpu is already at its limit. Usage: ------------------------------------------------------------------------------ Use ssh-rdp.sh inputconfig to create or change the input config file -s, --server Remote host to connect to -u, --user ssh username -p, --port ssh port --sshopt pass additional ssh option (omit -o) -d, --display Remote display (eg: 0.0) -r, --resolution Grab size (eg: 1920x1080) or AUTO -o, --offset Grab offset (eg: +1920,0) --follow pan the grabbed area when the cursor reaches the border --prescale Scale video before encoding (eg: 1280x720). Has impact on remote cpu use and can increase latency too. -f, --fps Grabbed frames per second --pasource Capture from the specified pulseaudio source. (experimental and may introduce delay) Use AUTO to guess, use ALL to capture everything. Eg: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor --videoenc Video encoder can be: cpu,cpurgb,amdgpu,amdgpu_hevc,intelgpu,nvgpu,nvgpu_hevc,zerocopy,custom or show "zerocopy" is experimental and causes ffmpeg to use kmsgrab to grab the framebuffer and pass frames to vaapi encoder. You've to run 'setcap cap_sys_admin+ep /usr/bin/ffmpeg' on the server to use zerocopy. --display, --follow are ignored when using zerocopy. specify "show" to print the options for each preset. --customv Specify a string for video encoder stuff when videoenc is set to custom Eg: "-threads 1 -c:v h264_nvenc -preset llhq -delay 0 -zerolatency 1" --audioenc Audio encoder can be: opus,pcm,null,custom or show "null" disables audio grabbing completely specify "show" to print the options for each other preset. --customa Specify a string for audio encoder stuff when videoenc is set to custom Eg: "-acodec libopus -vbr off -application lowdelay" -v, --vbitrate Video bitrate in kbps or AUTO AUTO will use 80% of the maximum available throughput. -a, --abitrate Audio bitrate in kbps --vplayeropts Additional options to pass to videoplayer Eg: "--video-output-levels=limited --video-rotate=90" --rexec-before Execute the specified script via 'sh' just before the connection --rexec-exit Execute the specified script via 'sh' before exiting the script --rexec-late Execute the specified script via 'sh' after input(s) forward, before video grab Examples: ------------------------------------------------------------------------------- Peter connecting to jserver, all defaults accepted ssh-rdp.sh --user venkman --server jserver Raymond connecting to jserver on ssh port 322, streaming the display 0.0 remote setup is dual head and Raymond selects the right monitor. Stream will be 128kbps for audio and 10000kbps for video: Ex: ssh-rdp.sh -u stantz -s jserver -p 322 -d 0.0 -r 1920x1080 -o +1920,0 -f 60 -a 128 -v 10000 Egon connecting to jserver on ssh port 322, streaming the display 0.0 Stream will be 128kbps for audio and 10000kbps for video: Egon wants untouched audio, 144fps and encode via intelgpu, he needs to correct video output levels Ex: ssh-rdp.sh -u spengler -s jserver -p 322 -d 0.0 -f 144 -v 80000 --audioenc pcm --videoenc intelgpu --vplayeropts "--video-output-levels=limited" I'm open to suggestions to make this software better!
About
Real display ssh based remote desktop
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published