B
B
bezvozni2020-05-28 21:48:25
Python
bezvozni, 2020-05-28 21:48:25

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()


how to just write a stream in a minimally modified state?
ffmpeg can write as many fps as it has, can copy the codec.
here is how to do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question