openCV connect and process an ip camera stream (rtsp protocol)

asked 2020-05-13 13:43:14 -0500

aviramPi gravatar image

i am trying to connect and process a video stream from my ip camera i am using 360Eye(s) camera.

this is my code trying to connect:

import cv2
cap = cv2.VideoCapture('rtsp://admin:123456@')
while True:
    ret, img =
    if ret == True:
        cv2.imshow('video output', img)
        k = cv2.waitKey(10)& 0xff
        if k == 27:

and i never get inside the if statment

further information: iv'e played the stream via VLC and via Onvif device manager also this is my opencv prop:

Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES (prebuilt binaries)
      avcodec:                   YES (58.54.100)
      avformat:                  YES (58.29.100)
      avutil:                    YES (56.31.100)
      swscale:                   YES (5.5.100)
      avresample:                YES (4.0.0)
    GStreamer:                   NO
    DirectShow:                  YES
    Media Foundation:            YES
      DXVA:                      NO
edit retag flag offensive close merge delete


You need to add port.

supra56 gravatar imagesupra56 ( 2020-05-13 20:27:53 -0500 )edit