Add MIP Driver programmatically.

We are developing our plugin and one thing that we want to do is to have metadata saved in recording server.

We have been exploring examples from Github, and in all examples we have instructions how to add MIP driver manually in Management client.

One example is this one:

https://doc.developer.milestonesys.com/html/samples/PluginSamples/DemoDriver/README.html

We would like to develop plugin in a way that this adding of MIP driver is fully automatic for end user.

Can it be done and how?

Hrvoje

The sample you are pointing to is the sample for making a new driver.

There is another sample which is about adding a device (assuming there is already a device and a driver).

Please explore the ConfigAddCameras sample - https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/configaddcameras/readme.html&tree=tree_2.html

Hello Bo,

we need to add metadata to video saved in db. Then we will make search according to metadata that we have inserted.

For example, we have custom AI model that detects boats in harbour. We want to add boat location to recorded wideo. Then we want to search for a boat in specific location within the harbour.

All git examples are saying that we have to create MIP driver, then attach that drivet to existing camera and then we are able to writte metadata (attach metadata to recorded video) using that MIP driver.

Using the example you stated we can not see how to use this new camera as a metadata source.

Best regards,

Hrvoje

image below shows that New camera is added testCamHW but when we open Related Metadata button we can not “connect” this camera(MIP Driver) to our existing camera. Or we are doing something wrong here (that is also have been proven more than once :slight_smile: )

I am sure I get the full picture so if my answer does not fit please bear with me and explain further. (I have a feeling I was far off in my first reply.)

I am guessing you have a regular camera that is recording the video.

If you explore the GPS Metadata Provider sample you will find that this sample can send location metadata, and the metadata can get recorded in the media database so that you can find the data again using the Metadata Playback Viewer sample.

https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/gpsmetadataprovider/readme.html&tree=tree_2.html

https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/metadataplaybackviewer/readme.html&tree=tree_2.html

https://github.com/milestonesys

From your description I envision that you can send the location metadata using the methods from the first sample, read and search the metadata using the methods from the second sample. If you from this get a time you can quickly navigate to that time and retrieve the video from the regular camera.

Your data might not be GPS but something completely different but it is possible for you to utilize your own data format.

Using the MIP Driver as the GPS Metadata Provider sample or creating your own driver in driver framework that submits the same metadata is very similar. I have a feeling that you have tried something completely different that I have no idea what is. I hope my advise makes sense.

Hello,

Yes, we can insert metadata and view it with Metadata viewer, that is not problem.

But as I understand, in order to insert metadata we need to add MIP driver manually. As we see documented in all similar samples: FIRST we need to click on “Accept sessions”, THEN go to Management client, and MANUALLY add MIP driver. THEN we have to CONNECT MANNUALY MIP Driver with existing camera (Cameras - go to Client tab - Related metadata - add MIP driver).

Our question is - can we do all this process programmaticaly, so end
user will not have to go to Management client for this purpose?

We want to achieve following functionality:

1. User will click on the buton.

2. List of cameras is displayed.

3. User will select one camera (metadata will be added to this camera
video stream)

4. Program will add New MIP Driver and Connect selected camera to that
MIP driver.

Hrvoje

It might be just a question of terminology, but what you are talking about is not adding a driver but adding a device. Adding a driver would be the process of adding a dll. The MIP driver based metadata device can be added in the Management Client same way as a camera device (manually as you say). The MIP driver based device can be added using code, this is shown in the ConfigAddCameras sample that I mentioned above.

Once you have both a camera and a metadata device you can in the MC, associate the metadata to the camera. (Camera properties- Client tab- fill Related metadata.) You do this through code using the Configuration API (Rest API, Configuration API SOAP, or the strongly typed VideoOS.Platform.ConfigurationItems classes).

You can see or do this configuration in the Config API Client sample - https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/configapiclient/readme.html&tree=tree_2.html

All what you want to achieve can be done by a MIP SDK based app that uses the VideoOS.Platform.ConfigurationItems classes.

I hope we are getting closer, that I have understood better, and I have explained what you need to develop sufficiently that you can start.

I can add MIP driver based device the same way as in example, but I cannot associate it to the camera because this device is not shown when I try to add Related metadata.

I followed example, created text file which looks like this:

http://192.168.1.105:52123,root,password,616,testCamHw,testCam,RecServName,CamGrp1

So it must be something more to do to have this device in list od metadata devices.

Additionally, when I add MIP driver by following instructions from GPS metadata provider example, I can see it in Related metadata list.

After having added the MIP driver based device you must open the Management Client (MC), the MC only reads configuration at startup, and using the sample to add the device it is not like doing it in he MC itself. This is my first suspicion. Please try to restart the MC if you already have it open. Does it make a difference?

No, it is same as before.

No, my first guess was not right, it doesn’t explain what you observe.

After having added the device using the ConfigAddCameras sample the metadata device is added but is disabled. So you need an additional step. In the MC on the Recording Server there is a “Hide disabled devices”, make sure you untick this option, then you can see the metadata device. When you enable the device it be visible when you try to add related metadata.

As with the other configuration steps the enablement of the device can also be done through Configuration API code.

Yes, this looks OK now, I can select it when I uncheck ‘Hide disabled’ option.

But I’m a little bit confused - if I do right-mouse click on my MIP driver, I see popup menu and one of options is ‘Enabled’, which is checked, so I assume that device is enabled.

However, I can add it as Metadata source only if I uncheck ‘Hide disabled’ option, which suggest that device is disabled.

Which one is true? And if it is disabled, how do I enable it?

Hrvoje

When I can see the metadata device, by unticking “hide disabled devices”, then I observe the device icon has a red x and if I right-click I see Enabled but it is without a tick mark, only with a tick mark there is it enabled.

See the difference -

You can enable the device using code..

The problem is that the ConfigAddCamera sample assume that you are adding a hardware device that has one camera device, when we are adding the MIP Driver device that is the GPS Metadata Provider sample this isn’t the case, we are instead adding a hardware device with one metadata device.

I will illustrate how the sample code can be changed to make it a better fit.

// change this
Camera camera = hardware.CameraFolder.Cameras.First();
camera.Name = cameraName;
camera.Enabled = true;
camera.Save();
// change to this
Metadata metadata=hardware.MetadataFolder.Metadatas.First();
metadata.Name = cameraName;
metadata.Enabled = true;
metadata.Save();

Next step you can use this code as inspiration and add code to put the metadata device as related for the camera.

Hi Bo,

It seams that we have manage to get what we wanted,

Thanks for the assistance

Hrvoje