Using Plugins

The easiest way to install plugins is to use the remote web portal. When connected to the web portal click on the Server icon at top left and Plugins under System. Select the plugin you want to use in the drop-down at top-right and click Install.

To install without using the web portal you will need to build the plugins from source and copy the built output to [AgentDVR Directory]/Plugins/PLUGINNAME

To use the plugin, add a device (camera and/or microphone) and edit it. See the Plugins tab in the drop-down at top right. Choose your plugin and click the "..." button to configure it.

Available Plugins

Most advanced video processing is built into Agent DVR, like deepstack AI integration and advanced object tracking and counting detectors. We've written the following plugins you can use in AgentDVR to extend that functionality:

  • Barcodes: Scan pretty much any barcode from a camera (windows only).
  • Gain: Apply live band filters on audio coming from audio devices
  • Listen: Using Machine Learning, take actions when certain sounds are detected, like dogs barking or glass breaking. Choose from over 520 different sounds to listen out for!
  • Live Delay: Adds a delay to live audio and video (useful for sports analysis)
If you are using an audio plugin like Listen on a camera you will need to edit the camera, select the Audio tab and click to configure the microphone. From there you can access the Plugins tab for audio devices. Alternatively you can click the Server Icon, Edit Devices and edit the microphone from that list.

Creating Plugins

Plugins are additional modules you can create and add to Agent to provide additional processing to audio and video. With plugins you can apply effects and overlays realtime on audio and video and raise events and alerts in Agent that the user can perform actions on.

Plugins for Agent DVR are created as .Net Standard 2.0 projects which should run on all platforms. To get started clone our open source plugins at https://github.com/ispysoftware/AgentDVR-Plugins. You will need a recent version of Visual Studio to build them.

We recommend you build the demo plugin first and develop from that. You will need the latest version of Agent installed. Build the demo plugin and copy all the files in the Demo\bin\Debug\netstandard2.0 folder to Agent\Plugins\Demo\. Restart Agent, edit a camera and go to the Plugins tab. Check Enable, Select Demo in the dropdown and click the "..." button to configure it.

The Demo plugin is fully crossplatform compatible and demonstrates most of the functionality you can build with plugins. It applies a live video effect, overlay graphics, live volume control and integration with the Events subsystem in Agent (you can trigger an action when the bouncing rectangle hits the side of the video or crosses a trip wire). See the menu in the plugin to learn how various input controls work.


Plugin Notes:

Configuration: Agent uses a mix of XML, XSD and JSON to store and render settings. Edit the config.xsd file in visual studio by right clicking on it, click "Open With" and choose "XML (Text) Editor with Encoding". Add the fields you need to store. When you have done that generate the c# code for the xsd file by calling (in the same directory): C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\xsd.exe /c config.xsd This will generate a class file you can access from within the code.

Agent stores information on how to render the configuration and update your XML in .json files. Edit the config_en.json file in the json directory. You can have multiple json files here with locales in the filename. Agent will use the users language to load the correspoding json for display in the web ui. There must always be a config_en.json file as a fallback if the users language is not available.

You can add multiple sections to this json file and it will be rendered with tabs in the UI. There are many available controls available here. Take a look at the demo project which displays all the available controls in the tabs and binds the values to the XML. The most important fields are the "bindto" fields which tell Agent which config xml field to update with the rendered HTML controls. Agent takes care of rendering the controls and storing and updating the settings.

You can add an additional property "live": true to the json item entries to have Agent update them immediately without waiting for the OK button to be clicked - which is useful for live tuning of settings.

Where a converter is specified it will use the code in PopulateResponse in Utils.cs to convert the supplied value to a fixed format.

Media Support You can choose to process "video", "audio" or "video,audio". You can hard code the Supports field in Main.cs.

Processing Continuously The plugin is sent every video frame and audio frame decoded from the device. You can analyse these fields or apply processing to them like we do in the demo,

Processing on Motion/ Alert You can process incoming frames when Agent detects motion or alerts. To do this see the ProcessEvent method in the demo plugin. You can then ignore incoming frames and start processing them only when you receive these events.

Custom Events: Agent will call the method GetCustomEvents - you should return a list of strings of custom events that your plugin generates (if any). These events are then able to be selected under Actions in the Agent UI when you edit the device (at the bottom of the If list). To trigger these events add a Result item with the action name and optional MSG, Tag, Filename and AIJSON values set for merging. See the demo project "Rectangle Bounce" example.

Alert, Detect and Tag: To raise an alert or detect event you can add a Result with the eventName "alert", or "detect". To tag an ongoing recording you can add a Result with the eventName "tag" and set Tags to whatever you want.

Calling the API Agent initializes the plugin when the device is enabled and will call the methods SetCameraInfo and/ or SetMicrophoneInfo, passing in the name, object ID and port of the local server. You can use this information to call commands for the device using the API.

Agent also sets the properties AppDataPath and AppPath which you can use for display or locations to save files.

Distribution Created something cool/ useful? Please feel free to share it with us.