DXcam icon indicating copy to clipboard operation
DXcam copied to clipboard

Movement Dropping Framerate

Open Qfc9 opened this issue 2 years ago • 5 comments

First off, great repo, it is really coming in clutch.

Issue

I am able to typically achieve the framerate cap set ONLY if their is no movement. If I move my mouse around it causes the FPS to drop almost 50% and if I move windows around or have content moving in the background it lowers it even further (From 160 to 40ish). The performance loss only happens on movement.

Thought it may be a windows issue so I elevated the tasks run priority to realtime and their was no difference.

Thought it may be a GPU issue but still happens if games are or are not running. If the game is on a static page it will shoot up, but if there is any movement, it will drop back down again.

Not sure if this is a DXcam issue or python issue. I want to assume it's a DXcam issue internally or with the Windows API calls. It seems like the scenes are being cached which improves performance but once something changes, the cache is invalidated and the update process becomes very slow.

Output:

This is the output speed from me just moving my mouse around. I know it says CPS, but it is FPS. Code is pulled from another project and I was lazy and didn't change the output text.

CPS: 135
CPS: 136
CPS: 86
CPS: 52
CPS: 52
CPS: 129
CPS: 99

Desktop Specs:

  • AMD Ryzen 7 2700 (8 core, 3.2gz)
  • 64GB DDR4
  • NVIDA RTX 2080

Software (may be relevant, not sure)

  • CUDA ToolKit 11.3

Code

This is the code I was running. Forgive the code, it is cut out from a larger application

import time
import win32api
import dxcam

aaQuitKey = "Q"
cpsDisplay = True
count = 0
sTime = time.time()

screenshotTime = 0
imgTime = 0
modelTime = 0
formatTime = 0

region=(0, 0, 320, 320)

camera = dxcam.create(region=region)
camera.start(target_fps=160, video_mode=True)

st = time.time()
while win32api.GetAsyncKeyState(ord(aaQuitKey)) == 0:
    frame = camera.get_latest_frame()

    count += 1
    if (time.time() - sTime) > 1:
        if cpsDisplay:
            print("CPS: {}".format(count))

        count = 0

        sTime = time.time()```

### Let me know if you need me to submit more info

Qfc9 avatar Jul 21 '22 21:07 Qfc9

Follow up

Here is the output from

code

print(dxcam.device_info())
print(dxcam.output_info())

output

Device[0]:<Device Name:NVIDIA GeForce RTX 2080 Dedicated VRAM:8010Mb VendorId:4318>

Device[0] Output[0]: Res:(3840, 2160) Rot:0 Primary:True
Device[0] Output[1]: Res:(3840, 2160) Rot:0 Primary:False
Device[0] Output[2]: Res:(1920, 1080) Rot:0 Primary:False

Qfc9 avatar Jul 21 '22 21:07 Qfc9

Any news on this im experiencing the same problem with 3060ti 32gb 5700x

ninjatall12 avatar Aug 02 '22 19:08 ninjatall12

Have you tried video_mode=False ?

AI-M-BOT avatar Nov 02 '22 14:11 AI-M-BOT

Have you tried video_mode=False ?

Yes still the same

ninjatall12 avatar Nov 03 '22 13:11 ninjatall12

amazing rootkit developer and cv-go developer in the same post :)

ZCban avatar Apr 28 '23 20:04 ZCban