简体   繁体   中英

Increasing fps when grabbing from screen

i want to record scenes from my screen, only keeping those that contain a certain pixelcolor. I have already written a screengrabber using python for this:

import PIL.ImageGrab 

def get_pixel_colour(i_x, i_y):
    return PIL.ImageGrab.grab().load()[i_x, i_y]   

print get_pixel_colour(0, 1)

i= 0 
while (True):
     i=i+1
     x = PIL.ImageGrab.grab()
     print i
     x.save("tm\screengrab"+ str(i) +".bmp")

The thing is my frames per second are not enough to produce a video. I would at least need 25 fps for that, i think. How can i improve the performance of my screengrabber so that it works? I want to keep python as production language, if possible, as i am not as adept in C++.

Is there something like a compiler for python perhaps?

How big is your screen?

If you want to screen grab a 1920x1080 screen at 25fps, and write to a bmp at 25fps you are going to need some much better hardware and probably a totally different software approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM