Use RTSP as a source

Trying to run the my detection script using rtsp as a source. Keep getting the Exception: jetson.utils – failed to create gstCamera device error.

#!/usr/bin/python

Copyright © 2019, NVIDIA CORPORATION. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a

copy of this software and associated documentation files (the “Software”),

to deal in the Software without restriction, including without limitation

the rights to use, copy, modify, merge, publish, distribute, sublicense,

and/or sell copies of the Software, and to permit persons to whom the

Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in

all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

DEALINGS IN THE SOFTWARE.

import jetson.inference
import jetson.utils

#net = jetson.inference.detectNet(“ssd-mobilenet-v2”, threshold=0.5)
net = jetson.inference.detectNet(“pednet”, threshold=0.5)
camera = jetson.utils.gstCamera(640, 480, "rtspsrc location=rtsp://IPANDSTUFF latency=0 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=BGRx, width=1920, height=1080 ")
display = jetson.utils.videoOutput(“display://0”) # ‘my_video.mp4’ for file

while display.IsOpen():
img, width, height = camera.CaptureRGBA()
detections = net.Detect(img, width, height)
display.RenderOnce(img, width, height)
display.SetTitle(“Object Detection | Network {:.0f} FPS”.format(net.GetNetworkFPS()))

Hi @vondalej, you should update your script to use the videoSource class if you want to use RTSP:

You can launch detectNet program from RTSP source like so:

detectnet rtsp://<remote-ip>:1234

so replace the camera with video-viewer rtsp://username:password@:1234?

Hi,
Valid URI should look like

rtsp://username:password@192.168.30.142:1234

You may confirm the URI is correct by running a gst-launch-1.0 command:

gst-launch-1.0 uridecodebin uri='rtsp://username:password@192.168.30.142:1234' ! nvoverlaysink