Answer the question
In order to leave comments, you need to log in
How to record rtsp stream in opencv in better quality?
ok, I displayed the stream in a window and wrote it in some capacity in output.avi.
import cv2
cap = cv2.VideoCapture("rtsp://192.168.11.35")
cv2.namedWindow('main', cv2.WINDOW_NORMAL)
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
out = cv2.VideoWriter('output.avi', fourcc, 12,(int(cap.get(3)),int(cap.get(4))))
while(1):
ret, frame = cap.read()
if ret==True:
cv2.imshow('main', frame)
out.write(frame)
ch = cv2.waitKey(5)
if ch == 27:
break
cv2.destroyAllWindows()
cap.release()
out.release()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question