Image retrieval once recording started

Hi all,

We are trying to implement a simple protocol integration using python, here is what we need to achieve:

  1. Subscribe to CameraDeviceStatus to recording started ( making use of the existing default Rule, to start recording when motion is detected). We were able to get the device status once it started recording and when stopped recording.

  2. Retrieve image every second once the recording started until recording stopped

  3. Once the image has been retrieved, we’ll process it to identify for violations

  4. We then trigger Analytics Events with bounding boxes etc and create an alarm

  5. These images related to the alarms will then be visible into Smart Client

Please point out any related examples per step if possible.

QUESTIONS:

a) Is it correct to subscribe the camera device status to detect the motion?

b) When using GetStatus, we can set the timeout, in the SatusDemoConsole example, there is a sleep also to delay the calling of GetStatus. Should the delay still needed even with the timeout set?

c) To retrieve images while recording, what implemention is suitable for this step? via ImageServer protocol? JPEGGetLive? JPEGGetAt?

d) We installed XProtect Free Version, Alarm tab is not present in Smart Client page, did i miss something?

Thanks

A)

Yes.

B)

The sleep should not be needed. I will request that the sample is changed.

C)

If you were to retrieve video I would go with the Image Server protocol, if you retrieve the raw video data you make sure the server does not transcode, which could potentially overload the server. In a setup using h264 or h265 you could do this and process the key-frame, normally that would give you a frame for each second (depending on camera setup).

D)

If you missed something it is that the XProtect Essential+ does not include the Alarm Manager, for that you need a better product. (XProtect Express+, XProtect Professional+, XProtect Expert, XProtect Corporate) You might be able to sign up as a partner and get a test version. https://www.milestonesys.com/partners/become-a-partner/technology-partner/

Thanks for the reply,

Regarding point C:

We wanted to make analysis when the camera starts recording, you mean we will retrieve a live raw video from the image server then process the key-frame?

I’m now starting to connect to ImageServer using python socket (from linux , my dev computer), however it takes forever to receive a response from it. I saw this related question, the connection was successful, however it wasn’t resolved yet:

https://developer.milestonesys.com/s/question/0D53X00009lMw82SAC/how-to-send-xml-request-from-a-client-to-server-over-a-network-connection-using-the-tcpip-protocol-in-python

It has connection to the ImageServer because when I ran netstat in the host server, i can see an ESTABLISHED connection on 7563 to my dev machine IP.

Somehow, the client is not receiving any response from the server.

When i run the LoginDotNetSample directly on the server, it works fine.

However, I tried converting the same function to connect to ImageServer using python and run it directly on the server, i encountered this error:

Exception: [WinError 10054] An existing connection was forcibly closed by the remote host

I noticed that after it runs socket.send() function, the tcp connection gets disconnected hence the error.

Firewalls were turned off

I ran netstat and found the 0.0.0.0:7563 is listening

I tried using, ‘localhost’, ‘0.0.0.0’, and ‘127.0.0.1’, or the IP itself

The recording Server service is running, and there is an ESTABLISHED connection to local IP and port 7563

Please advise

UPDATE 1

The receiving of messages occurred after I added the end header (\r\n\r\n) at the end of the string to be sent. I noticed that the response from the server also included the end header (\r\n\r\n). However, the last call which expected that the response will be blank due to the end header present from the previous call, it gets stuck again.

After checking the tcp connections, after receiving the end header from the server, looks like the connection is still up.

Will the tcp connection to the server remains connected after sending the response with end header?

I handled the response when it already includes the end of header, therefore the expected response from ImageServer was received.

Therefore, i was able to connect now to ImageServer Protocol.

My next concern is how to retrieve the image frame for each second when the recording is True.

Please advise

When you get data, not transcoded to Jpeg, the format is the The GenericByteData format, read about it here - https://doc.developer.milestonesys.com/html/index.html?base=mipgenericbytedata/main.html&tree=tree_3.html

To retrieve a GOP you use the “goto” instruction - https://doc.developer.milestonesys.com/html/index.html?base=reference/protocols/imageserver_request_response.html&tree=tree_3.html

Most often the setup is that cameras are asked to deliver h264 or h265 with a GOP length of 1 second. However, you will have to analyze the video data to ensure this is so.

If the GOP length is one second you can extract the first frame and then get the next GOP by using a “next” instruction on the Image Server protocol.