Código Python:
Ver originalimport cv
cv.NamedWindow("camera", 1)
capture = cv.CreateCameraCapture(0)
width = int(cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH))
height = int(cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT))
writer = cv.CreateVideoWriter(
filename='video.avi',
fourcc=cv.CV_FOURCC('F', 'M', 'P', '4'),
fps=25.0,
frame_size=(width,height),
is_color=1)
while True:
frame = cv.QueryFrame(capture)
cv.ShowImage("camera", frame)
cv.WriteFrame(writer, frame)
k = cv.WaitKey(10);
if k == 1048678: #Close with 'f'
break
Cierras el programa con la tecla f.