Skip to main content

Censor videos automatically

Project description

PyPI Python Version License PyPI - Downloads

I use a simple template match to find the secret spots in the video. So this is nothing for a dynamical video. It should be used to clean up for screen records.

alternate text

Why

Blurring is designed to expand Watch me Coding. I take my screen in time lapse. One second, one frame. That’s 3600 frames for an hour. An 8-hour coding day would be 28800 frames. I do not want to search for secret information in every single frame. I know my secret passwords so I can scan the video and blur them.

Install

Simple as always. Do not forget to use a virtual environment:

>>> pip install blurring

How to uses

Create a template. You can use any image. Maybe something created with gimp. Or us supplied tool “blurring-t” (I know that is a ugly name, sorry):

>>> blurring-t template
text [PASSWORD]: PASSWORD
height [18]: 18
...

Before you blur the video, checkout the original.

alternate text

Now blur it. I use the offset to blur the password before it is completely visible:

blurring video.mp4 blurred.mp4 template.png --offset 60

This is the result.

alternate text

And this would be the result without the offset.

alternate text

There is still something to improve, but for now I am happy.

Watch me coding integration

This is also a plugin for watch me encoding. After you have installed Blurring, there is an additional command:

>>> wmc -H
        info v0.3.3 - Print some infos
        link v0.3.3 - Concat all videos to one
      record v0.3.3 - Start the record
       setup v0.3.3 - Setup the project
    blurring v0.1.0 - Blur the final video

First create the final video:

>>> wmc link

Now create the template(s):

>>> mkdir templates
>>> blurring-t templates/dummy
text [PASSWORD]: PASSWORD
height [18]: 18
width [70]: 70
scale [0.4]: 0.4
font [0]: 0
pos_x [0]: 0
pos_y [12]: 12

It is time to blurring out the “PASSWORD”:

>>> wmc blurring

Now you have the video “full_blur.mp4”. Enjoy it.

Development

Virtual environment windows:

python -m venv venv
venv\Scripts\activate

Virtual environment linux:

python3 -m venv venv
source venv/bin/activate

Setup project:

python -m pip install --upgrade pip wheel setuptools tox flake8 pylint coverage rstcheck
python setup.py develop

Run some test:

tox
pylint src/blurring
python setup.py test
python setup.py flake8
python setup.py check

Test coverage:

coverage run --source src/blurring setup.py test
coverage report -m

Publish package:

git tag -a 1.0.0a1 -m '1.0.0a1'
rstcheck README.rst
python setup.py --version
python setup.py check
python setup.py sdist bdist_wheel
twine upload dist/*
git push origin 1.0.0a1

Create videos:

ffmpeg -i ext/video.mp4 -filter_complex "[0:v] palettegen" palette.png -y
ffmpeg -i ext/video.mp4 -i palette.png -filter_complex "[0:v][1:v] paletteuse" ext/video.gif
ffmpeg -i ext/video.mp4 -filter:v "crop=400:400:0:0" ext/video_small.mp4
ffmpeg -i ext/video.mp4 -i ext/blurred_60.mp4 -filter_complex hstack ext/combine.mp4

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blurring-0.2.0.tar.gz (937.3 kB view details)

Uploaded Source

Built Distribution

blurring-0.2.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file blurring-0.2.0.tar.gz.

File metadata

  • Download URL: blurring-0.2.0.tar.gz
  • Upload date:
  • Size: 937.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.8.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 clint/0.5.1 CPython/2.7.15+ Linux/4.15.0-64-generic

File hashes

Hashes for blurring-0.2.0.tar.gz
Algorithm Hash digest
SHA256 390c53b1d7159614fab1b66f7c402d8cdb8abafc3984184c7ae244e74de1b4a3
MD5 fbb133481a4d4bbf1a18f7003f12d86f
BLAKE2b-256 98847f44c2c4bef5b3df5bc4746fb63e8ef6fce84b10bfb0ae1a05ace47de22d

See more details on using hashes here.

File details

Details for the file blurring-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: blurring-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.8.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 clint/0.5.1 CPython/2.7.15+ Linux/4.15.0-64-generic

File hashes

Hashes for blurring-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55f07d871e1031aef29f7a9a0939ad548eef1e2cbe5fb0858fce9cb1438c3a39
MD5 3d79755c822dd262216c459b272064e2
BLAKE2b-256 0057bd6750634f0d24e085ec7f9107df7a1a609f76c3ba610885eaab05dca889

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page