# RTSP in Nicla Vision

**URL:** <https://forums.openmv.io/t/rtsp-in-nicla-vision/7884>\
**Category:** Arduino Boards\
**Created:** [January 20, 2023, 8:20am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884 "2023-01-20T08:20:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [January 20, 2023, 8:20am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/1 "2023-01-20T08:20:06Z")

</div>

Will nicla vision be able to run the rtsp example from openmv?

I see that the device is able to connect to my router and I’m able to ping the ip, but cannot get it to start streaming in VLC

I also changed the pixel format to rgb565 but I was expecting to fail at a later stage due to encoding issues? but the rtsp stream function loop seems to be stuck in checking

> <https://github.com/openmv/openmv/blob/master/scripts/libraries/rtsp.py#L214>

The ip that nicla is printing is something like 192.168.xx.xx:554  
Trying to stream in vlc using rtsp://192.168.xx.xx:554  
But it doesn’t seem to be working, I also tried with different wifi routers and mobile hotspots

Did anyone here try streaming rtsp in nicla vision?

Did anyone manage to successfully stream feed via rtsp?

Any help would be much appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [January 23, 2023, 1:02am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/2 "2023-01-23T01:02:17Z")

</div>

Hi, it won’t work on that camera since it only seems to work with JPEGs from the OV5640 camera module. However, you appear to have a different error. Not sure why.

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [January 23, 2023, 6:42am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/3 "2023-01-23T06:42:10Z")

</div>

Right? Thank you for the reply, will see if I can provide more info on this.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [January 23, 2023, 4:56pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/4 "2023-01-23T16:56:35Z")

</div>

A wire shark trace helps of the IP communication.

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [February 8, 2023, 8:52am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/5 "2023-02-08T08:52:52Z")

</div>

Thank you for the suggestion @kwagyeman , I tried tracing it using wire shark and the request is going from vlc to the nicla vision board.

I edited the rtsp module code and added a few debugging statements.

It is throwing an out of memory error, code 12 on this website:  
[https://mpython.readthedocs.io/en/master/library/pythonStd/uerrno.html](https://mpython.readthedocs.io/en/master/library/pythonStd/uerrno.html)

So I guess, nicla vision just doesn’t have enough space on board to handle it?

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 8, 2023, 4:53pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/6 "2023-02-08T16:53:10Z")

</div>

Hi, which line of code is it throwing the error on?

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [February 9, 2023, 8:29am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/7 "2023-02-09T08:29:09Z")

</div>

Hi, thank you for the reply.

> <https://github.com/openmv/openmv/blob/master/scripts/libraries/rtsp.py#L21>

This is where it fails, I printed the exception here and it fails multiple times before finally showing os error 12

I edit the code a bit to see what exactly vlc sends to the board. These are the commands that I found

1. _DESCRIBE rtsp://192.168.105.221:554 RTSP/1.0 CSeq: 3  
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)  
Accept: application/sdp_

This works with out any error and the device sent:

```auto
3 Content-Type: application/sdp
Content-Length: 98

```

1. After this, I got `OSError(98,)` at the checkpoint, which is _Address already in use_ according to [uerrno – System Error Code — mPython board 2.2.2 documentation](https://mpython.readthedocs.io/en/master/library/pythonStd/uerrno.html)

This repeated for about 5 times before I either get a `OSError(12,)` or sometimes I get a connection from VLC again

1. VLC Sent:

```auto
SETUP rtsp://192.168.105.221:554 RTSP/1.0 
CSeq: 0
Transport: RTP/AVP;unicast;client_port=9256-9257

```

This also worked I guess, not sure about it though

1. The device continued to raise` OSError 12` _memory error_ at this point  
I printed the free memory using `gc.mem_free()` and it shows 159808, which I hope is sufficient?

It continued for some time before the VLC raised the error that it’s failing to connect with the message:  
_VLC is unable to open the MRL ‘rtsp://192.168.105.221:554’ Check the log for details._

My guess is the socket continues to be in use even after s.close() ?, not sure about it though.

Any help would be much appreciated.

Thank you!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 9, 2023, 7:56pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/8 "2023-02-09T19:56:38Z")

</div>

What RTSP program are you using to talk to the camera? That’s the easiest for me to use to debug with. I can’t say the example code I wrote is universally spec compliant.

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [February 10, 2023, 12:10pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/9 "2023-02-10T12:10:28Z")

</div>

Hi,

Okay, got it. I saw in one instance the nicla board was sending 400 bad request.

I’m trying to run this example on nicla vision

> <https://github.com/openmv/openmv/blob/master/scripts/examples/08-RPC-Library/36-Web-Servers/rtsp_video_server_wlan.py>

And I’m using VLC media player v3.0.16 to connect with the board

Do you think VLC might be the problem here?

I tried with OpenCV as well to check if it can open the stream and it also failed and made no connection with the board.

Not sure if it helps but the MJPEG streaming example ([https://github.com/openmv/openmv/blob/master/scripts/examples/10-Arduino-Boards/Nicla-Vision/03-WiFi/mjpeg\_streamer.py](https://github.com/openmv/openmv/blob/master/scripts/examples/10-Arduino-Boards/Nicla-Vision/03-WiFi/mjpeg_streamer.py)) is working perfectly well.

Thank you!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 10, 2023, 3:35pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/10 "2023-02-10T15:35:20Z")

</div>

Yeah, I have never got it working with VLC. I don’t get an error though but just a blank image as VLC doesn’t decide the jpegs we send.

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [February 13, 2023, 7:37am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/11 "2023-02-13T07:37:49Z")

</div>

Hi,

Okay, understood.

So, if not VLC, could you please suggest any players which would be able to stream the rtsp cam from openmv.

Not specifically for Nicla Vision board, OpenMV rtsp module compatibility in general.

Thank you!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 13, 2023, 5:50pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/12 "2023-02-13T17:50:53Z")

</div>

Hi, I’ll see what I can do to update the code for this and get some fixes in this week.

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [February 14, 2023, 10:09am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/13 "2023-02-14T10:09:00Z")

</div>

Awesome, thank you!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 15, 2023, 5:15am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/14 "2023-02-15T05:15:48Z")

</div>

Okay, something is broken inside of the WiFi driver. I can’t get sockets to accept connections. Also, they seem to block indefinitely even though there’s a timeout.

This works with the WiFi shield on our other cameras but I guess there’s an issue with the Nicla WiFi.

…

Anyway, the issue is lower than RTSP. The WiFi driver just doesn’t accept socket connections correctly.

@iabdalkader

Needs some help getting this fixed.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 15, 2023, 5:21am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/15 "2023-02-15T05:21:51Z")

</div>

> <https://github.com/openmv/openmv/issues/1750>
>
> While using rtsp\_video\_server\_wlan1.py from example in the OpenMV IDE. I try to …stream video with vlc, but I don’t get any video streaming.
> 
> play\_callback(pathname, session):
> print (“Playing "%s" in session %d” % (pathname, session))
> 
> in the openmv ide terminal, I only see play\_callback output.
> !\[image\](https://user-images.githubusercontent.com/31999621/203728366-1745cde1-6102-4b53-a30e-ba2e54e78599.png)

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 20, 2023, 11:08pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/16 "2023-02-20T23:08:37Z")

</div>

Okay, I have a fix up for UDP streaming mode. [scripts/libraries: Fix RSTP library for the winc. by kwagyeman · Pull Request #1786 · openmv/openmv · GitHub](https://github.com/openmv/openmv/pull/1786)

Once this is merged the development firmware should work well enough.

TCP mode (which is not really used but should work too on principle) needs drivers to be updated.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 20, 2023, 11:11pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/17 "2023-02-20T23:11:24Z")

</div>

[![](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/7/7bacdf1fbd6080487a4ecfdfeb596debd07d586b.jpeg "Arduino Nicla RSTP Video Streaming") ](https://www.youtube.com/watch?v=aObkKRnUfG8)

---

<div class="post-metadata">

**Author:** ![sata](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/sata/32/2662_2.png) [@sata](https://forums.openmv.io/u/sata)\
**Post date:** [February 21, 2023, 10:36am UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/18 "2023-02-21T10:36:07Z")

</div>

hi @kwagyeman ,

This is Amazing!!

Thank you so much for providing the fixes.

I built the latest master branch from openmv and tried the rtsp-wlan example using my nicla board now over wi-fi.

I used:

`ffplay -rtsp_transport udp rtsp://192.168.xx.xx:554`

It connected but unfortunately it was failing after a couple of frames.

It shows:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/f/f2357d4ee494dfc9e7b9444e1e79da9bb74fe61f.png)

Could you please share the example script you’re running? Maybe I could cross check if there’s anything wrong here?

Thank you!

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [February 21, 2023, 3:33pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/19 "2023-02-21T15:33:40Z")

</div>

The PR fix is not merged yet.

---

<div class="post-metadata">

**Author:** ![Eliza](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/eliza/32/2611_2.png) [@Eliza](https://forums.openmv.io/u/Eliza)\
**Post date:** [February 21, 2023, 10:00pm UTC](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884/20 "2023-02-21T22:00:23Z")

</div>

Hi, I would appreciate if someone can help me. How could modified the library rtsp.py? I cant find the file. Am I missing something?

 ![Screenshot 2023-02-21 165143](https://canada1.discourse-cdn.com/flex029/uploads/openmv1/original/2X/d/dddf9d621b4103fe05e160c2c1668990b8a45e44.png)

[Next page](https://forums.openmv.io/t/rtsp-in-nicla-vision/7884.md?page=2)
