sibson / vncdotool

A command line VNC client and python library
Other
451 stars 121 forks source link

always got black picture #90

Open yunpengb opened 7 years ago

yunpengb commented 7 years ago

Hi, I use python script and try to capture a picture of one host the host is installed tightvnc and it's win7 system. my code is like this:

from vncdotool import api
client = api.connect('192.168.1.199', 'passwd')
client.captureScreen('pic.png')

it always leave a black screenshot, what's wrong with my code?

julianweise commented 7 years ago

Facing exactly the same problem using the cl-tool running: vncdo -s 127.0.0.1 capture screen5.png Using Win10 and have installed TightVNCServer

MagicFab commented 7 years ago

Same here, using TightVNCserver 2.8.8 on Windows 7 Pro.

sibson commented 6 years ago

Has this been resolved with recent changes?

spacelatte commented 6 years ago

okay i tried with both command line invocation and api-call via python

i also got black screen when using tightvnc 2.8.11 on windows 10 (1511)

but i used following code to get screenshot, which worked without problems:

with api.connect("1.2.3.4", password="mypass", timeout=10.0) as cli:
    cli.refreshScreen()
    cli.captureScreen("test.jpg")

also note that it works well on osx's own vnc server (10.11.6)

Chenshennan commented 5 years ago

I got black screen via vncdotool api:

from vncdotool import api
import time
class vnctest(object):
    def takescreenshot(self,in_host,in_password):
        vnc_host=in_host
        vnc_password=in_password
        vnc_session=api.connect(vnc_host,password=vnc_password)
        time.sleep(5)
        try:
            vnc_session.captureScreen('screenshot.png')
        except:
            print('Timeout when attempt to capuring screen')
        vnc_session.disconnect() 

test=vnctest()
test.takescreenshot('<my vnc server IP>','<my vnc server password>')

But if I use tightvnc-2.8.11(Clinet is WIN7, and server is WIN10), I can observe all viewer. At the same time, I run above test script. It can got normal screenshot. Once I disconnect tighvnc viewer and wait a few mins, the screenshot can't be use again.

pmhahn commented 1 year ago

vncdotool -s $HOST:$PORT capture screen.png works fine for me. Maybe this 5 year old bug can be closed?

mikhail-ict commented 9 months ago

I experience exactly the same issue with TightVNCServer...

pmhahn commented 9 months ago

I experience exactly the same issue with TightVNCServer...

What does "exactly" mean: You use that 5 year old version and got a black screen?

Please(!) provide actionable data, e.g.

Please run vncdotool -v -s $HOST:$PORT capture $FILENAME.png and post the debug output; so far you comment does not provide any value and we cannot help you and cannot fix any bug.

mikhail-ict commented 9 months ago

Please(!) provide actionable data, e.g.

  • which Python version
  • on which platform
  • which version of vncdotool
  • which VNC server / which version / which screen resolution / …

Please run vncdotool -v -s $HOST:$PORT capture $FILENAME.png and post the debug output; so far you comment does not provide any value and we cannot help you and cannot fix any bug.

Python is 3.10.9 Platform is Windows 10 22H2 (screen resolution is 1920x1200) vncdotool is 1.2.0 TightVNCServer is 2.7.10

Output:

INFO:root:connecting to 192.168.1.125:5900
INFO:twisted:Starting factory <vncdotool.command.VNCDoCLIFactory object at 0x000001AD53F51D90>
INFO:twisted:Using protocol version 3.8
INFO:twisted:Offered <AuthTypes.VNC_AUTHENTICATION: 2>
INFO:twisted:Offered <AuthTypes.TIGHT: 16>
VNC password:
INFO:twisted:Native PixelFormat(bpp=32, depth=24, bigendian=False, truecolor=True, redmax=255, greenmax=255, bluemax=255, redshift=16, greenshift=8, blueshift=0) bytes=4
INFO:twisted:Offering <Encoding.RAW: 0>
INFO:twisted:Offering <Encoding.PSEUDO_DESKTOP_SIZE: -223>
INFO:twisted:Offering <Encoding.PSEUDO_LAST_RECT: -224>
INFO:twisted:Offering <Encoding.PSEUDO_QEMU_EXTENDED_KEY_EVENT: -258>
INFO:root:connected to b'instructor'
INFO:twisted:x=0 y=0 w=1920 h=1200 <Encoding.PSEUDO_DESKTOP_SIZE: -223>
INFO:twisted:Stopping factory <vncdotool.command.VNCDoCLIFactory object at 0x000001AD53F51D90>
INFO:twisted:Main loop terminated.

The file: test

pmhahn commented 9 months ago

Thank you for the extra data, that helps very much.

INFO:twisted:x=0 y=0 w=1920 h=1200 <Encoding.PSEUDO_DESKTOP_SIZE: -223>

Just a guess: Looks like we get that out-of-band message while actually waiting for the screen content data and we exit immediately instead of waiting for the data and process it. Someone™ has to investigate this…

mikhail-ict commented 5 months ago

Is there any updates on this?