I was looking through a lot of questions and answers about ONVIF compliant solutions for raspberry pi, but most of them provide incomplete solutions to my problem. I am looking for a way to make the Raspberry Pi Camera (Not an USB camera) into an ONVIF compliant camera which streams out in RTSP when needed.
1 Answers
Here is a similar question on how to implement ONVIF compliant interface that I've already tried to answer, but since in this case I guess you just want the video stream and using gSoap or anything would violate the third party software limitation, here is what I would do:
1) For an ONVIF client to be able to retrieve your stream URL, you need to implement a response to the GetStreamUri ONVIF request - through that you can return the actual RTSP link and if you have some sort of RTSP server running (I guess live555 is the most common choice these days) then the client will continue connecting to the RTSP server and will get the stream. I assume there are some out-of-the-box RTSP streaming solutions for Raspberry Pi so I won't talk about how to setup live555.
2) For the GetStreamUri to work, the client needs to know a profile token for this specific stream. This is why you need to implement the GetProfiles request. I assume since you are writing a solution for an exact use case, just predefine the xml response to this request and with a single profile and a hardcoded token. The GetProfiles request itself does not depend on any input parameters so you should be safe here. The ONVIF client may as well send some authorization headers, but you might for start just as well ignore them and implement authorization when the actual streaming is running. The ONVIF client may as well send a lot of other requests like capabilities etc., but you could ignore those for now. One important request is GetSystemDateAndTime - ONVIF clients query this since the timestamp is used in the authorization token.
What I would do is create a simple C/C++ web server with predefined xml answers for these 3 requests, take a general ONVIF client like ODM (Onvif Device Manager) and try to connect to the camera from it and see what happens, if any other requests are issued that block the flow or not. My guess is that it could actually work with these three in the following order: GetSystemDateAndTime -> GetProfiles -> GetStreamUri. I could be wrong and the client might query something else and not receiving an answer could make it stop from taking any further actions, but I am not sure about this.

- 1
- 1

- 11,636
- 6
- 33
- 71