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 capture the screen with a specific fps? #181

Closed
hcao720 opened this issue Aug 16, 2020 · 2 comments
Closed

How to capture the screen with a specific fps? #181

hcao720 opened this issue Aug 16, 2020 · 2 comments
Labels

Comments

@hcao720
Copy link

hcao720 commented Aug 16, 2020

Is there any way to capture the screen with a specific fps by applying mss?

@sagarreddypatil
Copy link

This better belongs on StackOverflow, but I'll answer the question anyways.

In order to run a python loop at a certain FPS, you can delay based on the time taken for a process.

import time
MAX_FPS=60
MIN_FRAME_TIME=1/MAX_FPS

while True:
  start = time.time()
  # screen capture
  time.sleep(max(0, MIN_FRAME_TIME - (time.time() - start)))

Hope this helps :)

@hcao720
Copy link
Author

hcao720 commented Oct 22, 2020 via email

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

No branches or pull requests

3 participants