OpenScrub 1.0.75__tar.gz → 1.0.76__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.
- {openscrub-1.0.75 → openscrub-1.0.76}/PKG-INFO +1 -1
- {openscrub-1.0.75 → openscrub-1.0.76}/openscrub.py +50 -1
- {openscrub-1.0.75 → openscrub-1.0.76}/test_openscrub.py +38 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/.gitignore +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/LICENSE +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/NOTICE +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/README.md +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/assets/openscrub.ico +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/deploy/README.md +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/face_models.json +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/install.py +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/openscrub_setup.py +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/openscrub_update.py +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/openscrub_vault.py +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/openscrub_web.py +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/person_models.json +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/plate_models.json +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/pyproject.toml +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/requirements.txt +0 -0
- {openscrub-1.0.75 → openscrub-1.0.76}/zones_ui.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: OpenScrub
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.76
|
|
4
4
|
Summary: Local, GPU-accelerated redaction for video and screen recordings — blur, black-box, or mosaic faces, names, and any regex-matchable PII, with human review.
|
|
5
5
|
Project-URL: Homepage, https://github.com/austinmabry/OpenScrub
|
|
6
6
|
Project-URL: Repository, https://github.com/austinmabry/OpenScrub
|
|
@@ -36,7 +36,7 @@ from dataclasses import dataclass, asdict
|
|
|
36
36
|
import cv2
|
|
37
37
|
import numpy as np
|
|
38
38
|
|
|
39
|
-
VERSION = "1.0.
|
|
39
|
+
VERSION = "1.0.76"
|
|
40
40
|
|
|
41
41
|
# ----------------------------------------------------------------------------
|
|
42
42
|
# OCR backends
|
|
@@ -3153,6 +3153,22 @@ def _dedupe_dense(act):
|
|
|
3153
3153
|
if not (d.dense and d.track >= 0 and latest[d.track] is not d)]
|
|
3154
3154
|
|
|
3155
3155
|
|
|
3156
|
+
def _suppress_textless_bands(bands, n_raw_hits):
|
|
3157
|
+
"""-> (bands, suppressed). Safety bands exist to cover unscanned TEXT
|
|
3158
|
+
scrolling into view. A scan whose OCR found ZERO text in any sampled
|
|
3159
|
+
frame has proven there is nothing for bands to protect — but camera
|
|
3160
|
+
bob still fakes scroll offsets on handheld footage that
|
|
3161
|
+
probe_camera_motion reads as static (too steady to look like a
|
|
3162
|
+
camera), and a real selfie job (address category, no on-screen text)
|
|
3163
|
+
shipped with a thin phantom blur bar at the bottom edge. With zero
|
|
3164
|
+
text hits there is no text-leak risk to mitigate, so dropping the
|
|
3165
|
+
bands is fail-closed by construction; any text hit at all keeps them
|
|
3166
|
+
untouched."""
|
|
3167
|
+
if n_raw_hits or not any(abs(x) > 2 or abs(y) > 2 for x, y in bands):
|
|
3168
|
+
return bands, False
|
|
3169
|
+
return [(0.0, 0.0)] * len(bands), True
|
|
3170
|
+
|
|
3171
|
+
|
|
3156
3172
|
# Output quality tiers (--out-quality): per-encoder constant-quality
|
|
3157
3173
|
# values. archival = visually lossless (the historical fixed setting —
|
|
3158
3174
|
# a 12s 1080x1920/60 HDR clip came out 142MB, too big to share);
|
|
@@ -3175,6 +3191,31 @@ def _out_q(codec, quality):
|
|
|
3175
3191
|
quality or "archival", _OUT_QUALITY[codec]["archival"])
|
|
3176
3192
|
|
|
3177
3193
|
|
|
3194
|
+
# bits-per-pixel budgets for the size-oriented tiers on NVENC. Constant-
|
|
3195
|
+
# quality NVENC has no size anchor: on noisy 4K/60 HDR footage cq~30
|
|
3196
|
+
# still produced a 123MB 12-second "share" file. A VBR ceiling scaled by
|
|
3197
|
+
# resolution and fps makes the tiers mean something in MB (12s of 4K60
|
|
3198
|
+
# HEVC "share" ≈ 30MB, 1080p30 h264 ≈ 5MB); quality mode still governs
|
|
3199
|
+
# below the ceiling. archival stays pure constant-quality, uncapped.
|
|
3200
|
+
_TIER_BPP = {"balanced": {"h264": 0.14, "hevc": 0.10},
|
|
3201
|
+
"share": {"h264": 0.06, "hevc": 0.04}}
|
|
3202
|
+
|
|
3203
|
+
|
|
3204
|
+
def _rate_cap_args(codec, out_quality, w, h, fps):
|
|
3205
|
+
"""-> extra ffmpeg args (possibly []) putting a resolution-scaled
|
|
3206
|
+
bitrate ceiling on NVENC for the balanced/share tiers. Pure —
|
|
3207
|
+
unit-tested. CPU x264/x265 CRF and QSV global_quality already track
|
|
3208
|
+
size predictably and are left alone."""
|
|
3209
|
+
if not codec.endswith("_nvenc"):
|
|
3210
|
+
return []
|
|
3211
|
+
bpp = _TIER_BPP.get(out_quality or "", {}).get(
|
|
3212
|
+
"hevc" if codec.startswith("hevc") else "h264")
|
|
3213
|
+
if not bpp:
|
|
3214
|
+
return []
|
|
3215
|
+
cap = int(w * h * max(1.0, fps) * bpp)
|
|
3216
|
+
return ["-maxrate", str(cap), "-bufsize", str(2 * cap)]
|
|
3217
|
+
|
|
3218
|
+
|
|
3178
3219
|
def render_hdr(src, dst, detections, cum, bands, fps, pad, mode,
|
|
3179
3220
|
encoder, tags, band_margin=25, progress_every=60, cb=None,
|
|
3180
3221
|
mode_map=None, face_shape="ellipse", audio_spans=None,
|
|
@@ -3211,6 +3252,7 @@ def render_hdr(src, dst, detections, cum, bands, fps, pad, mode,
|
|
|
3211
3252
|
if encoder == "hevc_qsv" else
|
|
3212
3253
|
["-c:v", "libx265", "-crf", q, "-preset", "fast",
|
|
3213
3254
|
"-pix_fmt", "yuv420p10le"])
|
|
3255
|
+
vargs += _rate_cap_args(encoder, out_quality, w, h, fps)
|
|
3214
3256
|
targs = [a for kv in (tags or {}).items() for a in kv]
|
|
3215
3257
|
if os.path.splitext(dst)[1].lower() in (".mp4", ".mov"):
|
|
3216
3258
|
targs += ["-tag:v", "hvc1"] # QuickTime/Apple compatibility
|
|
@@ -3368,6 +3410,7 @@ def render(src, dst, detections, cum, bands, fps, pad, mode, preview,
|
|
|
3368
3410
|
vargs = ["-c:v", "libx265", "-crf", q, "-preset", "fast"]
|
|
3369
3411
|
else:
|
|
3370
3412
|
vargs = ["-c:v", "libx264", "-crf", q, "-preset", "fast"]
|
|
3413
|
+
vargs += _rate_cap_args(codec, out_quality, w, h, fps)
|
|
3371
3414
|
if codec in ("hevc_nvenc", "hevc_qsv", "libx265") \
|
|
3372
3415
|
and os.path.splitext(dst)[1].lower() in (".mp4", ".mov"):
|
|
3373
3416
|
vargs += ["-tag:v", "hvc1"] # QuickTime/Apple compatibility
|
|
@@ -7135,6 +7178,12 @@ def run_scan(args, cb=None):
|
|
|
7135
7178
|
cb.log(" top recalled strings (check for false positives): "
|
|
7136
7179
|
+ ", ".join(f"'{k}'x{v}" for k, v in top))
|
|
7137
7180
|
|
|
7181
|
+
bands, _bsup = _suppress_textless_bands(bands, len(raw))
|
|
7182
|
+
if _bsup:
|
|
7183
|
+
cb.log(" safety bands: suppressed — the scan found no text "
|
|
7184
|
+
"anywhere, so edge bands (which exist to cover unscanned "
|
|
7185
|
+
"text) could only be camera-motion artifacts")
|
|
7186
|
+
|
|
7138
7187
|
audio_sugg, audio_tx = [], []
|
|
7139
7188
|
if getattr(args, "audio_pii", False):
|
|
7140
7189
|
# spoken names/numbers/addresses leak PII no matter how good the
|
|
@@ -820,6 +820,44 @@ def test_audio_redaction_mute_and_report_roundtrip(tmp_path):
|
|
|
820
820
|
assert acodec == ["-c:a", "copy"], "no audio stream -> plain copy"
|
|
821
821
|
|
|
822
822
|
|
|
823
|
+
def test_textless_band_suppression():
|
|
824
|
+
"""A scan with ZERO OCR text hits must drop its safety bands: bands
|
|
825
|
+
exist to cover unscanned text, and on handheld footage the camera-
|
|
826
|
+
motion probe reads as static, camera bob fakes scroll offsets — a
|
|
827
|
+
real address-only selfie job shipped a thin phantom blur bar at the
|
|
828
|
+
bottom edge. Any text hit at all keeps bands untouched (fail
|
|
829
|
+
closed)."""
|
|
830
|
+
moving = [(0.0, 0.0), (0.0, -4.0), (3.0, 0.0), (0.0, 0.0)]
|
|
831
|
+
out, sup = openscrub._suppress_textless_bands(list(moving), 0)
|
|
832
|
+
assert sup and all(x == 0 and y == 0 for x, y in out)
|
|
833
|
+
assert len(out) == len(moving)
|
|
834
|
+
# text WAS found -> bands untouched, no matter the offsets
|
|
835
|
+
out, sup = openscrub._suppress_textless_bands(list(moving), 7)
|
|
836
|
+
assert not sup and out == moving
|
|
837
|
+
# already-quiet bands (sub-threshold jitter) -> untouched, not "suppressed"
|
|
838
|
+
quiet = [(0.0, 0.0), (1.0, -1.5)]
|
|
839
|
+
out, sup = openscrub._suppress_textless_bands(list(quiet), 0)
|
|
840
|
+
assert not sup and out == quiet
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
def test_rate_cap_args_nvenc_only():
|
|
844
|
+
"""The balanced/share bitrate ceiling applies to NVENC only (constant-
|
|
845
|
+
quality NVENC has no size anchor — a 12s 4K 'share' render came out
|
|
846
|
+
123MB), scales with resolution/fps, and never touches archival or the
|
|
847
|
+
CPU/QSV encoders."""
|
|
848
|
+
a = openscrub._rate_cap_args("hevc_nvenc", "share", 3840, 2160, 60.0)
|
|
849
|
+
assert a[0] == "-maxrate" and a[2] == "-bufsize"
|
|
850
|
+
cap = int(a[1])
|
|
851
|
+
assert cap == int(3840 * 2160 * 60 * 0.04) and int(a[3]) == 2 * cap
|
|
852
|
+
small = int(openscrub._rate_cap_args(
|
|
853
|
+
"h264_nvenc", "share", 1080, 1920, 30.0)[1])
|
|
854
|
+
assert small < cap # scales down
|
|
855
|
+
assert openscrub._rate_cap_args("hevc_nvenc", "archival",
|
|
856
|
+
3840, 2160, 60.0) == []
|
|
857
|
+
assert openscrub._rate_cap_args("libx264", "share", 3840, 2160, 60.0) == []
|
|
858
|
+
assert openscrub._rate_cap_args("hevc_qsv", "share", 3840, 2160, 60.0) == []
|
|
859
|
+
|
|
860
|
+
|
|
823
861
|
def test_out_quality_tiers_shrink_output(tmp_path):
|
|
824
862
|
"""--out-quality maps to per-encoder constant-quality values: share <
|
|
825
863
|
balanced < archival in file size, with identical frame counts (the
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|