Anonymizer Toolchain¶
The Anonymizer is a command-line toolchain designed to blur individuals in videos. 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 U-Query is installed and you can access the host machine via SSH or terminal.
The anonymization process takes a video file as input and produces an anonymized video file as output. The process consists of the following main steps:
- Convert the input video to a portable format
- Run the U-Query Indexer
- Prepare an exclusion list (optional)
- Run the U-Query Anonymizer
- Error correction
Let's examine each step in detail.
1. Convert the Input Video to a Portable Format¶
Some videos may use proprietary codecs. Use tools provided by your Video Management System (VMS) to convert or export the video to a portable format. The preferred codec is H.264 with an MP4 container.
In many cases, you can use ffmpeg
to perform the conversion.
Example command:
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 U-Query Indexer¶
This step detects individuals in the video and generates a "debug video" where the detected person IDs are visible.
First, ensure the Triton Inference Server is running.
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:
docker run --rm --net host --ipc host -v /home/user1/anonim:/work \
ultinous/u_query_py_indexer_cli:build_dev \
--cvinput /work/in.mp4 \
--prefix anonim \
--triton_host localhost \
--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)¶
If certain individuals need to be excluded from anonymization, collect their IDs from the debug video and save them in a text file. Track ids have to be separated by white space, new line is recommended for easier read, eg:
123
256
789
`/home/user1/anonim/exclude.txt`
4. Run the U-Query Anonymizer¶
The U-Query 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:
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 correction¶
In some cases the output video from the anonymization tool can have errors (not blured persons). This errors can be corrected with a video editing tool. One option can be Adobe Premiere Pro. See a tutorial here.