Skip to content

Anonymizer Toolchain

The Anonymizer is a command-line toolchain designed to blur individuals in videos (only person objects at the moment). It supports configurable blur levels and allows for excluding specific individuals from anonymization.

Using the Anonymizer toolchain requires basic Linux knowledge, as it involves running various command-line tools.

Before you begin

  • Ensure that Professional is installed and that you can access the host machine via SSH or locally, from the terminal.

  • Docker will require root privileges. If you are not logged in as the root user, prepend sudo to the docker commands provided in this guide.

The anonymization process takes a video file as input and produces an anonymized video file as output. Let's examine the process in detail.


1. Convert the input video

Some videos use proprietary codecs. Use tools provided by your Video Management System (VMS) to convert and export the video to a portable format. The preferred codec is H.264 with an .mp4 container.

Alternatively, you can use ffmpeg to perform the conversion.

Example command to convert a video using ffmpeg
ffmpeg -i input_video -c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p -x264opts bframes=0 -movflags +faststart -r 10 -an output_video.mp4

2. Run the Indexer

Objects are assigned unique IDs to differentiate and track them. Run the Indexer to generate a debug video where the detected IDs are visible.

Open a terminal or SSH session to the host machine where Professional is installed. Then ensure the Triton Inference Server is running by executing the following command:

cd /opt/u-query && \
docker compose up -d triton

Assuming the input video is located at /home/user1/anonim/in.mp4, run the following command:

1
2
3
4
5
6
7
8
9
docker run --rm --net u-query_default --ipc host -v /home/user1/anonim:/work \
ultinous/u_query_py_indexer_cli:build_dev \
--cvinput /work/in.mp4 \
--prefix anonim \
--triton_host triton \
--triton_port 8001 \
--debug_video \
--out_folder=/work/det \
--no_bg

The indexing process may take several minutes, depending on the size of the input video. Progress information will be displayed in the console.

3. Prepare an exclusion list (optional)

Objects are assigned unique IDs in the debug video. To exclude specific individuals from anonymization, create a text file containing these IDs, with each ID separated by whitespace. For improved readability, it's recommended to place each ID on a new line. For example:

exclude.txt
123
256
789

Save the exclusion file to the location where the input video is located, e.g.:

/home/user1/anonim/exclude.txt

4. Run the Anonymizer

The Anonymizer takes the input video, detection results from the indexing step, and the exclusion list (if any) to generate the anonymized video.

To perform the anonymization step, run the following command:

Info

The --exclude flag is optional. If you don't want to exclude any individuals, omit it from the command.

1
2
3
4
docker run -it -v /home/user1/anonim:/work \
ultinous/u_query_anonim_cli:build_dev \
/work/in.mp4 /work/out.mp4 /work/det \
--exclude /work/exclude.txt 

Once completed, the output video will be located at:

/home/user1/anonim/out.mp4

5. Error handling

In some cases, the output video may contain errors (e.g. some objects not blurred). These can be corrected with a video editing tool, such as Adobe Premiere Pro. See an example tutorial for blurring with it here.