I'm trying to capture a video and run it in an OpenCV code, but after a few seconds the video hangs and this error appears:
[udp @ 0x1a2d020] Circular buffer overrun. To avoid, increase fifo_size URL option. To survive in such case, use overrun_nonfatal option
[mjpeg @ 0x1a4f000] overread 7
The code I'm using:
import numpy as np
import cv2
cap = cv2.VideoCapture("udp://@127.0.0.1:6969")
while True:
ret, frame = cap.read()
if ret:
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
I'm using netcat to send the video. like this:
ffmpeg -i evangelion.mp4 -f image2pipe - | nc -u 127.0.0.1 6969