How to add automatically metadata Drivers to cameras

I have a client with 200 preconfig cameras.

I want to send specific metadata to a specific camera.

I understood that in order to do that i need to:

  1. add metadata driver for each camera

  2. add each driver to each camera as Related metadata.

  3. send metadata

i have a few questions:

  1. is there a script to add metadata driver for each camera by camera’s name?

  2. how to send metadata to a specific metadata driver?

  3. are this the right steps?

p.s: i found out how to add existing metadata driver to cameras, but not how to add the new metadata drivers: https://developer.milestonesys.com/s/question/0D50O00003mIPq5SAG/attach-metadata-from-mip-driver-into-camera-using-code?t=1553438200148

What is not clear to me is the metadata sources you have..

Some of the possible options are:

a) Each camera device has a metadata channel.

b) For each camera device you have a metadata device (based on a MIP driver based sample).

c) You have a metadata device (based on a MIP driver based sample) with many channels, each metadata channel logically belongs to one camera.

In case of a the metadata channel is automatically configured by the system as being related to the camera. In case of b and c there is no script and the biggest challenge is to logically understand which camera device and which metadata device channel belongs together. With a naming scheme you might overcome this challenge and in that case you can modify the code snippet you found in the other forum thread to add every metadata channel as related to a camera.

How to send metadata to a specific metadata driver will depend on the implementation of the metadata device. The samples shows this. The BoundingBoxMetadataProvider sample shows a simple device implementation. The MultiChannelMetadataProvider sample shows doing this when having multiple channels.

I think you have the right steps. Note that the part about assigning a metadata channel as related to a camera is only the last step. Developing the actual metadata sources is the first step.

I hope this is a hint for the right direction, please do not hesitate to ask again if my answer is unclear or you would like further information or guidance.

PS. Might be of interest..

https://developer.milestonesys.com/s/article/MIP-SDK-maximum-number-of-metadata-streams-for-a-hardware-device

I am still in the planning stage, i would like to hear your ideas for the best course of action.

The precondition i have are:

  1. The cameras are already register in milestone.

  2. I need to print bounding boxes on the cameras. The bounding boxes are different to each camera and change every second.

A script i made will send this metadata, its input is the camera id and the output are bounding boxes for that camera. i already found a way to get the cameras id.

From now i need to do everything as effectively as possible.

what i think i understood:

by using the code in MultiChannelMetadataProvider sample:

var hardwareDefinition = new HardwareDefinition(

      PhysicalAddress.Parse("001122334466"),

      "MetadataProvider")

    {

      Firmware = "v10",

      MetadataDevices =

      {

        MetadataDeviceDefintion.CreateBoundingBoxDevice(),

        MetadataDeviceDefintion.CreateGpsDevice(),

        CreateNonStandardDevice()

      }

    };

I can change it to:

MetadataDevices =

      {

        MetadataDeviceDefintion.CreateBoundingBoxDevice(),

MetadataDeviceDefintion.CreateBoundingBoxDevice(),

MetadataDeviceDefintion.CreateBoundingBoxDevice(),

} *number of cameras listed in milestone

this will create MIP DRIVER with (num of cameras) channels.

then i can use the code snippet i attached to add them as Related metadata.

I am not sure how i should send the metadata.

According to sample BoundingBoxMetadataProvider:

_metadataProviderService.Init(52123, “password”, hardwareDefinition);

_metadataProviderChannel = _metadataProviderService.CreateMetadataProvider(1);

var metadata = new MetadataStream{…boxes…}

   var result = \_metadataProviderChannel.QueueMetadata(metadata, DateTime.UtcNow);

But it send metadata based on hardwareDefinition, so how can i send metadata to only 1 channel inside the hardwareDefinition?

I think that the sample would be changed like..

_boundingBoxProviderChannel = _metadataProviderService.CreateMetadataProvider(1);
 
 - would become part of a loop
_boundingBoxProviderChannel[i] = _metadataProviderService.CreateMetadataProvider(i+1);
 
 - and later in your code it would be used something like
var result = _boundingBoxProviderChannel[x].QueueMetadata(metadata, DateTime.UtcNow);

This does not tell you how to best have the array of metadata channels best mapped to the existing cameras.

i have 1 problem with this idea.

Would i be able to add them all with 1 “add hardware” in the management client?

According to the Component Integration Sample - Bounding Box Metadata Provider in https://doc.developer.milestonesys.com/html/index.html:

  • Start the add hardware wizard
  • Choose Manual
  • Add username and password to the search list: “root”, “password”
  • Select to use the “MIP Driver” under “Milestone”
  • Enter IP address of the machine this sample is running on, and port 52123

In the add hardware i can only give 1 port each time, if i create them by (i+1) i will have them in different ports.

i cant add 200 different mip drivers like this…

is there a script to do that?

Using the methods of the MultiChannelMetadataProvider; what you get is one hardware device using one url and port. This one hardware device has multiple metadata devices (or channels). But still it is only one hardware device to add in the Management Client or by use of Configuration API.

If you choose to simply make many devices of the BoundingBoxMetadataProvider kind, with only one metadata channel/device each, you would have to run the “add hardware” once for each hardware device.

I hope this makes sense.

Thanks, i think i got it.

i will now describe my complete system, i will mention that at this point our system send alerts as AnalyticEvents by xml, our goal is to send the bounding boxes following this event in metadata.

sample: a man is walking in front of the camera.

Desired result:

  1. an alarm sent by AnalyticEvent.

  2. Bounding boxes following him walking for 6 sec, sent by metadata.

System overview:

Client side:

Input: an event (person walking)

Output:

  1. Send Alarm as analytic event to milestone server port 9090

  2. Send metadata as xml to milestone server port XXXX.

Server side:

  1. Get number and IDs of cameras listed in milestone

  2. add X metadata channels using MultiChannelMetadataProvider sample, like you suggested. metadata channel name will be the camera ID:

  1. _boundingBoxProviderChannel[i] = _metadataProviderService.CreateMetadataProvider(i+1);
  1. Listen on XXXX port for metadata as xml, turn this xml into onvif metadata and send it to Mileston:

_boundingBoxProviderChannel[x].QueueMetadata(metadata, DateTime.UtcNow);

Does that sounds right?

Hi boaz,

Did you verify your idea successfully ? I am also have same considered thing