blurbox 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- blurbox-0.1.0/.gitignore +5 -0
- blurbox-0.1.0/LICENSE +21 -0
- blurbox-0.1.0/PKG-INFO +131 -0
- blurbox-0.1.0/README.md +105 -0
- blurbox-0.1.0/blurbox.py +1500 -0
- blurbox-0.1.0/pyproject.toml +53 -0
- blurbox-0.1.0/tests/conftest.py +87 -0
- blurbox-0.1.0/tests/test_app.py +423 -0
- blurbox-0.1.0/tests/test_logic.py +333 -0
- blurbox-0.1.0/tests/test_media.py +243 -0
blurbox-0.1.0/.gitignore
ADDED
blurbox-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Raffaele Mancuso
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
blurbox-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: blurbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Cover areas of a video with a black box, blur or pixelation: a desktop GUI around ffmpeg
|
|
5
|
+
Author: Raffaele Mancuso
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: anonymize,blur,ffmpeg,gui,pixelate,redact,video
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
11
|
+
Classifier: Environment :: X11 Applications
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Multimedia :: Video
|
|
21
|
+
Classifier: Topic :: Multimedia :: Video :: Conversion
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: av>=18
|
|
24
|
+
Requires-Dist: pillow>=10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# blurbox
|
|
28
|
+
|
|
29
|
+
A small desktop tool to hide parts of a video: draw one or more rectangles on
|
|
30
|
+
the frame and cover each with a black box, a blur or pixelation, for the
|
|
31
|
+
whole video or only during chosen time ranges. It is a GUI around ffmpeg and
|
|
32
|
+
runs on Windows and Linux.
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Python 3.11 or newer
|
|
37
|
+
- ffmpeg and ffprobe on `PATH` (they are separate programs, not installed
|
|
38
|
+
with blurbox); a full build is recommended, so the encoders used to keep
|
|
39
|
+
the source codec (libx265, libsvtav1, libvpx-vp9, libopus) are available.
|
|
40
|
+
On Windows, e.g. the "full" build from [gyan.dev](https://www.gyan.dev/ffmpeg/builds/);
|
|
41
|
+
on Linux, your distribution's `ffmpeg` package
|
|
42
|
+
- Tk: included with Python on Windows; on Linux `pacman -S tk` (Arch) or
|
|
43
|
+
`apt install python3-tk` (Debian/Ubuntu)
|
|
44
|
+
|
|
45
|
+
## Installing
|
|
46
|
+
|
|
47
|
+
With [uv](https://docs.astral.sh/uv/) or [pipx](https://pipx.pypa.io/), which
|
|
48
|
+
put the `blurbox` command on your `PATH` in an environment of its own:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
uv tool install blurbox
|
|
52
|
+
# or
|
|
53
|
+
pipx install blurbox
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then start it, optionally with a video or a project file to open:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
blurbox [video | project.json]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
On Windows the command starts without a console window.
|
|
63
|
+
|
|
64
|
+
## Running from a source checkout
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
uv run --script blurbox.py [video | project.json]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
On Windows, `blurbox_shortcut.ps1` creates `blurbox.lnk`,
|
|
71
|
+
a shortcut that starts the tool without a console window; add `-Desktop` for
|
|
72
|
+
a copy on the Desktop. Drop a video or a project onto the shortcut to open
|
|
73
|
+
it. Rerun the script after reinstalling uv or moving this folder, since a
|
|
74
|
+
shortcut stores absolute paths.
|
|
75
|
+
|
|
76
|
+
## Using it
|
|
77
|
+
|
|
78
|
+
- **Areas**: drag on the frame to draw the selected area, drag inside any
|
|
79
|
+
area to select and move it, drag an edge or corner of the selected area
|
|
80
|
+
(it shows white handles) to resize it, "New area" to add another. The
|
|
81
|
+
mouse cursor shows which of these a drag will do. Each area has its own
|
|
82
|
+
effect, strength and time ranges; with no ranges it covers the whole
|
|
83
|
+
video.
|
|
84
|
+
- **Whole frame**: tick it to make the selected area cover the entire
|
|
85
|
+
picture (e.g. blur everything from 0:12 to 0:15); untick it to get its
|
|
86
|
+
rectangle back.
|
|
87
|
+
- **Seeking**: click or drag the timeline, use the step buttons (hold them
|
|
88
|
+
to repeat), or the keys ←/→ (1 s) and Shift+←/→ (one frame).
|
|
89
|
+
- **Time ranges**: I and O put the current time in Start and End, Enter adds
|
|
90
|
+
the range, a double-click on a range edits it, Esc cancels the edit. The
|
|
91
|
+
timeline shows the selected area's ranges in red, the others' in grey.
|
|
92
|
+
- **Show effect** (E) draws every active area's effect on the frame, using
|
|
93
|
+
the same ffmpeg filters as the render.
|
|
94
|
+
- **Projects**: Ctrl+S saves the areas, quality and position as JSON,
|
|
95
|
+
Ctrl+O opens a project. The video is found relative to the project file
|
|
96
|
+
first, so a folder with both can be moved to another PC.
|
|
97
|
+
|
|
98
|
+
## Output
|
|
99
|
+
|
|
100
|
+
The render keeps the source's codec family (H.264, HEVC, VP9, AV1), bit depth
|
|
101
|
+
and colour metadata (HDR included), every audio track, subtitles and chapters.
|
|
102
|
+
Anything the chosen container cannot hold is converted (losslessly where
|
|
103
|
+
possible) or left out, and a dialog lists it before rendering starts.
|
|
104
|
+
|
|
105
|
+
The quality setting is x264/x265-style CRF: lower means better and larger.
|
|
106
|
+
The same number looks better with HEVC than with H.264, so 22–24 is usually
|
|
107
|
+
enough for HEVC sources.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
uv sync # creates .venv with the dependencies and pytest
|
|
113
|
+
uv run pytest # the test suite, about 20 s
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`pyproject.toml` repeats the dependencies of the script's inline metadata
|
|
117
|
+
(which `uv run --script` and the shortcut use); keep the two in sync.
|
|
118
|
+
|
|
119
|
+
The tests are in three files:
|
|
120
|
+
|
|
121
|
+
- `tests/test_logic.py`: time parsing, areas, filtergraphs and the stream
|
|
122
|
+
plan, with no ffmpeg run
|
|
123
|
+
- `tests/test_media.py`: builds small videos with ffmpeg once per session,
|
|
124
|
+
then checks probing, frame reading against a plain sequential decode, the
|
|
125
|
+
live preview against the real render frame by frame, 10-bit and HDR
|
|
126
|
+
preservation, and the streams in rendered files
|
|
127
|
+
- `tests/test_app.py`: drives the GUI through real Tk events (areas, ranges,
|
|
128
|
+
keys, seeking, projects); needs a display
|
|
129
|
+
|
|
130
|
+
Tests that need ffmpeg or a display are skipped when these are missing;
|
|
131
|
+
`-m "not gui"` or `-m "not media"` deselects them explicitly.
|
blurbox-0.1.0/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# blurbox
|
|
2
|
+
|
|
3
|
+
A small desktop tool to hide parts of a video: draw one or more rectangles on
|
|
4
|
+
the frame and cover each with a black box, a blur or pixelation, for the
|
|
5
|
+
whole video or only during chosen time ranges. It is a GUI around ffmpeg and
|
|
6
|
+
runs on Windows and Linux.
|
|
7
|
+
|
|
8
|
+
## Requirements
|
|
9
|
+
|
|
10
|
+
- Python 3.11 or newer
|
|
11
|
+
- ffmpeg and ffprobe on `PATH` (they are separate programs, not installed
|
|
12
|
+
with blurbox); a full build is recommended, so the encoders used to keep
|
|
13
|
+
the source codec (libx265, libsvtav1, libvpx-vp9, libopus) are available.
|
|
14
|
+
On Windows, e.g. the "full" build from [gyan.dev](https://www.gyan.dev/ffmpeg/builds/);
|
|
15
|
+
on Linux, your distribution's `ffmpeg` package
|
|
16
|
+
- Tk: included with Python on Windows; on Linux `pacman -S tk` (Arch) or
|
|
17
|
+
`apt install python3-tk` (Debian/Ubuntu)
|
|
18
|
+
|
|
19
|
+
## Installing
|
|
20
|
+
|
|
21
|
+
With [uv](https://docs.astral.sh/uv/) or [pipx](https://pipx.pypa.io/), which
|
|
22
|
+
put the `blurbox` command on your `PATH` in an environment of its own:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
uv tool install blurbox
|
|
26
|
+
# or
|
|
27
|
+
pipx install blurbox
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Then start it, optionally with a video or a project file to open:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
blurbox [video | project.json]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
On Windows the command starts without a console window.
|
|
37
|
+
|
|
38
|
+
## Running from a source checkout
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
uv run --script blurbox.py [video | project.json]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
On Windows, `blurbox_shortcut.ps1` creates `blurbox.lnk`,
|
|
45
|
+
a shortcut that starts the tool without a console window; add `-Desktop` for
|
|
46
|
+
a copy on the Desktop. Drop a video or a project onto the shortcut to open
|
|
47
|
+
it. Rerun the script after reinstalling uv or moving this folder, since a
|
|
48
|
+
shortcut stores absolute paths.
|
|
49
|
+
|
|
50
|
+
## Using it
|
|
51
|
+
|
|
52
|
+
- **Areas**: drag on the frame to draw the selected area, drag inside any
|
|
53
|
+
area to select and move it, drag an edge or corner of the selected area
|
|
54
|
+
(it shows white handles) to resize it, "New area" to add another. The
|
|
55
|
+
mouse cursor shows which of these a drag will do. Each area has its own
|
|
56
|
+
effect, strength and time ranges; with no ranges it covers the whole
|
|
57
|
+
video.
|
|
58
|
+
- **Whole frame**: tick it to make the selected area cover the entire
|
|
59
|
+
picture (e.g. blur everything from 0:12 to 0:15); untick it to get its
|
|
60
|
+
rectangle back.
|
|
61
|
+
- **Seeking**: click or drag the timeline, use the step buttons (hold them
|
|
62
|
+
to repeat), or the keys ←/→ (1 s) and Shift+←/→ (one frame).
|
|
63
|
+
- **Time ranges**: I and O put the current time in Start and End, Enter adds
|
|
64
|
+
the range, a double-click on a range edits it, Esc cancels the edit. The
|
|
65
|
+
timeline shows the selected area's ranges in red, the others' in grey.
|
|
66
|
+
- **Show effect** (E) draws every active area's effect on the frame, using
|
|
67
|
+
the same ffmpeg filters as the render.
|
|
68
|
+
- **Projects**: Ctrl+S saves the areas, quality and position as JSON,
|
|
69
|
+
Ctrl+O opens a project. The video is found relative to the project file
|
|
70
|
+
first, so a folder with both can be moved to another PC.
|
|
71
|
+
|
|
72
|
+
## Output
|
|
73
|
+
|
|
74
|
+
The render keeps the source's codec family (H.264, HEVC, VP9, AV1), bit depth
|
|
75
|
+
and colour metadata (HDR included), every audio track, subtitles and chapters.
|
|
76
|
+
Anything the chosen container cannot hold is converted (losslessly where
|
|
77
|
+
possible) or left out, and a dialog lists it before rendering starts.
|
|
78
|
+
|
|
79
|
+
The quality setting is x264/x265-style CRF: lower means better and larger.
|
|
80
|
+
The same number looks better with HEVC than with H.264, so 22–24 is usually
|
|
81
|
+
enough for HEVC sources.
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
uv sync # creates .venv with the dependencies and pytest
|
|
87
|
+
uv run pytest # the test suite, about 20 s
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`pyproject.toml` repeats the dependencies of the script's inline metadata
|
|
91
|
+
(which `uv run --script` and the shortcut use); keep the two in sync.
|
|
92
|
+
|
|
93
|
+
The tests are in three files:
|
|
94
|
+
|
|
95
|
+
- `tests/test_logic.py`: time parsing, areas, filtergraphs and the stream
|
|
96
|
+
plan, with no ffmpeg run
|
|
97
|
+
- `tests/test_media.py`: builds small videos with ffmpeg once per session,
|
|
98
|
+
then checks probing, frame reading against a plain sequential decode, the
|
|
99
|
+
live preview against the real render frame by frame, 10-bit and HDR
|
|
100
|
+
preservation, and the streams in rendered files
|
|
101
|
+
- `tests/test_app.py`: drives the GUI through real Tk events (areas, ranges,
|
|
102
|
+
keys, seeking, projects); needs a display
|
|
103
|
+
|
|
104
|
+
Tests that need ffmpeg or a display are skipped when these are missing;
|
|
105
|
+
`-m "not gui"` or `-m "not media"` deselects them explicitly.
|