open-redactor 0.2.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.
- open_redactor-0.2.0/LICENSE +201 -0
- open_redactor-0.2.0/PKG-INFO +216 -0
- open_redactor-0.2.0/README.md +187 -0
- open_redactor-0.2.0/pyproject.toml +51 -0
- open_redactor-0.2.0/setup.cfg +4 -0
- open_redactor-0.2.0/src/open_redactor/__init__.py +4 -0
- open_redactor-0.2.0/src/open_redactor/analytics.py +146 -0
- open_redactor-0.2.0/src/open_redactor/cli.py +274 -0
- open_redactor-0.2.0/src/open_redactor/codes.py +80 -0
- open_redactor-0.2.0/src/open_redactor/image_pipeline.py +117 -0
- open_redactor-0.2.0/src/open_redactor/local_gsam.py +215 -0
- open_redactor-0.2.0/src/open_redactor/mask_decode.py +90 -0
- open_redactor-0.2.0/src/open_redactor/masks.py +280 -0
- open_redactor-0.2.0/src/open_redactor/pii.py +167 -0
- open_redactor-0.2.0/src/open_redactor/pipeline.py +661 -0
- open_redactor-0.2.0/src/open_redactor/presets.py +54 -0
- open_redactor-0.2.0/src/open_redactor/replace.py +157 -0
- open_redactor-0.2.0/src/open_redactor/sam_client.py +468 -0
- open_redactor-0.2.0/src/open_redactor/webui.py +65 -0
- open_redactor-0.2.0/src/open_redactor.egg-info/PKG-INFO +216 -0
- open_redactor-0.2.0/src/open_redactor.egg-info/SOURCES.txt +35 -0
- open_redactor-0.2.0/src/open_redactor.egg-info/dependency_links.txt +1 -0
- open_redactor-0.2.0/src/open_redactor.egg-info/entry_points.txt +2 -0
- open_redactor-0.2.0/src/open_redactor.egg-info/requires.txt +17 -0
- open_redactor-0.2.0/src/open_redactor.egg-info/top_level.txt +1 -0
- open_redactor-0.2.0/tests/test_analytics_replace.py +57 -0
- open_redactor-0.2.0/tests/test_audio.py +45 -0
- open_redactor-0.2.0/tests/test_cli.py +23 -0
- open_redactor-0.2.0/tests/test_codes.py +49 -0
- open_redactor-0.2.0/tests/test_coverage.py +25 -0
- open_redactor-0.2.0/tests/test_ease.py +62 -0
- open_redactor-0.2.0/tests/test_formats.py +22 -0
- open_redactor-0.2.0/tests/test_masks.py +65 -0
- open_redactor-0.2.0/tests/test_photos.py +55 -0
- open_redactor-0.2.0/tests/test_pii.py +32 -0
- open_redactor-0.2.0/tests/test_sam_client.py +29 -0
- open_redactor-0.2.0/tests/test_sam_tokens.py +9 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: open-redactor
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Open-source CLI to make video share-safe with SAM 3.1 prompt-driven redaction
|
|
5
|
+
Author: Yuriy H
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: video,redaction,sam,privacy,cli
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy>=1.26
|
|
15
|
+
Requires-Dist: Pillow>=10.0
|
|
16
|
+
Requires-Dist: opencv-python-headless>=4.8
|
|
17
|
+
Requires-Dist: httpx>=0.25
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
21
|
+
Provides-Extra: pii
|
|
22
|
+
Requires-Dist: pytesseract>=0.3.10; extra == "pii"
|
|
23
|
+
Requires-Dist: pandas>=2.0; extra == "pii"
|
|
24
|
+
Provides-Extra: local
|
|
25
|
+
Requires-Dist: torch>=2.2; extra == "local"
|
|
26
|
+
Requires-Dist: transformers>=4.44; extra == "local"
|
|
27
|
+
Requires-Dist: accelerate>=0.33; extra == "local"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Open Redactor
|
|
31
|
+
|
|
32
|
+
**Drop in a clip or a photo, name what to hide, get a share-safe copy out.**
|
|
33
|
+
|
|
34
|
+
Open Redactor finds people, faces, documents, numbers, codes, and places in your media and covers them with tracking that holds across every frame. Blur it, pixelate it, or swap it for a generated stand-in. Audit before you redact, prove coverage after, and keep private footage on your own machine when it matters.
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
*Original on the left, redacted output on the right, from a live SAM 3.1 run. The face track held across all 50 frames.*
|
|
39
|
+
|
|
40
|
+
## Try it in 30 seconds
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install open-redactor
|
|
44
|
+
|
|
45
|
+
open-redactor clip.mp4 --preview --preset family # 3 second sample first
|
|
46
|
+
cat clip.redacted.coverage.txt # one result line to trust
|
|
47
|
+
open-redactor clip.mp4 --preset family # the full run
|
|
48
|
+
open-redactor clip.mp4 --preset family --mode pixelate # re-render free, detection is cached
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## What it catches
|
|
52
|
+
|
|
53
|
+
**People and places, by phrase.** Person, face, license plate, screen, and anything else you name in a short noun phrase. The tracker holds each one across time, pads the mask, and carries it through brief dropouts so the output never flashes clean.
|
|
54
|
+
|
|
55
|
+
**Sensitive documents.** Passports, credit cards, driver licenses, ID cards, documents, and name badges with the documents preset.
|
|
56
|
+
|
|
57
|
+
**Printed secrets.** The text layer OCRs frames and covers verified credit card numbers, Social Security numbers, phone numbers, and emails. Card numbers must pass the Luhn check, so order numbers stay untouched.
|
|
58
|
+
|
|
59
|
+
**Codes.** QR codes and barcodes, which carry Wi-Fi passwords, payment links, and contact cards.
|
|
60
|
+
|
|
61
|
+
**Location clues.** Street signs, house numbers, plates, and mailboxes with the location preset.
|
|
62
|
+
|
|
63
|
+
**Voices.** Audio stays, gets muted, or gets pitch shifted so speech remains but the speaker does not.
|
|
64
|
+
|
|
65
|
+
## Three ways to hide something
|
|
66
|
+
|
|
67
|
+
| Mode | What you see | Reach for it when |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| blur | A soft gaussian cover | You want the default, clean look |
|
|
70
|
+
| pixelate | Chunky mosaic blocks | You want the classic redaction look |
|
|
71
|
+
| replace | A generated stand-in | You want the scene to still feel natural |
|
|
72
|
+
|
|
73
|
+

|
|
74
|
+
|
|
75
|
+
*Replace mode on the real showcase portrait. The face becomes a neutral synthetic avatar while the photo around it stays untouched. The same treatment swaps plates and house numbers for fake plaques and card numbers for format valid fakes in the reserved test range. Fakes are deterministic per track, so the same person keeps the same stand-in for the whole clip.*
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
open-redactor clip.mp4 --mode replace --preset location
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Trust first, share second
|
|
82
|
+
|
|
83
|
+
Redaction fails silently in most tools. Open Redactor is built to show its work.
|
|
84
|
+
|
|
85
|
+
**Preview.** Render only the first 3 seconds with a contact sheet before committing to a full clip.
|
|
86
|
+
|
|
87
|
+
**Shadow audit.** Run detection and change nothing. You get a written audit with every element, its frames, and a severity grade, critical for passports and card numbers, high for faces and house numbers, medium for plates and signs.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
open-redactor clip.mp4 --shadow --preset documents --sensitive
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Coverage report.** Every real run writes one. Any gap longer than the carry window is flagged NEEDS REVIEW in plain words.
|
|
94
|
+
|
|
95
|
+
**Analytics.** Every run ends with frames affected, elements by severity, an exposure score, and a machine readable .summary.json next to the output.
|
|
96
|
+
|
|
97
|
+
A sample audit lives at [examples/shadow-audit-sample.txt](examples/shadow-audit-sample.txt).
|
|
98
|
+
|
|
99
|
+
## One flag presets
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
open-redactor clip.mp4 --preset family # kids, faces, plates, screens, generous blur
|
|
103
|
+
open-redactor clip.mp4 --preset street # bystanders and plates, pixelated
|
|
104
|
+
open-redactor clip.mp4 --preset screen-share # monitors and faces in recordings
|
|
105
|
+
open-redactor clip.mp4 --preset documents # passports, cards, IDs, badges, strong blur
|
|
106
|
+
open-redactor clip.mp4 --preset location # street signs, house numbers, mailboxes
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Add `--sensitive` to any run to switch on the text and codes layers together. Add `--audio mute` or `--audio pitch` when voices identify someone.
|
|
110
|
+
|
|
111
|
+
## Run SAM wherever you trust it
|
|
112
|
+
|
|
113
|
+
SAM 3.1 is an open weights model, so the backend is your choice.
|
|
114
|
+
|
|
115
|
+
**API, the default.** Meta Model API, best quality with no GPU. Your clip goes to api.meta.ai with your key.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
open-redactor clip.mp4 --backend api
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Hosted.** The same request shape pointed at your own endpoint, a team server, or a cloud GPU box.
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
open-redactor clip.mp4 --backend hosted --endpoint https://your-host.example/v1/responses
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Local.** Grounding DINO plus SAM 2 with IoU tracking on your own hardware. Nothing leaves the device. This is the mode for source footage, medical clips, and family video that should never be uploaded.
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install "open-redactor[local]"
|
|
131
|
+
open-redactor clip.mp4 --backend local
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Pixel-perfect SAM masks decode through @meta-sam/parser when Node is present, with a box fallback that still pads and carries safely.
|
|
135
|
+
|
|
136
|
+
## Photos, formats, and the local page
|
|
137
|
+
|
|
138
|
+
Photos work exactly like video. JPG, PNG, WebP, and BMP in, redacted photo out in the same format, with every preset and layer available.
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
open-redactor photo.jpg --preset documents --sensitive
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Video inputs cover MP4, MOV, MKV, WebM, AVI, and M4V from phones, OBS, browsers, and older cameras. Output is always MP4. Batch mode takes a whole folder. Output naming never overwrites your original or an earlier redacted copy.
|
|
145
|
+
|
|
146
|
+
Prefer clicking? `open-redactor --ui` opens a drag and drop page that runs only on your own machine at 127.0.0.1.
|
|
147
|
+
|
|
148
|
+
## The full demo
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# 1. Audit a folder of interview footage without changing a byte
|
|
152
|
+
open-redactor interview.mp4 --shadow --preset street --audio pitch
|
|
153
|
+
|
|
154
|
+
# 2. Preview the fix on the first 3 seconds
|
|
155
|
+
open-redactor interview.mp4 --preview --preset street --audio pitch
|
|
156
|
+
|
|
157
|
+
# 3. Run it, with analytics and a coverage report written next to the output
|
|
158
|
+
open-redactor interview.mp4 --preset street --audio pitch --contact-sheet
|
|
159
|
+
|
|
160
|
+
# 4. Read what was caught
|
|
161
|
+
cat interview.redacted.summary.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
More worked examples with frames and coverage proof live in [examples/README.md](examples/README.md). The longer guide, privacy notes, and honest limits live in [docs/using-open-redactor.md](docs/using-open-redactor.md).
|
|
165
|
+
|
|
166
|
+
## Why this exists
|
|
167
|
+
|
|
168
|
+
**Thesis:** Consumer video redaction is either manual or enterprise-priced and a prompt-driven open-source CLI makes share-safe video a one-command default.
|
|
169
|
+
|
|
170
|
+
**Value-add:** Real video tracking quality without per-frame manual work plus a local mode that keeps private footage off any API.
|
|
171
|
+
|
|
172
|
+
## How it stays covered
|
|
173
|
+
|
|
174
|
+
A detector that drops a face for two frames leaks those two frames. So the pipeline pads every mask by a margin, carries tracks forward after they vanish, smooths mask edges over time, fills single-frame gaps, and flags any longer gap in the coverage report instead of hiding it. Defaults are a product decision too: person, face, license plate, and screen run when you name nothing.
|
|
175
|
+
|
|
176
|
+
## CLI reference
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
open-redactor input.mp4 [--output out.mp4]
|
|
180
|
+
--target PHRASE (repeatable) --targets-default --add-target PHRASE
|
|
181
|
+
--preset family|street|screen-share|documents|location
|
|
182
|
+
--mode blur|pixelate|replace --strength N --mask-margin N --carry-frames N
|
|
183
|
+
--preview --shadow --contact-sheet
|
|
184
|
+
--report (default) --no-report
|
|
185
|
+
--sensitive --pii-text --codes
|
|
186
|
+
--audio keep|mute|pitch --pitch-factor 0.8
|
|
187
|
+
--backend api|hosted|local --provider sam|grounding-sam
|
|
188
|
+
--endpoint URL --api-key-env MODEL_API_KEY
|
|
189
|
+
--no-cache --batch --ui
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Exit code is 0 on success. A run that finds zero matches still exits 0 and writes a clean copy with a log line saying nothing matched.
|
|
193
|
+
|
|
194
|
+
## Install
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
pip install open-redactor
|
|
198
|
+
pip install "open-redactor[local]" # optional local models
|
|
199
|
+
pip install "open-redactor[pii]" # optional text scanning, also needs the tesseract binary
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
You need ffmpeg and ffprobe on your PATH. From source: clone this repo and `pip install -e .`
|
|
203
|
+
|
|
204
|
+
## Project layout
|
|
205
|
+
|
|
206
|
+
- `cli.py` the command line, presets, and routing for video and photos
|
|
207
|
+
- `pipeline.py` and `image_pipeline.py` ingest, detection, padding, rendering, reports
|
|
208
|
+
- `sam_client.py` the SAM 3.1 API and hosted client with caching
|
|
209
|
+
- `local_gsam.py` Grounding DINO plus SAM 2 local provider with IoU tracking
|
|
210
|
+
- `masks.py` padding, carry-forward, smoothing, and coverage reports
|
|
211
|
+
- `pii.py`, `codes.py` the text and codes layers
|
|
212
|
+
- `analytics.py`, `replace.py` severity, summaries, shadow audits, and generated stand-ins
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
Apache-2.0. See LICENSE.
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Open Redactor
|
|
2
|
+
|
|
3
|
+
**Drop in a clip or a photo, name what to hide, get a share-safe copy out.**
|
|
4
|
+
|
|
5
|
+
Open Redactor finds people, faces, documents, numbers, codes, and places in your media and covers them with tracking that holds across every frame. Blur it, pixelate it, or swap it for a generated stand-in. Audit before you redact, prove coverage after, and keep private footage on your own machine when it matters.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
*Original on the left, redacted output on the right, from a live SAM 3.1 run. The face track held across all 50 frames.*
|
|
10
|
+
|
|
11
|
+
## Try it in 30 seconds
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install open-redactor
|
|
15
|
+
|
|
16
|
+
open-redactor clip.mp4 --preview --preset family # 3 second sample first
|
|
17
|
+
cat clip.redacted.coverage.txt # one result line to trust
|
|
18
|
+
open-redactor clip.mp4 --preset family # the full run
|
|
19
|
+
open-redactor clip.mp4 --preset family --mode pixelate # re-render free, detection is cached
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What it catches
|
|
23
|
+
|
|
24
|
+
**People and places, by phrase.** Person, face, license plate, screen, and anything else you name in a short noun phrase. The tracker holds each one across time, pads the mask, and carries it through brief dropouts so the output never flashes clean.
|
|
25
|
+
|
|
26
|
+
**Sensitive documents.** Passports, credit cards, driver licenses, ID cards, documents, and name badges with the documents preset.
|
|
27
|
+
|
|
28
|
+
**Printed secrets.** The text layer OCRs frames and covers verified credit card numbers, Social Security numbers, phone numbers, and emails. Card numbers must pass the Luhn check, so order numbers stay untouched.
|
|
29
|
+
|
|
30
|
+
**Codes.** QR codes and barcodes, which carry Wi-Fi passwords, payment links, and contact cards.
|
|
31
|
+
|
|
32
|
+
**Location clues.** Street signs, house numbers, plates, and mailboxes with the location preset.
|
|
33
|
+
|
|
34
|
+
**Voices.** Audio stays, gets muted, or gets pitch shifted so speech remains but the speaker does not.
|
|
35
|
+
|
|
36
|
+
## Three ways to hide something
|
|
37
|
+
|
|
38
|
+
| Mode | What you see | Reach for it when |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| blur | A soft gaussian cover | You want the default, clean look |
|
|
41
|
+
| pixelate | Chunky mosaic blocks | You want the classic redaction look |
|
|
42
|
+
| replace | A generated stand-in | You want the scene to still feel natural |
|
|
43
|
+
|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
*Replace mode on the real showcase portrait. The face becomes a neutral synthetic avatar while the photo around it stays untouched. The same treatment swaps plates and house numbers for fake plaques and card numbers for format valid fakes in the reserved test range. Fakes are deterministic per track, so the same person keeps the same stand-in for the whole clip.*
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
open-redactor clip.mp4 --mode replace --preset location
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Trust first, share second
|
|
53
|
+
|
|
54
|
+
Redaction fails silently in most tools. Open Redactor is built to show its work.
|
|
55
|
+
|
|
56
|
+
**Preview.** Render only the first 3 seconds with a contact sheet before committing to a full clip.
|
|
57
|
+
|
|
58
|
+
**Shadow audit.** Run detection and change nothing. You get a written audit with every element, its frames, and a severity grade, critical for passports and card numbers, high for faces and house numbers, medium for plates and signs.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
open-redactor clip.mp4 --shadow --preset documents --sensitive
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Coverage report.** Every real run writes one. Any gap longer than the carry window is flagged NEEDS REVIEW in plain words.
|
|
65
|
+
|
|
66
|
+
**Analytics.** Every run ends with frames affected, elements by severity, an exposure score, and a machine readable .summary.json next to the output.
|
|
67
|
+
|
|
68
|
+
A sample audit lives at [examples/shadow-audit-sample.txt](examples/shadow-audit-sample.txt).
|
|
69
|
+
|
|
70
|
+
## One flag presets
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
open-redactor clip.mp4 --preset family # kids, faces, plates, screens, generous blur
|
|
74
|
+
open-redactor clip.mp4 --preset street # bystanders and plates, pixelated
|
|
75
|
+
open-redactor clip.mp4 --preset screen-share # monitors and faces in recordings
|
|
76
|
+
open-redactor clip.mp4 --preset documents # passports, cards, IDs, badges, strong blur
|
|
77
|
+
open-redactor clip.mp4 --preset location # street signs, house numbers, mailboxes
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Add `--sensitive` to any run to switch on the text and codes layers together. Add `--audio mute` or `--audio pitch` when voices identify someone.
|
|
81
|
+
|
|
82
|
+
## Run SAM wherever you trust it
|
|
83
|
+
|
|
84
|
+
SAM 3.1 is an open weights model, so the backend is your choice.
|
|
85
|
+
|
|
86
|
+
**API, the default.** Meta Model API, best quality with no GPU. Your clip goes to api.meta.ai with your key.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
open-redactor clip.mp4 --backend api
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Hosted.** The same request shape pointed at your own endpoint, a team server, or a cloud GPU box.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
open-redactor clip.mp4 --backend hosted --endpoint https://your-host.example/v1/responses
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Local.** Grounding DINO plus SAM 2 with IoU tracking on your own hardware. Nothing leaves the device. This is the mode for source footage, medical clips, and family video that should never be uploaded.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install "open-redactor[local]"
|
|
102
|
+
open-redactor clip.mp4 --backend local
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Pixel-perfect SAM masks decode through @meta-sam/parser when Node is present, with a box fallback that still pads and carries safely.
|
|
106
|
+
|
|
107
|
+
## Photos, formats, and the local page
|
|
108
|
+
|
|
109
|
+
Photos work exactly like video. JPG, PNG, WebP, and BMP in, redacted photo out in the same format, with every preset and layer available.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
open-redactor photo.jpg --preset documents --sensitive
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Video inputs cover MP4, MOV, MKV, WebM, AVI, and M4V from phones, OBS, browsers, and older cameras. Output is always MP4. Batch mode takes a whole folder. Output naming never overwrites your original or an earlier redacted copy.
|
|
116
|
+
|
|
117
|
+
Prefer clicking? `open-redactor --ui` opens a drag and drop page that runs only on your own machine at 127.0.0.1.
|
|
118
|
+
|
|
119
|
+
## The full demo
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# 1. Audit a folder of interview footage without changing a byte
|
|
123
|
+
open-redactor interview.mp4 --shadow --preset street --audio pitch
|
|
124
|
+
|
|
125
|
+
# 2. Preview the fix on the first 3 seconds
|
|
126
|
+
open-redactor interview.mp4 --preview --preset street --audio pitch
|
|
127
|
+
|
|
128
|
+
# 3. Run it, with analytics and a coverage report written next to the output
|
|
129
|
+
open-redactor interview.mp4 --preset street --audio pitch --contact-sheet
|
|
130
|
+
|
|
131
|
+
# 4. Read what was caught
|
|
132
|
+
cat interview.redacted.summary.json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
More worked examples with frames and coverage proof live in [examples/README.md](examples/README.md). The longer guide, privacy notes, and honest limits live in [docs/using-open-redactor.md](docs/using-open-redactor.md).
|
|
136
|
+
|
|
137
|
+
## Why this exists
|
|
138
|
+
|
|
139
|
+
**Thesis:** Consumer video redaction is either manual or enterprise-priced and a prompt-driven open-source CLI makes share-safe video a one-command default.
|
|
140
|
+
|
|
141
|
+
**Value-add:** Real video tracking quality without per-frame manual work plus a local mode that keeps private footage off any API.
|
|
142
|
+
|
|
143
|
+
## How it stays covered
|
|
144
|
+
|
|
145
|
+
A detector that drops a face for two frames leaks those two frames. So the pipeline pads every mask by a margin, carries tracks forward after they vanish, smooths mask edges over time, fills single-frame gaps, and flags any longer gap in the coverage report instead of hiding it. Defaults are a product decision too: person, face, license plate, and screen run when you name nothing.
|
|
146
|
+
|
|
147
|
+
## CLI reference
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
open-redactor input.mp4 [--output out.mp4]
|
|
151
|
+
--target PHRASE (repeatable) --targets-default --add-target PHRASE
|
|
152
|
+
--preset family|street|screen-share|documents|location
|
|
153
|
+
--mode blur|pixelate|replace --strength N --mask-margin N --carry-frames N
|
|
154
|
+
--preview --shadow --contact-sheet
|
|
155
|
+
--report (default) --no-report
|
|
156
|
+
--sensitive --pii-text --codes
|
|
157
|
+
--audio keep|mute|pitch --pitch-factor 0.8
|
|
158
|
+
--backend api|hosted|local --provider sam|grounding-sam
|
|
159
|
+
--endpoint URL --api-key-env MODEL_API_KEY
|
|
160
|
+
--no-cache --batch --ui
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Exit code is 0 on success. A run that finds zero matches still exits 0 and writes a clean copy with a log line saying nothing matched.
|
|
164
|
+
|
|
165
|
+
## Install
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
pip install open-redactor
|
|
169
|
+
pip install "open-redactor[local]" # optional local models
|
|
170
|
+
pip install "open-redactor[pii]" # optional text scanning, also needs the tesseract binary
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
You need ffmpeg and ffprobe on your PATH. From source: clone this repo and `pip install -e .`
|
|
174
|
+
|
|
175
|
+
## Project layout
|
|
176
|
+
|
|
177
|
+
- `cli.py` the command line, presets, and routing for video and photos
|
|
178
|
+
- `pipeline.py` and `image_pipeline.py` ingest, detection, padding, rendering, reports
|
|
179
|
+
- `sam_client.py` the SAM 3.1 API and hosted client with caching
|
|
180
|
+
- `local_gsam.py` Grounding DINO plus SAM 2 local provider with IoU tracking
|
|
181
|
+
- `masks.py` padding, carry-forward, smoothing, and coverage reports
|
|
182
|
+
- `pii.py`, `codes.py` the text and codes layers
|
|
183
|
+
- `analytics.py`, `replace.py` severity, summaries, shadow audits, and generated stand-ins
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
Apache-2.0. See LICENSE.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "open-redactor"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Open-source CLI to make video share-safe with SAM 3.1 prompt-driven redaction"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Yuriy H" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["video", "redaction", "sam", "privacy", "cli"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"numpy>=1.26",
|
|
23
|
+
"Pillow>=10.0",
|
|
24
|
+
"opencv-python-headless>=4.8",
|
|
25
|
+
"httpx>=0.25",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
dev = [
|
|
30
|
+
"pytest>=7.4",
|
|
31
|
+
"pytest-cov>=4.1",
|
|
32
|
+
]
|
|
33
|
+
pii = [
|
|
34
|
+
"pytesseract>=0.3.10",
|
|
35
|
+
"pandas>=2.0",
|
|
36
|
+
]
|
|
37
|
+
local = [
|
|
38
|
+
"torch>=2.2",
|
|
39
|
+
"transformers>=4.44",
|
|
40
|
+
"accelerate>=0.33",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
open-redactor = "open_redactor.cli:main"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
pythonpath = ["src"]
|