Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to increase FPS? FPS is limited to monitor Frame Rate #215

Open
DavraYoung opened this issue Aug 11, 2022 · 3 comments
Open

How to increase FPS? FPS is limited to monitor Frame Rate #215

DavraYoung opened this issue Aug 11, 2022 · 3 comments

Comments

@DavraYoung
Copy link

DavraYoung commented Aug 11, 2022

General information:

  • OS name: Windows 10 Pro
  • OS version: 19043.1889/21H1
  • OS architecture: 64 bits
  • Resolutions:
    • Monitor 1: 3840x2160 60Hz
    • Monitor 2: 1920x1080 60Hz
  • Python version: 3.7.0
  • MSS version: 6.1.0
  • Videocard: Gigabyte 3080ti
  • CPU: AMD Ryzen 7 5800x

Description

I try to use MSS library to capture screen game on my Windows PC, however capture frame rates are not getting higher than 60FPS.
Although game is running on 160 FPS, MSS is limited to only 60.

I tried:

  1. Changing Monitor Framerate to 30 and mss fps also dropped to 30.
  2. Changing Monitor resolution, nothing changed
  3. Changing size of screen capture (Region of Interest), it did not change FPS

So I suspect, the problem is not Hardware related and limitation comes from software.

Code

    width = 512 # roi
    height = 512  # roi
    mon = {
        # "left": int(3840 / 2 - width / 2),
        # "top": int(2160 / 2 - height / 2),
        "left": int(1920 / 2 - width / 2),
        "top": int(1080 / 2 - height / 2),
        "width": width,
        "height": height,
    }

    sct = mss()
    fps = [i for i in range(30)]
    index = 0
    prev_bytes = None
    while True:
        if (
            not disabed_capture
        ):
            start_time = time.time()
            _bytes = sct.grab(mon)
            if prev_bytes is not None and _bytes == prev_bytes:
                print("SAME!")
                continue
            prev_bytes = _bytes
            frame = np.array(_bytes)
            queue.put([time.time(), frame])
            index = (index + 1) % len(fps)
            fps[index] = 1 / (time.time() - start_time)
            if index % 30 == 0:
                print("SCREENSHOT FPS: ", sum(fps) / len(fps))
@CTPaHHuK-HEbA
Copy link
Contributor

CTPaHHuK-HEbA commented Aug 11, 2022

Monitor 1: 3840x2160 60Hz

Set monitor if posible to 75Hz or more - fps up to 75. In my system Win10 works like this

Similar problem #196

@DavraYoung
Copy link
Author

@CTPaHHuK-HEbA I cannot change fps to higher, because my monitor supports only 60hz.

Overriding it using Nvidia control panel breaks hdmi signal somehow and the picture on the screen becomes grey.

@freeAhao
Copy link

freeAhao commented Sep 19, 2022

My Windows PC:

  • Windows 10
  • Monitor: 360HZ + 144HZ
  • 3600 + RX590

MSS fps: 60 FPS MAX

My Linux Laptop:

  • Archlinux
  • Monitor: 60HZ
  • 4800u

MSS FPS: 200+ FPS

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

No branches or pull requests

4 participants