I’m trying to connect a Axis network camera with Jetson xavier using cv2.VideoCapture() , but I get the following error and cannot connect.
How can I get connected?
On my other Ubuntu PC, I was able to connect with the same program.
[tcp @ 0x28bb6cd0] Port missing in uri
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module source reported: Could not resolve server name.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
The program is as follows:
from threading import Thread
import cv2
import time
class VideoScreenshot(object):
def __init__(self, src=0):
self.capture = cv2.VideoCapture(src)
# Take screenshot every x seconds
self.screenshot_interval = 1
# Default resolutions of the frame are obtained (system dependent)
self.frame_width = int(self.capture.get(3))
self.frame_height = int(self.capture.get(4))
# Start the thread to read frames from the video stream
self.thread = Thread(target=self.update, args=())
self.thread.daemon = True
self.thread.start()
def update(self):
# Read the next frame from the stream in a different thread
while True:
if self.capture.isOpened():
(self.status, self.frame) = self.capture.read()
def show_frame(self):
# Display frames in main program
if self.status:
cv2.imshow('frame', self.frame)
# Press Q on keyboard to stop recording
key = cv2.waitKey(1)
if key == ord('q'):
self.capture.release()
cv2.destroyAllWindows()
exit(1)
if name == ‘main’:
stream_link = 'http://root:password@192.xxx.x.xx/mjpg/1/video.mjpg?resolution=1920x1080'
video_stream_widget = VideoScreenshot(stream_link)
while True:
try:
video_stream_widget.show_frame()
except AttributeError:
pass
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
Also, when the stream link is rtsp, it connects to the camera, but there is a huge delay, so I would like to use htttp.