I am using IP webcam and collecting video from my phone camera. The issue I am facing is my code does not write any video. It perfectly shows me the video stream but I get only 1kb file of video. I am using python 3.10, opencv 4.9 and windows 11 Home Here's my code-
codec = cv2.VideoWriter_fourcc(*'mp4v')
output = cv2.VideoWriter('output.mp4', codec, 20.0, (640, 480))
cap = cv2.VideoCapture('http://IP:PORT/video')
......
cv2.imshow("Video", final_image)
output.write(final_image)
I tried different combination of codecs(mp4v, XVID, H264) and video format(mp4, avi, mkv). I also tried with a recorded video from my local file. But my code does not write the video. Still I only get one kb file. In some cases I get this in my log too-[mjpeg @ 00000244989c2340] overread 8.
The shape of the final_image is (1280, 720, 3).