Skip to content

How-ToOS

How to Blur Faces in Videos Automatically With deface

deface is a free AI tool that finds and blurs every face in a video or photo on your own PC. Here's how to install it on Windows, add GPU acceleration, keep the audio, handle 4K footage and fix missed faces.

By , Systems & Technical Editor

4 min read

How to Blur Faces in Videos Automatically With deface

deface is a free, open-source tool that uses an AI face detector to find every face in a video or photo and blur it for you, on your own PC. It's ideal for dashcam clips, holiday videos and anything else you want to share without showing strangers' faces. It runs from the command line, but you only need a handful of commands. On Python's own documentation for Windows, all checked on 1 December 2026. Always watch the output before you share it, because no detector catches every face.

What you need

  • A Windows 11, Linux or macOS PC. The README says deface supports "all commonly used operating systems", but it needs a command-line shell.

  • Python 3.8 or later (deface's PyPI listing requires at least 3.8).

  • Optionally, a graphics card for faster processing. deface can use Nvidia GPUs through CUDA, and other GPUs on Windows through DirectML.

deface only detects faces. If you also need number plates blurred, see our deface vs EgoBlur comparison.

Step 1: Install Python

On Windows, Python's documentation now points you to the Python install manager, which you can get from the Microsoft Store or from python.org/downloads (the docs say the two versions are identical). After installation, the python, py and pymanager commands should be available. If no Python runtime is installed yet, the docs tell you to use py install first. Run py help to see every command.

Step 2: Create a virtual environment

The deface README recommends installing it in its own virtual environment so its packages don't clash with anything else. Open Terminal (PowerShell) in a folder of your choice and run:

py -m venv deface-env
deface-env\Scripts\Activate.ps1

In Command Prompt, the second line is deface-env\Scripts\activate.bat instead. If PowerShell refuses to run the activation script, Python's docs say you may need to allow it for your user with Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. Type deactivate when you've finished.

Step 3: Install deface

With the environment active, run:

python -m pip install deface

This installs only the packages deface strictly needs. That's enough to blur faces on your processor.

Step 4: Add GPU acceleration (optional)

deface can run its face detector through ONNX Runtime, which the README says "can significantly improve the overall processing speed" on a GPU. Install the package that matches your hardware:

Your hardware

Command from the deface README

Nvidia GPU (CUDA)

python -m pip install onnx onnxruntime-gpu

AMD or Intel GPU on Windows (DirectML)

python -m pip install onnx onnxruntime-directml

CPU only (OpenVINO)

python -m pip install onnx onnxruntime-openvino

The README says OpenVINO can speed up CPU-only systems "by a few percent", and noted in July 2023 that it didn't yet work with Python 3.11. Since v1.4.0, deface automatically picks what it presumes is the fastest available execution provider. You can override that with --execution-provider. ONNX Runtime's documentation notes that DirectML is now in sustained engineering: it's still supported, but new work has moved to Windows ML. Our DirectML vs Windows ML explainer explains what that means.

Step 5: Blur your first video

Point deface at a video:

deface myvideos/vid1.mp4

It writes the result alongside the original as myvideos/vid1_anonymized.mp4. To process several files, list them separated by spaces, or pass a folder and deface will use every file in it. Photos work the same way.

Keep the sound: by default, deface discards all audio tracks. Add --keep-audio (or -k) to copy the audio into the new file.

Step 6: Fix missed faces and false positives

The setting that matters most is the detection threshold, --thresh (default 0.2). The README says to raise it if blur appears on things that aren't faces, and lower it if real faces are being missed. To find the right value, run a short clip with a low threshold and --draw-scores, which writes the detector's confidence score above each detection:

deface clip.mp4 --thresh 0.05 --draw-scores

Check the scores on the real faces and on any false hits, then pick a threshold between them for the final run. If blurs don't quite cover the edges of faces, increase --mask-scale (default 1.3).

Step 7: Handle 4K and high-resolution footage

deface analyses frames at full resolution by default. The README warns that this can cause performance problems on inputs well above 720p, and can even reduce accuracy, because the detector wasn't trained on ultra-high-resolution images. The fix is --scale, which shrinks frames only for detection. Your output keeps its original resolution. Keep the same aspect ratio as your video. For 16:9 footage:

deface dashcam.mp4 --scale 1280x720 --keep-audio

The README suggests 640x360 as a starting point and 1280x720 if the results at the lower resolution aren't good enough.

Step 8: Choose how faces are hidden

Option

Effect

(default)

Strong Gaussian blur over an ellipse covering each face

--boxes

Use rectangles instead of ellipses

--replacewith solid

Solid black box

--replacewith mosaic --mosaicsize 20

Mosaic (pixelate). The size is in pixels, so increase it for high-resolution footage

--replacewith img --replaceimg emoji.png

Replace each face with your own image

For example, deface photo.jpg --boxes --replacewith solid draws black boxes. You can also try deface live: deface cam opens a preview of your webcam with faces blurred.

Step 9: Check and tidy the output

deface looks at each frame independently, so a face the detector misses in a single frame can flash up for a moment. Step through busy scenes before you share the video. By default, deface encodes output with libx264. If the file comes out large, our guide to compressing videos with HandBrake can shrink it. For photos, remember that deface v1.5.0 keeps image metadata after blurring, so remove location data separately.

If you'd rather blur one face by hand in a graphical editor, or need something deface can't do, see our round-up of the best free AI face blurring software.

The bottom line

Install Python, create a virtual environment, run pip install deface, then deface yourvideo.mp4 --keep-audio. Add the ONNX Runtime package for your GPU to speed things up, use --scale for 4K footage, and tune --thresh with --draw-scores if faces are missed. Always watch the result before sharing, because no detector is perfect.

Sources

  1. 01deface README (GitHub)
  2. 02deface releases (GitHub)
  3. 03deface on PyPI
  4. 04Python docs: Using Python on Windows
  5. 05Python docs: venv
  6. 06ONNX Runtime docs: DirectML Execution Provider

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Fix AMD fTPM Stutter on Ryzen PCs

How-To

How to Fix AMD fTPM Stutter on Ryzen PCs

If a Ryzen PC freezes for a moment at random with fTPM switched on, AMD has documented the cause and the fix. Here's how to check whether fTPM is in use, apply AMD's BIOS fix (AGESA 1207 or newer), use its hardware TPM workaround, and why you shouldn't just turn the TPM off.

Marcus Thorne4 min

How to Use Patch My PC Home Updater to Keep Your Apps Up to Date

How-To

How to Use Patch My PC Home Updater to Keep Your Apps Up to Date

Patch My PC Home Updater is a free tool that updates more than 500 common Windows apps silently. Based on the official product page and release notes, we show how to download it, scan and update apps, install new ones, set a schedule and uninstall apps.

Marcus Thorne4 min

WireGuard vs OpenVPN: Which VPN Protocol Should You Use on Your PC?

Versus

WireGuard vs OpenVPN: Which VPN Protocol Should You Use on Your PC?

WireGuard and OpenVPN are the two best-known open-source VPN protocols. Using each project's official documentation, we compare their design, encryption, UDP and TCP support, authentication, Windows clients and limitations to help you choose.

Callum Reid5 min

How to Use Portmaster to See and Block What Your Apps Connect To

How-To

How to Use Portmaster to See and Block What Your Apps Connect To

Portmaster is a free, open-source application firewall that shows every connection your apps make. Based on Safing's official docs, we explain how to install it, read the Network Monitor, block or allow apps, use it with a VPN and uninstall it cleanly.

Marcus Thorne6 min