Running rtsp and read QR code at the same time

I’d like to run rtsp and read a bar code at the same time using the RT1062. As documented once the stream () is called, I can’t use the camera anymore. If no one is connected to the rtsp stream, I can’t process images. I have another product I use the has a concept of channels, I add a channel for barcode processing and wala I can use it while not connected and streaming. Can this device do something like this?

Yes, the RTSP library needs to be re-written to support this however. It just does everything in a tight loop.

The code for the whole library is here: openmv/scripts/libraries/rtsp.py at master · openmv/openmv (github.com)

You can copy it and add it to your main.py or put it in another python file and then edit the steam() function to do what you want.

If you wanted to really make the code much better you could replace all the socket calls with uasyncio TCP read/write streams. That would then allow you to have multiple connections.

Kwabena, ok thanks for the update and I’ll check this out.

I was looking at the code and it looks like if the “SETUP” request was for udp, the stream does not work, looks like it’s for tcp only, is this right?

The RTSP protocol uses TCP to setup the connection and then UDP to stream data. This is per the RFC spec.

Gotcha, thanks.