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
img_data_len = len(img_data)
data_len = self.__send(rtp_header + jpeg_header + img_data)
if not data_len: break
i += img_data_len
l -= img_data_len
if l: self.__close_socket()
except OSError: self.__close_socket()
def stream(self, image_callback, quality=90): # public
data = self.__tcp__socket.recv(1400)
if data and len(data): self.__parse_rtsp_request(data)
if self.__playing: self.__send_rtp(image_callback, quality)
except OSError: self.__close_tcp_socket()
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!
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.
Right? Thank you for the reply, will see if I can provide more info on this.
A wire shark trace helps of the IP communication.
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:
So I guess, nicla vision just doesn’t have enough space on board to handle it?
Hi, which line of code is it throwing the error on?
Hi, thank you for the reply.
def __valid_tcp_socket(self): # private
if self.__tcp__socket is None:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.__tcp__socket, self.__client_addr = s.accept()
except OSError: self.__tcp__socket = None
return self.__tcp__socket is not None
def __close_tcp_socket(self): # private
self.__tcp__socket = None
def __valid_udp_socket(self): # private
if self.__udp__socket is None:
self.__udp__socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
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
DESCRIBE rtsp://192.168.105.221:554 RTSP/1.0 CSeq: 3
User-Agent: LibVLC/3.0.16 (LIVE555 Streaming Media v2016.11.28)
This works with out any error and the device sent:
3 Content-Type: application/sdp
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
This repeated for about 5 times before I either get a
OSError(12,) or sometimes I get a connection from VLC again
SETUP rtsp://192.168.105.221:554 RTSP/1.0
This also worked I guess, not sure about it though
The device continued to raise
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.
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.
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
This file has been truncated.
# RTSP Video Server
# This example shows off how to stream video over RTSP with your OpenMV Cam.
# You can use a program like VLC to view the video stream by connecting to the
# OpenMV Cam's IP address.
import network, omv, rtsp, sensor, time
# RTP MJPEG streaming works using JPEG images produced by the OV2640/OV5640 camera modules.
# Not all programs (e.g. VLC) implement the full JPEG standard for decoding any JPEG image
# in RTP packets. Images JPEG compressed by the OpenMV Cam internally may not display.
# FFPLAY will correctly handle JPEGs produced by OpenMV software.
sensor.set_pixformat(sensor.JPEG) # Only supported by the OV2640/OV5640.
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) is working perfectly well.
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.
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.
Hi, I’ll see what I can do to update the code for this and get some fixes in this week.
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.
Needs some help getting this fixed.
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
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.
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.
ffplay -rtsp_transport udp rtsp://192.168.xx.xx:554
It connected but unfortunately it was failing after a couple of frames.
Could you please share the example script you’re running? Maybe I could cross check if there’s anything wrong here?
The PR fix is not merged yet.
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?