Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

stop recording of IP camera stream after x minutes

Hi, I am pretty much new to opencv and I am trying my hands in using it for one of my IP camera video recording projects. My question is how to stop or end the camera recording or showing the preview after x minutes without pressing ESC or Q key .

Example from openCV: cap = cv2.VideoCapture(0)

while(True): # Capture frame-by-frame ret, frame = cap.read() print frame, type(frame)

# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
    break

When everything done, release the capture

del(cap) cap.release() cv2.destroyAllWindows()

Above example says that User need to press "Q" key to stop the script . Apologies in advance if this question sounds not great and silly.

click to hide/show revision 2
retagged

updated 2016-02-12 01:20:20 -0600

berak gravatar image

stop recording of IP camera stream after x minutes

Hi, I am pretty much new to opencv and I am trying my hands in using it for one of my IP camera video recording projects. My question is how to stop or end the camera recording or showing the preview after x minutes without pressing ESC or Q key .

Example from openCV: cap = cv2.VideoCapture(0)

while(True): # Capture frame-by-frame ret, frame = cap.read() print frame, type(frame)

# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

# Display the resulting frame
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
    break

When everything done, release the capture

del(cap) cap.release() cv2.destroyAllWindows()

Above example says that User need to press "Q" key to stop the script . Apologies in advance if this question sounds not great and silly.