2

I have a simple IP camera connected to a video encoder "barracuda haivision S-280E-SDI" I can receive the camera feed just fine with vlc, using the folowing URL:

rtsp://10.5.1.2:554

then, I tried to play the video with python and opencv, using the following code:

cap = cv2.VideoCapture('rtsp://10.5.1.2:554', cv2.CAP_FFMPEG)

while cap.isOpened():
  ret, frame = cap.read()
  cv2.imshow('frame', frame)
  if cv2.waitKey(1) == ord(1):
    break
cap.release()
cap.destroyALLWindows()

but I get Error message:

[rtsp @ 0000219d1e4e580] method SETUP failed: 500

why does it happen? what can I do to fix it?

  • Try replacing `'rtsp://10.5.1.2:554'` with `'rtsp://10.5.1.2:554/'`. RTSP protocol supports both TCP and UDP connections, but OpenCV uses TCP. In case your camera supports only UDP, you may try the solution from the [following answer](https://stackoverflow.com/a/58496122/4926757). You may also check if it's working with FFplay. Try: `ffplay rtsp://10.5.1.2:554` and try: `ffplay -rtsp_flags listen rtsp://10.5.1.2:554` – Rotem Jul 11 '22 at 16:33

0 Answers0