How Viinex middleware helps PSIM software managing video

There is a certain problem that PSIM vendors face when implementing security management systems: customers ordering PSIM solutions use various video surveillance systems from different vendors. So much so that quite often even in a unified security system the video data transmitted to control center has to be collected from various video surveillance systems installed at geographically distributed sites such as gas stations or bank offices and etc.

Thus a difficult task of integrating the whole stock of video servers by various manufacturers lies on PSIM developer. To make matters worse, all modern PSIM systems usually provide data in a web interface, while not all video surveillance systems are compatible with HTML 5 video streaming.

In regards to video management requirements usually come down to the following:

  • access to live video from different video servers installed at remote sites, if it is necessary to control emergency situations in real time;
  • viewing video archives of remote sites from monitoring and control centers, when an incident has to be investigated;
  • possibility of adding various video analytics systems independently;
  • video archives replication for data storing and postprocessing within the monitoring center:

- on request from a center in relation to a certain time period;
- automatically on event (e.g. when a safety sensor is activated at a remote site and video segment has to be replicated for alarm verification and video record storage)

By replication in this case we mean transferring of necessary video fragments from one system to the other. For instance, transferring of necessary video fragments from various video systems at video surveillance perimeter (whereas video at the sites is recorded based on specified time period) to other perimeter such as control center, for long-term storage of records initiated “upon alarm” and convenient presentation of these records to various internal corporate clients.


Viinex is an embedded software for all video management tasks described above, including video received from various VMS and video sources. Besides, Viinex offers open tools for connecting necessary video analytics systems when needed.

Viinex allows PSIM developers to quickly deploy systems at large installations even with several different video surveillance systems, using Viinex as a gateway that has a video archives replication system with a possibility of video streaming by RTSP, HLS and WebRTC protocols. Viinex is fully compatible with HTML5 standard and all video management tools are available via HTTP RESTful API.


At our PSIM partners requests we have integrated various VMS in Viinex (more information about it here), and now our product provides all means for receiving live video streams as well as video archive streaming and replication.

Using video streams from video servers is possible in dynamic mode (i.e. only video streams that are in use at the moment – for video playback or streaming, analytics, replication or video recording), without increasing traffic load with video streams which in fact are not used. This principle is reflected in Viinex licensing model, where connection of every channel of integrated VMS is licensed separately, while video streams licensing model remains the same – only actually used video streams are licensed, as well as when connecting video streams from ordinary IP video cameras to Viinex.
This model can be especially advantageous when deploying systems with a large number of IP video cameras and video servers, because it is often impossible (and there’s no need) to simultaneously display video streams from all video sources at command and control center.
Apart from receiving video streams from IP video cameras by standard protocols and video streams from various VMS that we have integrated using SDK provided by respective vendors, our partners can also integrate external video sources using a plug-in that we have posted on Github under MIT license.


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

  • 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.

  • Video processing and receiving raw video stream for analytics

Viinex provides API for receiving uncompressed video from raw video sources. 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.


Alongside external VMS integration we have added to Viinex both owned and external video archives replication functionality. Replication mode in Viinex can be managed or rolling.
Fundamental difference between these two modes is as follows. Operated replication mode means that the whole replication process is fully controlled via Viinex API. Every replication task for a managed replication receiver contains instructions as to where video data should be taken from, what time interval it should relate to and what video archive channel this data should be put into for further processing by Viinex.
Managed replication mode is well suited for working with video archive upon request, when incidents should be investigated in command and control center.
Replication in rolling mode, on the contrary, is carried out on behalf of replication source in some remote Viinex instance. This means that replication sources connected to replication receiver will send new video data as soon as it appears in video archives, without waiting for requests from replication receiver at central host.
Rolling replication mode is well suited for events when it is necessary to automatically receive video records, like when there is a risk that video archive may be destroyed after an intrusion at remote site and/or the replication process has to be fully automated when some kind of events occur. Later video records filtered by various incidents can be viewed at control center.


Viinex managed replication receiver is in fact 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 in 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 second 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 develop all these schemes and mechanisms in such a way that Viinex as a middleware could provide our partners with convenient tools for video management, while partners are free to define Viinex usage policy in their applications. Such an approach allows our PSIM developer partners to use Viinex for video management on wide variety of objects, including airports, sea ports and city traffic safety systems.

Leave a Reply