Motion Detection and Local Decision Making

Motion detection and local decision making at the gateway level.

In complex IOT systems, nowadays it is often the case that we might have requirements that require end-to-end encryption between an edge device and a backend system. However, it might still be interesting to be able to perform some sort of local decision making at the gateway level, be it to save bandwidth, or reduce the latency in the decision-making process.

In this way, Functional ENcryption enables us to overcome the all-or-nothing nature of end-to-end encryption and let us empower the gateways to perform local decision making without leaking more data than strictly necessary for the said decision-making to take place. We specifically target a practical case where we want to detect motion at the gateway level on an encrypted video stream coming from security cameras.


The main objective of the use case is to demonstrate the benefits of Functional Encryption that allows us to comply with complex regulations or requirements, without compromising the functionality of the whole system.


  • Security camera systems that have strict confidentiality and privacy requirements.
  • IOT systems in general, whenever an edge device must send encrypted data through a complex network architecture to a backend, through gateways that could react to the said data, depending on its content.


We use an agile approach, breaking the project into smaller steps and going through a 3-phases cycle for each step (goal-definition, development, testing). This allows us to address issues about hardware, technicals, and Functional ENcryption implementation separately.

Previous work

During the first phase of the project we implemented efficient motion detection on video streams obtained from previously recorded video files. This allowed us to familiarize ourselves with the FFmpeg framework and its API.

A phase of benchmarking and testing of the video detection has allowed us to find ways to optimize the motion detection using less bandwidth than initially.

Current work

Kudelski Security is currently working on the first version of its prototype, which extracts the MPEG motion vectors out of a video stream and performs local decision making at the gateway level to detect motion using the sum of the motion vector of the stream.

Next steps

  • Implement Functional Encryption using the FENTEC library and perform benchmarking to assess its usability in practice.
  • Further refine the motion detection settings, possibly by increasing the pre-processing at the camera level to ease motion detection at the gateway level.


The video processing is CPU intensive and the data Kudelski Security have to process is larger than expected even for a simple video file. Adding the layer of Functional ENcryption on top of it might very well degrade the performance even further.

Furthermore, small objects are more difficult to detect using a naïve motion detection approach and might require further tuning of the motion detection algorithm.