Description
Unable to connect to external camera using rtsp protocol
Environment
I am using latest version of the Xavier NX.
Ip-Camera model: Reolink RLC-410-5MP
Steps To Reproduce
I am following Jetson AI Fundamentals - S3E4 - Object Detection Inference - YouTube. When using usb camera everything is fine. I need to to connect a ip-camera and updated the my-detection.py like this below. When executed got the following error.
TRT] detectNet -- maximum bounding boxes: 100
[TRT] detectNet -- loaded 91 class info entries
[TRT] detectNet -- number of object classes: 91
[gstreamer] initialized gstreamer, version 1.14.5.0
[gstreamer] gstDecoder -- creating decoder for admin:reolink@192.168.50.54
[gstreamer] gstDecoder -- failed to discover stream info
[gstreamer] gstDecoder -- try manually setting the codec with the --input-codec option
[gstreamer] gstDecoder -- failed to create decoder for rtsp://admin:reolink@192.168.50.54:554/h264Preview_01_sub
Traceback (most recent call last):
File "./my-detection.py", line 6, in <module>
camera = jetson.utils.videoSource("rtsp://admin:reolink@192.168.50.54:554/h264Preview_01_sub") # '/dev/video0' for V4L2
Exception: jetson.utils -- failed to create videoSource device
Looks like it needs codec. I am not sure how to pass the codec to the program. Any help is appreciated.
import jetson.inference
import jetson.utils
net = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.5)
camera = jetson.utils.videoSource("/dev/video0") # '/dev/video0' for V4L2
# camera = jetson.utils.videoSource("rtsp://admin:password@192.168.50.54:554/h264Preview_01_sub") # '/dev/video0' for V4L2
display = jetson.utils.videoOutput() # 'my_video.mp4' for file
while display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img)
display.Render(img)
display.SetStatus("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))