Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Bug? D3Dshot continously giving lower frames when benchmarked #53

Open
Avnsx opened this issue Apr 11, 2022 · 1 comment
Open

Bug? D3Dshot continously giving lower frames when benchmarked #53

Avnsx opened this issue Apr 11, 2022 · 1 comment

Comments

@Avnsx
Copy link

Avnsx commented Apr 11, 2022

Out of d3dshot's ReadMe Is robust and very stable. You can run it for hours / days without performance degradation

I was trying to compare d3dshot to python mss and pyautogui (backend pillow). My frametest works fine for these other two libraries, but when I try to apply it onto d3dshot, my average frames continously get lower the longer the while loop runs ... Why?

Hardware:
monitor 2560 x 1440p 144hz
cpu amd ryzen 5 5600x 6x core @ 4.3 ghz

meaning optimal results would be 144 frames per second

import time, cv2, mss, numpy, d3dshot, pyautogui

# d3dshot (supports capture outputs: pil, numpy, numpy_float, pytorch, pytorch_float)
img = d3dshot.create(capture_output='numpy')

number_list = []

while True:
    last_time = time.perf_counter()

    # MSS get raw pixels from the screen, save it to a Numpy array
    # img = numpy.array(mss.mss().grab({"top": 40, "left": 0, "width": 800, "height": 640})) # getting 144 fps

    # d3dshot
    img.screenshot(region=(0,40, 800, 640))

    # pyautogui (pillow)
    # img = pyautogui.screenshot(region=(0,40, 800, 640)) # 31 fps

    fps = 1 / (time.perf_counter() - last_time)
    # print(f"fps: {fps}")

    # calc avg
    number_list.append(fps)
    avg = sum(number_list)/len(number_list)
    print(f"averages {round(avg, 2)} fps")

python 3.10.2 | windows 10 64 bit

@ra1nty
Copy link

ra1nty commented May 12, 2022

There are some flaws for the benchmark:

  • you need newly rendered frames to test the mss/d3dshot screenshot. If you are just idling then the benchmark will gives inaccurate results (higher on mss/probably lower on d3dshot).
    To test accurately, you need something that can constantly render new frames (ideally sync with your monitor refreshing rate). I recommend opening Blurbuster UFO test in chrome and doing the testing.

My own benchmark: (5900X + 3090; 240hz monitor)

DXcam python-mss D3DShot
Average FPS 238.79 75.87 118.36
Std Dev 1.25 0.5447 0.3224

Ok tbh that sounds more like a self-advertising: For DXcam see -> https://github.com/ra1nty/DXcam

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants