RTSP or MJPG inference possible?
SuperMaximus1984 opened this issue · comments
@robmarkcole
Would you be so kind to guide me how to input source of web cam live stream inference on the example of your restapy.py?
I desperately need to run inference on a live video stream using the API. Unfortunately, it's impossible to realize with pure "python detect.py" from the remote host to the server in headless mode. Thus your API example would be of much help.
Thank you!
Yolov5 can process a video stream, checkout their examples. You would not use an API like this for video rate processing, you could sample at say 1/2 frames sec and process, but then there is nothing special about it.
API may be called easier. The problem with online video stream processing is that it needs GUI and cannot work in headless mode (I need to call the function on server from a client). Here I described my problematics, that's why I decided to opt for other solutions like yours:
https://stackoverflow.com/questions/74306074/opencv-running-ip-cam-inference-script-remotely-via-ssh-results-in-could-not-c
My other project might be suitable with some updates https://github.com/robmarkcole/mqtt-camera-streamer
Yes, could be an option, but my task is simpler.
I can sacrifice realtime RTSP processing in favor of processing JPG every 5 seconds.
My camera JPG URL can be analyzed during a set period of time.
The script should be executed as long as camera motion detection is running.
I still think API variant is more suitable.
Could you advise me what to add in restapi.py code to analyze a particular JPG in cycle each 5 seconds?
Also I need to envisage script work termination when camera stops sending motion detection signal.
I'm actually integrating all this into Home Assistant, so HA has sensor that alerts about motion, I can take information from there.
Thanks!
It is not too complicated what you are asking but it is out of scope of this project. I am sure if you search GitHub someone has done it already