Streamlining Video Management in PSIM Software with Viinex Middleware

Physical Security Information Management (PSIM) vendors often encounter a problem when implementing their systems: customers who order PSIM solutions often use various Video Management Systems (VMSs) and Network Video Recorders (NVRs) from different vendors. As a result, even in one unified security system, the video data transmitted to the control center has to be collected from various video surveillance systems installed at geographically-distributed sites, such as gas stations or bank offices. The task of integrating the whole stock of video surveillance systems by various manufacturers falls on the PSIM developer, which can be a difficult undertaking. To make matters worse, modern PSIM systems typically provide data in a web interface, while not all VMSs and NVRs are compatible with HTML 5 video streaming.

The requirements for video management typically include:

  • access to live video from different video servers installed at remote sites
  • viewing video archives of remote sites from monitoring and control centers when an incident needs to be investigated
  • the ability to add various video analytics systems independently
  • video archives replication for long-term data storing of important incidents and post-processing within the monitoring center
Whereby, video fragments can be replicated in two ways: on request from the center for a specific time period or automatically triggered by an event, such as when a safety sensor is activated at a remote site, and a video fragment needs to be replicated for alarm verification and not to be lost when a remote site is invaded.

In this context, replication refers to the transfer of required video fragments from one dedicated security level to another. For example, necessary video fragments from various VMSs and NVRs at a video surveillance perimeter (where video at the sites is usually recorded based on a specified time period) can be transferred to another security level, such as the control center, for long-term storage of records initiated “upon alarm or request only” and convenient presentation of these records to various internal corporate clients.

Viinex Middleware

Viinex is an embedded software solution designed to handle all the video management tasks mentioned previously, including video received from various VMSs, NVRs and other video sources. Moreover, Viinex provides open tools  to easily connect necessary video analytics systems when needed.

PSIM developers can use Viinex as a “gateway or proxy” to quickly deploy systems at large installations, even when dealing with several different video surveillance systems. Viinex features a video archives replication system that supports streaming by RTSP, HLS, and WebRTC protocols. Additionally, Viinex is fully compatible with the HTML5 standard, and all its video management tools are available through an HTTP RESTful API.


At the request of our PSIM partners, we have integrated various VMS into Viinex. For more information about the VMS and NVR we’ve integrated, please refer to this page. The middleware now provides all the necessary means for receiving live video streams, as well as video archive records and replication.

Using video streams from video servers is possible in dynamic mode, which means that only video streams currently in use for video playback, analytics, replication, or video recording are retrieved, without unnecessarily increasing traffic load with video streams that are not in use. This mode can be especially advantageous when deploying systems with a large number of IP video cameras and video servers since it is often impossible (and unnecessary) to display video streams from all video sources at the command and control center simultaneously.


Viinex offers a convenient tool for using video analytics applications by allowing a connection of standalone applications which interact with Viinex via “external process” mechanism described in our documentation. This mechanism resembles FastCGI method of interaction between web servers and connected applications. Web server can initiate an external process, manage its life cycle and interconnect with this process via pipe or UNIX domain sockets. Likewise, Viinex can start an external process, manage its life cycle and interact with it using relevant IPC methods.

Viinex provides two key mechanisms of interaction with an external process

  • 1. Exchanging events with analytics applications

An external process can receive events from Viinex, as well as generate events and send them to other objects in Viinex, using a simple mechanism of standard input/output. All events that external process is subscribed to are being serialized in JSON format and Viinex sends them to standard input of this process. The converse is also true – everything that external process records into its standard output must have JSON syntax which Viinex recognizes as this process’ event.

  • 2. Video processing and receiving raw video stream for analytics

Viinex provides API for receiving uncompressed video, and using this API the external process can receive video for performing user analytics. IPC methods used in API realization for receiving raw video stream in Viinex are a combination of shared memory and named pipes in Windows or UNIX domain sockets in Linux which can help process raw video stream between processes on a local machine without copying.

These two mechanisms help to connect video analytics algorithms in the easiest way. Events-based integration with external systems can be fairly simple and done in any programming language; we mean a simple interface for exchanging events (i.e. standard data input/output in JSON format). What happens to analytics results depends on the application – it can be sent back to Viinex in the form of events or stored or further processed using any other method.


We have added both internal and external video archive replication functionality to Viinex. Viinex’s replication mode can be managed or rolling. The fundamental difference between these two modes is that in managed replication mode, the entire replication process is fully controlled through the Viinex API. Each replication task for a managed replication receiver contains instructions for the data source, time interval, and video archive channel to put the data into for further processing by Viinex. This mode is well suited for working with video archives upon request, such as when incidents need to be investigated in the command and control center.

On the other hand, replication in rolling mode is carried out on behalf of the replication source in a remote Viinex instance. This means that the replication sources connected to the replication receiver will send new video data as soon as it appears in the dedicated video archive, without waiting for requests from the replication receiver at the central host. Rolling replication mode is well suited for scenarios in which video records need to be automatically received by monitoring center, such as when there is a risk that the video archive may be destroyed after an intrusion at a remote site, or when the replication process needs to be fully automated when certain events occur. Video records filtered by various incidents can later be viewed at the control center.


Viinex managed replication receiver is an agent that receives replication tasks via API and then performs them. Replicated stream can be connected both by RTSP protocol (when URL, login-password and transport for replication to Viinex are specified) and by proprietary SDK of various VMS if those VMS are already integrated into Viinex.

Here are some examples of requests via API:

  • Receiving VMS video archive timeline for replication evaluation;
  • Transferring video data fragment to Viinex video archive starting from specified time, when Viinex takes video from specified sources according to replication tasks. A key difficulty is to insert an external archive with any random time period into corresponding place in Viinex video archive. Viinex API allows to paste in new video fragments when Viinex archive has free time slots for them, and it also provides functionality to delete already existing video fragments in Viinex video archive if it is necessary. In case of a request to Viinex instance video export or playback within this interval will be uninterrupted, as if there were no pasting together.
  • Replication speed control. Index “speed” in replication task sets data transmission rate of receiving video frames from replication source. For instance, speed index 8 means that Viinex will request speed rate of 8, which will lead to eight-fold increase of replication speed in comparison to normal playback speed (i.e. 10 minutes of video will be transmitted in 1 minute 15 seconds at rate 8). In other words, with this setting one doesn’t have to wait for an hour to send an hour-long video archive streamed by VMS via RTSP protocol. It is possible to set several replication tasks simultaneously to provide maximum replication speed by dividing big video archives into fragments.
  • A request for deletion of data fragment related to specified time period allows data replacement in Viinex (instead of adding new data to existing data) when it is necessary. This allows managing video archives by software that is external to Viinex, which means you can apply any data relevance policy instead of Viinex logic of replacing the oldest data with the new data.


In rolling mode a replication source automatically sends video data from one Viinex instance where this data is consistently created/collected (for example, with live video sources connected directly to Viinex) to the other Viinex instance, where a replication receiver should be deployed.
A replication source connects to its peer replication receiver, “comes to an understanding” on what video data, from the oldest to the newest, is missing at central host, and then automatically sends this data out. Then these steps are repeated until there is no new data to be uploaded to replication receiver, and after that the source interrupts its work.
It is important that it is a replication source that initiates the connection and all data available for the source is copied to replication receiver in control center. It is critical because remote sites may be connected by different communication service providers and their IP addresses may even dynamically change in the Internet at any time.
In case of connection breakdown between automatic replication source and receiver the video archive download will resume after reconnection.

Please note that a replication source processes in the same manner all video streams in video archive it is connected to, and sends this video data to its replication receiver. And one replication receiver, in its turn, can work simultaneously with several sources, which allows collecting video data from several archives in one archive at central host. You can connect replication source to any Viinex video archive that contains consecutive records, and this scheme allows to provide necessary number of levels of video storage.
For example, this mode is essential when there’s a need to additionally save only alarm records at central level of the surveillance system, when video should be automatically sent to central video archive for incident investigation.

Optionally you can change settings of video archives that rolling replication sources are connected to – not only perform standard video archive rerecording on absolute or relative time, but also delete records that have already been replicated to monitoring center right away.

Rolling replication security tools

To set up rolling replication it is necessary to specify replication receiver address and credentials. When replication source connects to a receiver, it always uses some credentials for authentication validation, which are specified in configuration. Evidently, if objects are in the Internet, this data should be transmitted securely and without possibility of spoofing or interception, i.e. credentials should be known only to replication source and receiver.
Additionally, for automatic data transmission you can create a dedicated web server for automatic data transmission and allocate a unique TCP port for this server, especially if replication receiver is opened in the Internet to receive video data from remote Viinex instances.

Solving problem of rolling replication with consecutive numbering of cameras

Sometimes it’s quite difficult to maintain consecutive numeration of cameras at separated sites that need to be unified. That’s why credentials used to connect automatic replication source and receiver include, among other things, names of video sources and objects. Replication receiver uses these credentials to define prefixes which will help identify videos stored at the central host side.

For example, when replication source connects to the receiver and sends video data from local cameras named cam1 and cam2, these video sources will get names site1.cam1 and site1.cam2 in video archive which is connected to replication receiver. And if any other replication source uploads video from cameras also named cam1 and cam2, this source will get names site2.cam1 and site2.cam2 on replication receiver side.
This simple scheme allows using any names for video streams on replication sources side and it does not require maintaining difficult consecutive camera numeration. At the same time it guarantees unique identification of video streams for all replication sources (like cam1, cam2) and prevents mixing video data from various cameras on replication receiver side at the central host.

We have designed all of these modes and mechanisms to ensure that Viinex functions as a middleware solution that provides our partners with convenient tools for video management. Our partners are free to define Viinex usage policies within their applications. We believe that this flexible approach enables our partners to customize Viinex to their specific needs and preferences. By providing a comprehensive set of tools for video management, Viinex allows our partners to deploy the solution in a manner that best suits their requirements. This approach enables our PSIM developer partners to use Viinex for video management on a wide variety of objects, including airports, sea ports, safe city projects and many others.

Leave a Reply