1

I installed opencv3 installation link on my raspberrypi 3 and i've tested this, everything is ok, but when i try to read the ipcamera video stream encountered this error

self.stream = cv2.VideoCapture("rtsp://*:*@{}:525/stream2".format(ip_camera_address)) 
    'NoneType' object has no attribute '__array_interface__'

Reading the webcam with the usb interface and everything is ok

I think my problem is in ffmpeg library, I try to install this library but it won't fix.

  • I take it *:*@{} is a place-holder for a valid user:pass@host – Jaromanda X Jun 30 at 23:07
  • This is just an example. I used the user and password – Hamed Jun 30 at 23:11
1

if you need run USBcam

import cv2 
cap = cv2.VideoCapture(0)

while(True):
    ret, frame = cap.read()
    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()

if you need run IPcam

import cv2 
cap = cv2.VideoCapture('rtsp://username:password@192.168.1.64/1')

while(True):
    ret, frame = cap.read()
    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
cap.release()
cv2.destroyAllWindows()
  • It is a true method for read video stream at IP camera, But my problem is fix ffmpeg in openCV ,My sintex is true because I have tested this on my PC, But this does not work properly on raspberry – Hamed Jul 3 at 18:00
  • This is often and I had something working on the PC but it does not work on raspberries, try gstreamer – UM Igor Jul 4 at 12:00
1

I install opencv again [best link for install this] and i try to install FFmpeg from repository. affter installation of ffmepg i tried to read ipcamera video stream with this script

Note : after finshing opencv cmake, FFmpeg subitems most all get YES.

enter image description here

self.stream = cv2.VideoCapture("rtsp://user:password@{}:525/stream2".format(ip_camera_address))

And It worked successfully.

This tutorial help me to install ffmpeg on raspberry pi link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.