How to stream Pi camera video over rtsp on jetson nano using python

Hello Everyone,

Right now. i am trying to stream raspberry pi camera from other jetson nano and on the other jetson nano to run darknet object detection. Is there a way to stream the video and run darknet on the other jetson nano for detection?
Thank you

You can try to set up RTSP server on the Jetson Nano with raspberry pi camera. Please refer to

Q: Is there any example of running RTSP streaming?

Please try with videotestsrc plugin first to make sure it works. And then you can try the command like:

$ ./test-launch "nvarguscamerasrc ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96"

On the other Jetson Nano, you can run DeepStream SDK to receive/decode RTSP stream and do inferencing. Please refer to the document(6.0.1):
NVIDIA Metropolis Documentation

Hi DaneLLL

Thank you for your kind assistance.
I’m able to run the stream with the commands that you sent. It turns out, the stream has a delay for around 3 seconds. Is there any way to decrease the latency to perform a better inference on jetson nano?

Thank you.

The latency may be from buffering in RTSP. You may try UDP and see if there is less latency. Please refer to test setup in
Gstreamer TCPserversink 2-3 seconds latency - #5 by DaneLLL

Hi DaneLLL

I did try UDP and it works well with latency around 500 milliseconds. Now, i’m trying to stream my pi camera video feeds but it always to show error like this:
$ gst-launch-1.0 videotestsrc is-live=1 ! video/x-raw,width=1280,height=720 ! timeoverlay valignment=4 halignment=1 ! nvvidconv ! ‘nvarguscamerasrc ! video/x-raw(memory:NVMM),width=1280,height=720’ ! tee name=t ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 ! h264parse ! rtph264pay ! udpsink host= port=5000 sync=0 t. ! queue ! nvegltransform ! nveglglessink sync=0

(gst-launch-1.0:11878): GStreamer-CRITICAL **: 11:45:04.360: gst_element_make_from_uri: assertion ‘gst_uri_is_valid (uri)’ failed
WARNING: erroneous pipeline: syntax error

Is there a way to fix this? i’m new with nvidia jetson nano, so i’m really sorry if there’s a ridiculous error.

Please make sure ' ', or " " is used, instead of ‘ ’. Sometimes it is changed to ‘ ’ while copying gstreamer commands. Correct string should be

... ! "video/x-raw(memory:NVMM),width=1280,height=720" ! ...


... ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! ...

Hi, DaneLLL

It Works! thank you so much. Now i’m trying to run darknet object detection on the other jetson nano. Is it possible to run darknet via UDP Stream? I think streaming udp is already part of the functionality of darknet, as in like to run something as:
./darknet detector demo data/ cfg/yolo-voc.cfg yolo-voc.weights udp://@:5000
Or is there an actual way to perform the detection?

This probably needs other users to share experience. We are not sure whether the darknet app supports UDP.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.