I want to transfer RTSP stream from an IP Camera to python, but I can't get it to work with python.
I can view the stream with either VLC or the camera website. I used the following code:
import os
import cv2
import urllib.request
import requests
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"]="rtsp_transport;udp"
#print("Before URL")
#print("After URL")
adr = 'rtsp://192.168.100.86:554'
try:
stream = cv2.VideoCapture(adr)
except Exception as g:
print("no stream")
while True:
img_res = stream.read()
#print('About to show frame of Video.')
try:
cv2.imshow("Capturing",img_res)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
except Exception as e:
print(e)
Knowing that nmap command shows the camera has these open ports :
Host is up (0.016s latency).
Not shown: 996 closed ports
PORT STATE SERVICE
80/tcp open http
554/tcp open rtsp
7103/tcp open unknown
8001/tcp open vcom-tunnel
When I run the above code with either rtsp:554 or http:80 I get the following error:
Expected cv::UMat for argument 'mat'