Installing 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
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).
Raised Events: Barcode Recognized
Supports: Video
Gain
Apply live band filters on audio coming from audio devices.
Raised Events: None
Supports: Audio
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!
Raised Events: Sound Detected, Sound Recognized
Supports: Audio
Live Delay
Adds a delay to live audio and video (useful for sports analysis).
Raised Events: None
Supports: Video, Audio
Weather
Adds a weather status overlay to live video based on your location. Raise events if the weather changes - for example if a storm is coming or if wind gusts or temperature limits are exceeded. You can customise the layout and display mode of the weather data from just an icon to full detail.
Full information:
{icon}{main}: {description} Wind: {wind} Gust: {gust} Temp: {temp} Feels Like: {feelsLike} Humidity: {humidity} UVI: {uvi}
Icon Only:
{icon}
One Line:
{main} {wind} {temp} {humidity} UVI: {uvi}
Raised Events: High Temp, Gust, Status
Supports: Video
Configuring Plugins
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.
Some plugins raise events that you can attach actions to. The Weather plugin raises a Gust event when gusting winds exceed a specified value (configurable in the plugin). You can add an action via the Actions tab when you edit the camera to respond to this - to sound an alarm or start recording for example. You just select the plugin name: event - ie Weather: Gust in the If select box and assign an action.
Create your own 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 for Developers:
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.