sibson / vncdotool

A command line VNC client and python library
Other
448 stars 120 forks source link

Specify image depth (bits per pixel) #168

Open abulhol opened 4 years ago

abulhol commented 4 years ago

I am trying to capture images via a VNC connection to an Intel AMT KVM. Connecting via vncviewer works flawlessly, but vncdo fails to capture images. I have found out that this is related to the image depth. A similar issue has been reported for noVNC here: https://github.com/novnc/noVNC/issues/118

The following happens when I try to capture the image:

vncdo -vv -s <ip>::5900 -p <pw> capture screen.png
INFO:root:connecting to <ip>:5900
INFO:twisted:Starting factory <vncdotool.command.VNCDoCLIFactory instance at 0x7fbdd4509460>
INFO:twisted:Protocol version 4.000 not supported
INFO:twisted:Using protocol version 3.800
INFO:root:connected to Intel(r) AMT KVM
DEBUG:vncdotool.client:captureScreen screen.png
ding
CRITICAL:root:Connection to the other side was lost in a non-clean fashion.
INFO:twisted:Stopping factory <vncdotool.command.VNCDoCLIFactory instance at 0x7fbdd4509460>
INFO:twisted:Main loop terminated.

I have found another tool which gives an option to set the image depth, vnccapture from libnet-vnc-perl_0.40-2_all. It would be nice if vncdo also offered this option.

pmhahn commented 1 year ago

INFO:twisted:Protocol version 4.000 not supported

See https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Fkvmandintelamt.htm for some details from intel plus https://community.intel.com/t5/Intel-Business-Client-Software/RFB-VNC-protocol-4-0-specification/m-p/763420/highlight/true#M25

With #243 now merged adding support for AMT should be simple or might already work. Intel AMT KVM only supports 8 or 16 bit formats; BGR16 is already supported as Apple Remote Desktop already requires it and was added via #200. Support for 8 bit formats using palette is currently not implemented.

Please test the current version of vncdotool from git branch main:

pip install git+https://github.com/sibson/vncdotool.git@main

Running your original command again should now provide more detail, which should help implementing this if it still does not work:

vncdo -vv -s ::5900 -p capture screen.png