The Smart Privacy Shield (SPS) is a proof of concept. It is a tool that allows users to capture their screen or certain application windows of it and apply processing steps to it. The goal of the application is to increase the privacy and prevent data leaks when sharing a screen in an online conference.
The SPS tool can be seen as an intermediary application that is in charge of protecting a captured screen feed before it gets shared in an online meeting. The tool itself handles all of the capturing and eventually generates a new window with the processed video feed. This output window is then intended to be shared in the online meeting software.
The SPS tool is built upon a video processing pipeline that is powered by the GStreamer library. The GUI is created using the GTK library.
The SPS tool is based on a modular plugin architecture. A SPS plugin can provide one or several (custom) GStreamer plugins. The GStreamer plugins are the parts that are incorporated into the processing pipeline and perform the actual work on the video. In addition SPS plugins also provide GUI widgets to configure the (custom) GStreamer plugin it provides.
An example on how to implement a SPS plugin can be found looking at the SPS base plugin in the /sps-plugin/base
directory. Examples on how to implement GStreamer plugins can be found in the GStreamer documentation.
The tool can be built from source using the cmake tool.
- Install the dependencies
brew install cmake
brew install gstreamer gst-plugins-base gst-plugins-good
brew install gtk+3
brew install glib
brew install opencv
brew install onnxruntime
- From the root project folder, create build folder
mkdir build && cd build
- Create the cmake project
cmake ..
(NOTE: Use-DCMAKE_BUILD_TYPE=Release
for release builds) - Build the project
make
- In order to build a bundled application, run
cpack
- The resulting application bundle can be moved to the application folder and launched from there
Due to the lack of some required binaries, the installation on windows is somewhat more involved
- Install the cerbero build tool for GStreamer
- Install python
- Install MinGW with MSYS (NOTE: Not MSYS2, c.f. https://gstreamer.freedesktop.org/documentation/installing/building-from-source-using-cerbero.html?gi-language=c#install-msysmingw)
- Install MSYS2 as well (c.f. https://www.msys2.org)
- Install Visual Studio 2015 or newer
- Install CMake
- Build custom GStreamer installer
- Open MinGW shell (typically by executing
C:\MinGW\msys\1.0\msys.bat
) - Change to C directory
cd /c/
- Clone Cerbero repository
git clone https://gitlab.freedesktop.org/gstreamer/cerbero && cd cerbero
- Checkout Merge Request enabling gtk sink
git fetch "https://gitlab.freedesktop.org/nirbheek/cerbero.git" 'gtksink'
git checkout -b 'nirbheek/cerbero-gtksink' FETCH_HEAD
git rebase main
- Resolve conflicts
git checkout main -- recipes/cairo.recipe && git add recipes/cairo.recipe
- In case there are any other conflicts, resolve them manually
- Bootstrap cerbero
./cerbero-uninstalled bootstrap
- Build the installer
./cerbero-uninstalled -c config/win64.cbc -v visualstudio package gstreamer-1.0
- Once finished, the process will print the path of the created installer. Run this installer. (NOTE: Make sure to choose the "complete" installation option)
- Open MinGW shell (typically by executing
- Build GTK3 from source
- Open a
x64 Native Tools Command Prompt for VS 20XX
shell - Change to C directory
cd C:/
- Create a build directory
mkdir gtk-build && cd gtk-build && mkdir github && cd github
- Clone repo
git clone https://github.com/wingtk/gvsbuild.git && cd gvsbuild
- Build GTK3
python .\build.py build -p=x64 --vs-ver=16 --msys-dir=C:\msys64 --gtk3-ver=3.24 gtk3
- Copy your built binaries to the root folder
move C:/gtk-build/gtk/x64/release C:/gtk
- Open a
- Install CppWinRT
- Download the raw nuget package using the URL
https://www.nuget.org/api/v2/package/Microsoft.Windows.CppWinRT/
- Change the file ending to
.zip
and extract the archive - Navigate to the
/bin
folder and copy thecppwinrt.exe
file somewhere convenient
- Download the raw nuget package using the URL
- Install ONNXRuntime
- Download the raw nuget package using the URL
https://www.nuget.org/api/v2/package/Microsoft.ML.OnnxRuntime/
- Change the file ending to
.zip
and extract the archive - Move the extracted folder somewhere convenient
- Download the raw nuget package using the URL
- Install OpenCV
- Go to the OpenCV website
- Download the prebuild binaries for Windows
- Run the .exe file and place the resulting
opencv
folder inside yourC:/Program Files (x86)
directory.
- Build the actual SPS application
- Open a
x64 Native Tools Command Prompt for VS 20XX
shell - Inside the root SPS project folder, create build folder
mkdir build && cd build
- Create the cmake project (NOTE: Use forward slashes!, use
-DCMAKE_BUILD_TYPE=Release
for release builds)
cmake ^ -DGLIB_COMPILE_RESOURCES=<GTK_INSTALL_DIR>/bin/glib-compile-resources.exe ^ -DGLIB_COMPILE_SCHEMAS=<GTK_INSTALL_DIR>/bin/glib-compile-schemas.exe ^ -DCPPWINRT_PATH=<CPP_WINRT_EXE_LOCATION> ^ -DONNXRUNTIME_PATH=<ONNXRUNTIME_FOLDER_PATH> ^ ..
- Build the project
cmake --build .
(NOTE: Usecmake --build . --config Release
for release builds) - Run
cpack
to create an executable installer - Run the installer to install the SPS tool
- Open a
- Install the dependencies
apt-get install cmake gcc git wget tar
apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
apt-get install gtk+3
apt-get install libopencv-dev
apt-get install libonnx-dev
- Build OpenCV dependencies
mkdir -p /tmp/opencv && cd /tmp/opencv
git clone --recursive https://github.com/opencv/opencv.git .
mkdir build && cd build
cmake -DBUILD_LIST=imgcodecs,highgui -DBUILD_opencv_world=ON -DCMAKE_BUILD_TYPE=Release ..
make install
- Build ONNXRuntime dependecies
wget https://github.com/microsoft/onnxruntime/releases/download/v1.9.0/onnxruntime-linux-x64-1.9.0.tgz
tar -zxvf onnxruntime-linux-x64-1.9.0.tgz
mkdir -p /usr/local/include/onnxruntime/core/session
cp onnxruntime-linux-x64-1.9.0/include/* /usr/local/include/onnxruntime/core/session
cp onnxruntime-linux-x64-1.9.0/lib/* /usr/local/lib
- From the root project folder, create build folder
mkdir build && cd build
- Create the cmake project
cmake ..
(NOTE: Use-DCMAKE_BUILD_TYPE=Release
for release builds) - Build the project
make
- In order to build a bundled application, run
cpack
- To install the packaged application run
dpkg -i <path_to_bundle>.deb
When the application is started, you are presented with a basic user interface. In the center, all your selected capturing sources will be displayed. At the beginning, there is no capture source. To add a source, press the button the bottom left-hand corner.
A new dialog will show up. Select either a whole screen or a specific application from the dropdown and continue. The selected source will now be shown in the source list in the center of the window.
Once at least one source is added, you can start the processing by clicking the button in the bottom right-hand corner.
To configure a source, click on the "edit" button in its row. To remove a source, click the "delete" button instead.
If you click the "edit" button, a new dialog will open. This dialog allows you to configure which processing should be applied to the selected source.
You can add preprocessor, detector, and/or postprocessor elements. To do this, press the "+" button next to the respective category. To remove an element again, select it from the list and click the "-" button. To configure an element, select it from the list. This will show the element's settings on the right side of the dialog.
Preprocessors either alter frames before they are further processed or attach additional metadata to them. Preprocessors could for example downscale the captured video to a lower resolution or convert the stream to black and white.
Simple preprocessor that analyzes wether a frame has a certain amount of changed pixels compared to its preceding frame. If a threshold is exceeded, it will add metadata to the frame that states that the frame has changed. It also add information on the regions in the frame that have changed. This metadata is can be used by detector elements to prevent processing of unchanged fra
The threshold (in percent) can be set by the user.
Detector elements are responsible for generating detections of privacy-critical areas in a frame. How they come up with those detections depends entirely on the element itself and is not restricted in any way. Detectors could for example use manual definition of regions, exploit computer vision techniques or use system APIs to come up with the detections. Other methods could be possible too as long as they return the detections in the standardized format. Detectors usually display a list of detection labels they produce. This can be used as a reference when configuring postprocessor elements. The detection labels are always prefixed by the prefix specified in the element. For example, if a detector with prefix example
produces the label file
, the resulting label will be example:file
. The prefix can be changed by the user.
This is a basic detector that allows the user to configure privacy-critical regions manually. The region can be specified by hand using the x and y coordinates as well as the width and height. One can also use the selection button at the bottom to bring up a dialog where one can select the region on the screen using drag and drop. Note, that this feature is only available once the pipeline was started.
This detector uses an object detection model to identify regions in the video frames. To prime this detector, the detection model has to be selected. The model is typically packaged with the application.
On macOS, open the app bundle by right-clicking on it. Navigate to /Resources/plugins/spsbase/share
. You will find the model with a .onnx
file ending in there.
On Windows, navigate to the installation folder of the application (typically C:/Program Files/smart-privacy-shield XXX
). Then, navigate to plugins/spsbase/share
. You will find the model with a .onnx
file ending in there.
Note that if no model is selected, this element will prevent the processing of the pipeline!
The window analyzer uses the system's window manager to get information about the location of application windows and report them as detections. This detector should only be used when the source captures a full screen opposed to a single application window.
The user should select the screen corresponding to the source's captured screen from the drop-down menu.
Postprocessors are in charge of applying the actual video processing to hide privacy-critical regions from the final output. For example, they could blur selected detections so that they are not readable in the final output
This postprocessor allows the user to obfuscate selected detections in the final video output.
The user can select an obfuscation type (i.e. masking mode) from the dropdown menu. This determines how the detections are handled.
To select which detections should be processed, the user can enter a list of labels. Labels use prefix matching. This means that if the label example
is entered, it will match all detections of type example:XXXXXX
. This can be useful to select all detections of a specific detector. In the case of the window analyzer, it can also be used to select all windows of a certain application.
One of the core novelties of the SPS tool is the use object detection to detect privacy-critical areas. The object detection element uses the ONNXRuntime to perform inference on object detection models. The detection models have to be created using the YOLO v5 architecture.
In order to train a custom object detection model, one can follow the explanation on the YOLO v5 github page. It does not matter which type of network (i.e. YOLOv5s, YOLOv5m, etc.) is used. It also does not matter which image dimensions are used, as the detector adjust automatically.
To create a dataset, the Data Generator, created with this tool, can be used. It can also be found on github.
Once the model is trained, it has to be converted into the ONNX format. This can also be done using the YOLO v5 tool suite. For a better user experience, one can add special metadata to the ONNX model containing the actual labels of the dataset. This can be done by adding a list of strings as metadata using the key "labels". The detection element will try to extract these labels. Instead of reporting the detected classes as numbers, it will then return the label at the corresponding index.