How to Blur Faces in a Video from Command Line

Privacy is always incredibly important, especially with visual media where you may not have the permission of individuals in the video. If you’re filming something in public, it’s likely you’ll catch someone’s face who simply doesn’t want or need to be identified. This recently got me to thinking: what’s the easiest way to blur faces […]

The post How to Blur Faces in a Video from Command Line appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh

Privacy is always incredibly important, especially with visual media where you may not have the permission of individuals in the video. If you’re filming something in public, it’s likely you’ll catch someone’s face who simply doesn’t want or need to be identified. This recently got me to thinking: what’s the easiest way to blur faces in a video via command line?

The best open source utility I found for blurring faces in a video was deface. Let’s have a look at how you can use deface to blur faces in videos!

Start by downloading Python-based via pip:

python3 -m pip install deface

With deface installed, simply provide the video name and get the output file with blurred faces:

sudo deface ./sample-4k-faces-video.mp4
Input:  ./sample-4k-faces-video.mp4
Output: ./sample-4k-faces-video_anonymized.mp4
100%|█████████████████████████████

The resulting video does an impressive job of blurring out faces of persons walking by in the original recording:

View the resulting video of persons walking down the streets of New York:

The default threshold for face recognition works very well, even on moving subjects. You can experiment with thresholds with the thresh argument, and even draw the thresholds out while debugging:

I downloaded a handful of YouTube videos using my favorite YouTube downloading utility youtube-dl and I was amazed at how well deface did on a variety of visual environments. Faces were identified at a reliable level even at default threshold!

The post How to Blur Faces in a Video from Command Line appeared first on David Walsh Blog.


This content originally appeared on David Walsh Blog and was authored by David Walsh


Print Share Comment Cite Upload Translate Updates
APA

David Walsh | Sciencx (2023-05-01T11:17:56+00:00) How to Blur Faces in a Video from Command Line. Retrieved from https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/

MLA
" » How to Blur Faces in a Video from Command Line." David Walsh | Sciencx - Monday May 1, 2023, https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/
HARVARD
David Walsh | Sciencx Monday May 1, 2023 » How to Blur Faces in a Video from Command Line., viewed ,<https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/>
VANCOUVER
David Walsh | Sciencx - » How to Blur Faces in a Video from Command Line. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/
CHICAGO
" » How to Blur Faces in a Video from Command Line." David Walsh | Sciencx - Accessed . https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/
IEEE
" » How to Blur Faces in a Video from Command Line." David Walsh | Sciencx [Online]. Available: https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/. [Accessed: ]
rf:citation
» How to Blur Faces in a Video from Command Line | David Walsh | Sciencx | https://www.scien.cx/2023/05/01/how-to-blur-faces-in-a-video-from-command-line/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.