At 05:02 PM 12/6/2006, Tim Roberts wrote: >Ray Schumacher wrote: > > I've been mulling screen capture code. I tried PIL's > > ImageGrab().grab() (with pymedia) but find PIL's method to be pretty > > slow, ~4grabs per second max with no other processes. > > pymedia is pretty quick once I hand it the data. > >How large is your screen? A 1600x1200 true-color desktop is 8 megabytes >worth of pixels, and it can take tens of milliseconds just to copy it >over the PCI bus to main memory.
1024x768, and I want to immediately resize to 640x480 (or smaller) before handing off to pymedia for MPEG input. I have a PIL version that does ~3.2fps, and, the PIL method does not capture the mouse... Gabriel's suggestion of watching events for copying sub-areas is good... I can track the mouse using pyHook, I think. > > I putsed around with win32gui > > desktop = win32gui.GetDesktopWindow() > > dt_l, dt_t, dt_r, dt_b = win32gui.GetWindowRect(desktop) > > but couldn't see how to get at the data via the handle. > > > >You can use BitBlt to copy it to a DIB, but it's not going to be very >convenient to work with. I'll try it; all I want to do is downsample and send it off to pymedia as a string: vcodec.VFrame( PIX_FMT_RGB24, (640, 480), (s, None, None)) I had made a version of http://pymedia.org/tut/src/make_video.py.html >with PIL ImageGrab().grab() as the string source, profiled, and saw >that it was the PIL method as 80+% of the time. Thanks all, Ray _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32