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

**URL:** <https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512>\
**Category:** Jetson Nano\
**Tags:** rtsp\
**Created:** [March 27, 2023, 4:55am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512 "2023-03-27T04:55:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoshuakaleb049](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yoshuakaleb049](https://forums.developer.nvidia.com/u/yoshuakaleb049)\
**Post date:** [March 27, 2023, 4:55am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/1 "2023-03-27T04:55:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [March 27, 2023, 6:49am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/3 "2023-03-27T06:49:13Z")

</div>

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

> [@Jetson Nano FAQ](https://forums.developer.nvidia.com/t/jetson-nano-faq/82953):
>
> Q: What power supply should I use with Jetson Nano Developer Kit? Please refer to these pages on the wiki and forums: [https://elinux.org/Jetson\_Nano#Power\_Supplies](https://elinux.org/Jetson_Nano#Power_Supplies)[Power supply considerations for Jetson Nano Developer Kit](https://forums.developer.nvidia.com/t/power-supply-considerations-for-jetson-nano-developer-kit/71637)Q: My Jetson Nano is with sd card slot. Can I use it to verify secureboot? No. Secureboot is only supported on production module(Jetson Nano with emmc). Q: I have an issue that I need help with - what steps should I take when posting a new topic? Please see this thread - [D…](https://forums.developer.nvidia.com/t/debug-tips-when-you-hit-any-issue-fail-to-boot-keep-reboot-etc/177457)

> 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:

```auto
$ ./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](https://docs.nvidia.com/metropolis/deepstream-archive.html)

---

<div class="post-metadata">

**Author:** ![yoshuakaleb049](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yoshuakaleb049](https://forums.developer.nvidia.com/u/yoshuakaleb049)\
**Post date:** [March 27, 2023, 9:05am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/4 "2023-03-27T09:05:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [March 28, 2023, 1:56am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/5 "2023-03-28T01:56:24Z")

</div>

Hi,  
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](https://forums.developer.nvidia.com/t/gstreamer-tcpserversink-2-3-seconds-latency/183388/5)

---

<div class="post-metadata">

**Author:** ![yoshuakaleb049](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yoshuakaleb049](https://forums.developer.nvidia.com/u/yoshuakaleb049)\
**Post date:** [March 28, 2023, 4:53am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/6 "2023-03-28T04:53:53Z")

</div>

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=192.168.0.101 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.  
Thanks

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [March 28, 2023, 5:01am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/7 "2023-03-28T05:01:43Z")

</div>

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

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

```

or

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

```

---

<div class="post-metadata">

**Author:** ![yoshuakaleb049](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@yoshuakaleb049](https://forums.developer.nvidia.com/u/yoshuakaleb049)\
**Post date:** [March 28, 2023, 5:12am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/8 "2023-03-28T05:12:37Z")

</div>

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/voc.data cfg/yolo-voc.cfg yolo-voc.weights udp://@:5000`  
Or is there an actual way to perform the detection?  
Thanks

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [March 28, 2023, 8:22am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/9 "2023-03-28T08:22:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [April 26, 2023, 2:53am UTC](https://forums.developer.nvidia.com/t/how-to-stream-pi-camera-video-over-rtsp-on-jetson-nano-using-python/247512/11 "2023-04-26T02:53:43Z")

</div>

Closed on April 26, 2023, 2:53am UTC

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