Cv2.videocapture Only Return "port Missing In Uri"
First of all, thank you for your attention. I'm trying to stream with opencv and ip camera, but it only returns '[tcp @ 000001d5fce13580] Port missing in uri'. I have already teste
Solution 1:
RESOLVED
The problem was with my password, for some reason opencv's VideoCapture gets confused when the password contains "#". As I tested it in javacv and VLC and it worked, I had not tested it with another password and wasted a lot of time with it :( But now that I found out I changed the password and it already worked. I hope it helps those who have the same problem to be aware of special password characters .
Solution 2:
If your password contains characters like !"#$%&'()*+,-./:;<=>?@[\]^_{|}~
, then the problem may be with cv2.VideoCapture()
of OpenCV library.
You may try to use imutils
library to solve this problem. That works for me.
from imutils.video import VideoStream
cap = VideoStream(video_src).start()
So your code might look like this:
import numpy as np
import cv2
from imutils.video import VideoStream
defrunCam():
print(cv2.getBuildInformation())
video_src = "rtsp://admin:myPWCam@192.168.1.223:554/Streaming/channels/1/"
cap = VideoStream(video_src).start()
whileTrue:
frame = cap.read()
try:
cv2.resizeWindow('Stream IP Camera OpenCV', 120300, 800)
cv2.imshow('Stream IP Camera OpenCV', frame)
except Exception as ex:
template = "An exception of type {0} occurred. Arguments:\n{1!r}"
message = template.format(type(ex).__name__, ex.args)
print(message)
breakif cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
runCam()
Post a Comment for "Cv2.videocapture Only Return "port Missing In Uri""