2

I trying create capture RTSP stream by my ip camera. It is good working in VLC player, but not work in python 3.6 with OpenCV package.

I run this code:

import cv2
sUrl = 'rtsp://admin:*****@**.***.***.***:554/onvif1'
vcap = cv2.VideoCapture(sUrl)

while(1):
    ret, frame = vcap.read()
    cv2.imshow('frame', frame)
    cv2.waitKey(1)

and get this error:

error
Traceback (most recent call last) in () 8 while(1): 9 ret, frame = vcap.read() ---> 10 cv2.imshow('frame', frame) 11 cv2.waitKey(1)

error: OpenCV(3.4.1) C:\Miniconda3\conda-bld\opencv-suite_1533128839831\work\modules\highgui\src\window.cpp:356: error: (-215) size.width>0 && size.height>0 in function cv::imshow

after, I check capture

vcap.isOpened()

and I get False value

Python version - 3.6 OS - Windows 10 OpenCV version - 2.4.12

Thank you!

  • are you sure is a rtsp stream? sounds more like onvif ? which model of camera you have? – api55 Sep 04 '18 at 14:49
  • This is realy onvif. Maybe I not quite understand why working onvif. It seemed to me that onvif simply protocol of protection... ESCAM Button Q6 – Nikita Zakoryuchkin Sep 04 '18 at 19:22
  • onvif is more than just a stream, you can control the camera (move it) and do even more things. rtsp is just a stream. Try with something like: `rtsp:// ip:port/user=admin_password=pass_channel=1_stream=0.sdp` or `rtsp://admin:pass@ip:port/11` – api55 Sep 04 '18 at 20:07
  • Unfortunately, it's not work. I running this in CLV and in my script. Maybe, perhaps use packeges for onvif? – Nikita Zakoryuchkin Sep 05 '18 at 08:09
  • try to use this link to test your app : rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov . If it doesn't open, the problem is with your opencv app. Else, the problem is with you onvif rtsp link. You can also test your onvif rtsp link with the VLC media player. – LoukMouk Sep 11 '18 at 18:44
  • @LoukMo I checked my stream in VLC - it's worked. And Your stream capturing in my code with out problem. It turns out, the problem is in my stream.. – Nikita Zakoryuchkin Sep 12 '18 at 06:35
  • try to turn off your firewall.. maybe this will help! (: – LoukMouk Sep 12 '18 at 13:38
  • If I understand correctly, when you open the big buck bunny rtsp link in your app, it does work. But when you try to open YOUR rtsp link, it doesn't... The problem is with the link you give. To know what is the good rtsp link to your stream, use the [ONVIF Device Manager](https://sourceforge.net/projects/onvifdm/) and look in the streaming part... you'll find the good rtsp link to the stream of your camera. TLDR: You don't have the good rtsp link. Find the good one. – LoukMouk Sep 12 '18 at 13:52
  • Possible duplicate of [RTSP stream and OpenCV (Python)](https://stackoverflow.com/questions/20891936/rtsp-stream-and-opencv-python) – Ollie Graham Oct 24 '19 at 05:11

0 Answers0