blurs faces in video

raviksharma raviksharma Last update: Apr 12, 2024

blurfaces

Tool Description

Blurs faces in video.

sample mode=all, censor-type=gaussianblur
ross.mp4
out.mp4
mode=one, censor-type=pixelation mode=allexcept, censor-type=facemasking
out_one_pixelation_ross.mp4
out.mp4

Installation

  1. Make sure you have Python version 3.10.6 or greater installed

  2. Download the tool's repository using the command:

     git clone [email protected]:raviksharma/blurfaces.git
    
  3. Move to the tool's directory and install the tool

     cd blurfaces
     pip install -r requirements.txt
    

Usage

$ python3 blur_faces.py --help
Usage: blur_faces.py [OPTIONS] IN_VIDEO_FILE

Options:
  --mode [all|one|allexcept]
  --model [hog|cnn]
  --censor-type [gaussianblur|facemasking|pixelation]
  --count INTEGER                 How many times to upsample the image looking
                                  for faces. Higher numbers find smaller
                                  faces.

  --in-face-file TEXT
  --help                          Show this message and exit.

Example

python3 blur_faces.py media/friends.mp4 --mode allexcept --model cnn --censor-type facemasking --in-face-file media/Ross_Geller.jpg

Additional Information

  • originally developed for Bellingcat Oct 2022 Hackathon
  • uses face_recognition for face detection
  • uses ffmpeg for audio and video processing
  • tool is not perfect; should be used with other manual editing before final publish
  • next steps
    • smooth face_locations (fixes failure in detecting odd frames)
    • detect scene change and use it to reset face_locations[]
    • choose num_jitters

Subscribe to our newsletter