opencv picture size 0x0 is invalid
I try to take video stream (live stream) from a cam with rtsp protocol, saying that on windows works perfectly but linux does not want to leave, the code is as follows:
import cv2
if __name__ == "__main__":
# find the webcam
capture = cv2.VideoCapture(0)
frame_width = int(capture.get(3))
frame_height = int(capture.get(4))
# video recorder
fourcc = cv2.cv.CV_FOURCC(*'XVID') # cv2.VideoWriter_fourcc() does not exist
videoOut = cv2.VideoWriter("output.avi", fourcc, 20.0, (frame_width, frame_height))
# record video
while (capture.isOpened()):
ret, frame = capture.read()
if ret:
videoOut.write(frame)
cv2.imshow('Video Stream', frame)
else:
break
# Tiny Pause
key = cv2.waitKey(1)
capture.release()
videoOut.release()
cv2.destroyAllWindows()
return this error: picture size 0x0 is invalid