I have problems with the execution of the ip camera through the rtps protocol
import jetson.inference
import jetson.utils
net = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.5)
camera = jetson.utils.videoSource(“rtsp://admin:admin1234@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1”)
display = jetson.utils.videoOutput(“display://0”) # ‘my_video.mp4’ for file
Also you can try disabling the user login on your camera, and seeing if it is an authentication issue.
Alternatively, if you already have the RTSP capture working with your camera through OpenCV, you can see this example for converting the OpenCV buffer to CUDA:
i can open with OPEN CV without problem. I have a IP CAMERA DAHUA
./my-detection.py
[gstreamer] initialized gstreamer, version 1.14.5.0
[gstreamer] gstDecoder – creating decoder for admin:admin1234@192.168.1.108
[gstreamer] gstDecoder – Could not open resource for reading and writing.
[gstreamer] gstDecoder – try manually setting the codec with the --input-codec option
[gstreamer] gstDecoder – failed to create decoder for rtsp://admin:admin1234@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1
Traceback (most recent call last):
File “./my-detection.py”, line 29, in
camera = jetson.utils.videoSource(“rtsp://admin:admin1234@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1”) #csi://0
Exception: jetson.utils – failed to create videoSource device
gst-launch-1.0 uridecodebin uri=“rtsp://admin:admin1234@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1” ! nvoverlaysink
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://admin:admin1234@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source: Could not open resource for reading and writing.
Additional debug info:
gstrtspsrc.c(7469): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source:
Failed to connect. (Generic error)
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …
So as now you can open the stream with gstreamer, you would:
first be sure to get recent version of jetson-inference and jetson-utils, rebuild and reinstall these.
Then, try changing your code to:
camera = jetson.utils.videoSource("rtsp://admin:admin1234@192.168.1.108:554/cam/realmonitor?channel=1&subtype=1", argv=['--input-codec=H264'])
[EDIT: You may also have to create the glDisplay before the rtsp source. In my case it fails to create the glDisplay after the rtsp video source, but succeeds if created before. @dusty_nv, any hint ?]