On Mar 18, 8:01 pm, "Synt4x" <[EMAIL PROTECTED]> wrote: > I haven't been able to find the win32api extension, but i've read on > the web that time.sleep() calls win32api.Sleep().
I tested VideoCapture using PyGame to draw the graphics. PyGame wraps SDL which uses DirectDraw on Windows. I don't think it matters much, but DirectX is known to be faster than e.g. GDI and DIB sections. With 10 fps, I get around 10-15% CPU usage on my laptop. The video does not look too bad, but it's not perfect. With 20 fps I get 30-40% CPU usage, and the video looks very smooth. I don't think my webcam could do any better anyway. CPU use in not anywhere near saturation. pygame.time.delay() just calls Sleep() in the Windows API, after setting time resolution to multimedia mode. So adjust the amount of time you keep the thread asleep. import VideoCapture import pygame from pygame.locals import * import sys fps = 20.0 webcam = VideoCapture.Device() webcam.setResolution(640,480) pygame.init() window = pygame.display.set_mode((640,480)) pygame.display.set_caption("WebCam Demo") screen = pygame.display.get_surface() while True: events = pygame.event.get() for event in events: if event.type == QUIT or event.type == KEYDOWN: sys.exit(0) im = webcam.getImage() pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode) screen.blit(pg_img, (0,0)) pygame.display.flip() pygame.time.delay(int(1000 * 1.0/fps)) -- http://mail.python.org/mailman/listinfo/python-list