Increasing fps when grabbing from screen

856 views Asked by At

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?

1

There are 1 answers

3
Martin Beckett On

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.