continuityguard-cli 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.
- continuityguard_cli-0.1.0/.gitignore +10 -0
- continuityguard_cli-0.1.0/LICENSE +202 -0
- continuityguard_cli-0.1.0/PKG-INFO +296 -0
- continuityguard_cli-0.1.0/README.md +259 -0
- continuityguard_cli-0.1.0/examples/README.md +29 -0
- continuityguard_cli-0.1.0/pyproject.toml +68 -0
- continuityguard_cli-0.1.0/src/continuityguard/__init__.py +43 -0
- continuityguard_cli-0.1.0/src/continuityguard/cli.py +152 -0
- continuityguard_cli-0.1.0/src/continuityguard/ingest/__init__.py +1 -0
- continuityguard_cli-0.1.0/src/continuityguard/ingest/ffmpeg.py +295 -0
- continuityguard_cli-0.1.0/src/continuityguard/py.typed +0 -0
- continuityguard_cli-0.1.0/src/continuityguard/report/__init__.py +4 -0
- continuityguard_cli-0.1.0/src/continuityguard/report/json_report.py +52 -0
- continuityguard_cli-0.1.0/src/continuityguard/report/terminal.py +85 -0
- continuityguard_cli-0.1.0/src/continuityguard/report/types.py +64 -0
- continuityguard_cli-0.1.0/src/continuityguard/scan.py +147 -0
- continuityguard_cli-0.1.0/src/continuityguard/score/__init__.py +2 -0
- continuityguard_cli-0.1.0/src/continuityguard/score/consistency.py +226 -0
- continuityguard_cli-0.1.0/src/continuityguard/score/models/NOTICE.md +42 -0
- continuityguard_cli-0.1.0/src/continuityguard/score/models/mobilenetv2-7.onnx +0 -0
- continuityguard_cli-0.1.0/src/continuityguard/score/physics.py +170 -0
- continuityguard_cli-0.1.0/tests/__init__.py +0 -0
- continuityguard_cli-0.1.0/tests/conftest.py +20 -0
- continuityguard_cli-0.1.0/tests/test_cli.py +123 -0
- continuityguard_cli-0.1.0/tests/test_consistency.py +215 -0
- continuityguard_cli-0.1.0/tests/test_ffmpeg.py +128 -0
- continuityguard_cli-0.1.0/tests/test_json_report.py +85 -0
- continuityguard_cli-0.1.0/tests/test_physics.py +152 -0
- continuityguard_cli-0.1.0/tests/test_terminal.py +86 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: continuityguard-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local, zero-network CLI and library that scores AI-generated short-drama video clips for character-consistency drift and physics-plausibility issues before you re-render.
|
|
5
|
+
Project-URL: Homepage, https://github.com/RudrenduPaul/ContinuityGuard
|
|
6
|
+
Project-URL: Repository, https://github.com/RudrenduPaul/ContinuityGuard
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/RudrenduPaul/ContinuityGuard/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/RudrenduPaul/ContinuityGuard/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Documentation, https://github.com/RudrenduPaul/ContinuityGuard/blob/main/docs/getting-started.md
|
|
10
|
+
Project-URL: Author - Rudrendu Paul, https://github.com/RudrenduPaul
|
|
11
|
+
Project-URL: Author - Sourav Nandy, https://github.com/Sourav-nandy-ai
|
|
12
|
+
Author: Rudrendu Paul, Sourav Nandy
|
|
13
|
+
License-Expression: Apache-2.0
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Keywords: ai-video,character-consistency,cli,ffmpeg,local-first,offline,onnxruntime,short-drama,video-qa
|
|
16
|
+
Classifier: Development Status :: 3 - Alpha
|
|
17
|
+
Classifier: Environment :: Console
|
|
18
|
+
Classifier: Intended Audience :: Developers
|
|
19
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: Multimedia :: Video
|
|
28
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
29
|
+
Requires-Python: >=3.9
|
|
30
|
+
Requires-Dist: numpy<3,>=1.24
|
|
31
|
+
Requires-Dist: onnxruntime<2,>=1.20
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: build<2,>=1.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest<9,>=7.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: twine<7,>=5.0; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# continuityguard-cli (Python)
|
|
39
|
+
|
|
40
|
+
A local, zero-network CLI and library that scores already-generated AI
|
|
41
|
+
short-drama video clips for character-consistency drift and
|
|
42
|
+
physically-implausible motion, before you spend render credits finding out
|
|
43
|
+
the hard way.
|
|
44
|
+
|
|
45
|
+
[](https://pypi.org/project/continuityguard-cli/)
|
|
46
|
+
[](https://github.com/RudrenduPaul/ContinuityGuard/blob/main/LICENSE)
|
|
47
|
+
[](https://pypi.org/project/continuityguard-cli/)
|
|
48
|
+
|
|
49
|
+
## Why this exists
|
|
50
|
+
|
|
51
|
+
AI short-drama generation ships hundreds of new titles a day, and every
|
|
52
|
+
title is assembled from many separately generated shots. Generation models
|
|
53
|
+
drift: a character's face shifts slightly between cuts, or a motion jumps
|
|
54
|
+
in a way that reads as physically wrong the moment a human watches it.
|
|
55
|
+
Catching that after render is expensive. ContinuityGuard scans a folder of
|
|
56
|
+
already-generated clips and flags the shots worth a second look before you
|
|
57
|
+
commit to a re-render. This package is the Python distribution -- a
|
|
58
|
+
genuine, independent port of the
|
|
59
|
+
[TypeScript/npm CLI](https://github.com/RudrenduPaul/ContinuityGuard), not
|
|
60
|
+
a wrapper around a Node process. It ships the exact same bundled
|
|
61
|
+
MobileNetV2 ONNX model file the TypeScript side uses, so both runtimes
|
|
62
|
+
score identical input against the same weights.
|
|
63
|
+
|
|
64
|
+
**Honest note on the npm side:** as of this package's release, the
|
|
65
|
+
TypeScript/npm distribution of ContinuityGuard has not been published to
|
|
66
|
+
the npm registry yet (the repo's own README says so, and the npm registry
|
|
67
|
+
has no `continuityguard-cli` entry) -- this PyPI package is the first
|
|
68
|
+
published, installable distribution of ContinuityGuard. If you want the
|
|
69
|
+
TypeScript source today, clone the repo and build from source (see the
|
|
70
|
+
[project README](https://github.com/RudrenduPaul/ContinuityGuard#readme)).
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install continuityguard-cli
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
or with [uv](https://docs.astral.sh/uv/):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
uv add continuityguard-cli
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You also need a system `ffmpeg` install (`brew install ffmpeg` on macOS,
|
|
85
|
+
`apt install ffmpeg` on Debian/Ubuntu) -- see "Requirements" below for why
|
|
86
|
+
ffmpeg is not bundled. Everything else -- the 14MB MobileNetV2 ONNX model,
|
|
87
|
+
the scoring logic, the CLI -- ships inside the wheel; nothing else is
|
|
88
|
+
fetched at scan time.
|
|
89
|
+
|
|
90
|
+
## Quickstart
|
|
91
|
+
|
|
92
|
+
Clone the repo to get the bundled fixture clips (not part of the published
|
|
93
|
+
wheel -- they're demo/test content):
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/RudrenduPaul/ContinuityGuard.git
|
|
97
|
+
cd ContinuityGuard
|
|
98
|
+
continuityguard scan src/score/testdata/clips
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Real output, from this repo's own committed synthetic fixtures (no real
|
|
102
|
+
short-drama footage was available for this port; every number is
|
|
103
|
+
reproducible against the fixtures, not illustrative):
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
$ continuityguard scan src/score/testdata/clips
|
|
107
|
+
|
|
108
|
+
ContinuityGuard v0.1 -- Local Character-Consistency & Physics-QA Scoring
|
|
109
|
+
|
|
110
|
+
Scanning: /path/to/ContinuityGuard/src/score/testdata/clips (8 clips, ffmpeg decode)
|
|
111
|
+
|
|
112
|
+
[SCORED] CG01 Clip Ingestion
|
|
113
|
+
8 clips decoded, 51 frames extracted
|
|
114
|
+
|
|
115
|
+
[SCORED] CG02 Character-Consistency Scoring
|
|
116
|
+
3 named characters tracked across 8 clips
|
|
117
|
+
1 shot(s) flagged: low cross-shot similarity (below 0.88 cosine threshold)
|
|
118
|
+
kenji_shot02.mp4 -- "kenji" similarity 0.77 vs. reference (kenji_shot01.mp4)
|
|
119
|
+
NOTE: consistency scoring is best-validated on photorealistic content.
|
|
120
|
+
Accuracy on stylized/anime-adjacent character designs is unverified --
|
|
121
|
+
treat flags on stylized content as a prompt for human review, not a
|
|
122
|
+
confirmed defect. See README "Known limitations."
|
|
123
|
+
|
|
124
|
+
[SCORED] CG03 Physics-Plausibility Heuristic
|
|
125
|
+
2 shot(s) flagged: frame-to-frame motion discontinuity above threshold
|
|
126
|
+
action-discontinuity.mp4 @ frame 4-5 -- discontinuity 8.25x local baseline
|
|
127
|
+
action-discontinuity.mp4 @ frame 5-6 -- discontinuity 8.32x local baseline
|
|
128
|
+
This is a heuristic proxy, not a physics simulator. It flags shots for
|
|
129
|
+
human review. It does not "detect" a physics violation.
|
|
130
|
+
|
|
131
|
+
Report written to ./continuityguard-report.json
|
|
132
|
+
Human-readable summary above. Use --json for the full structured report.
|
|
133
|
+
Scan time: <N>s. Nothing left this machine. No network calls were made.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
These are the same fixtures and the same threshold/multiplier constants
|
|
137
|
+
(`CONSISTENCY_SIMILARITY_THRESHOLD = 0.88`, `DISCONTINUITY_MULTIPLIER = 3`)
|
|
138
|
+
as the TypeScript source -- see the root `CHANGELOG.md` "CG02/CG03 fixture
|
|
139
|
+
calibration" entries for the exact raw numbers those constants came from.
|
|
140
|
+
|
|
141
|
+
Or call the library directly (the agent-native path):
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from continuityguard import scan
|
|
145
|
+
|
|
146
|
+
report = scan("./generated-clips")
|
|
147
|
+
print(f"{len(report.character_consistency.flagged_shots)} consistency flag(s)")
|
|
148
|
+
for flag in report.physics_plausibility.flagged_shots:
|
|
149
|
+
print(f"{flag.clip} @ frame {flag.frame_index_a}-{flag.frame_index_b}: {flag.reason}")
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## CLI reference
|
|
153
|
+
|
|
154
|
+
Real, current `--help` output from the installed CLI:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
$ continuityguard --help
|
|
158
|
+
usage: continuityguard [-h] [-V] {scan} ...
|
|
159
|
+
|
|
160
|
+
Free, local-first CLI that scores already-generated AI short-drama clips/frames
|
|
161
|
+
for character-consistency and physics-plausibility problems. Zero network calls.
|
|
162
|
+
|
|
163
|
+
positional arguments:
|
|
164
|
+
{scan}
|
|
165
|
+
scan scan a directory of generated clips for character-consistency
|
|
166
|
+
and physics-plausibility flags
|
|
167
|
+
|
|
168
|
+
options:
|
|
169
|
+
-h, --help show this help message and exit
|
|
170
|
+
-V, --version show program's version number and exit
|
|
171
|
+
|
|
172
|
+
$ continuityguard scan --help
|
|
173
|
+
usage: continuityguard scan [-h] [--json] [--fps FPS] [--out OUT] directory
|
|
174
|
+
|
|
175
|
+
scan a directory of generated clips for character-consistency and
|
|
176
|
+
physics-plausibility flags
|
|
177
|
+
|
|
178
|
+
positional arguments:
|
|
179
|
+
directory directory of video clips to scan
|
|
180
|
+
|
|
181
|
+
options:
|
|
182
|
+
-h, --help show this help message and exit
|
|
183
|
+
--json print the full machine-readable JSON report to stdout instead
|
|
184
|
+
of a terminal summary
|
|
185
|
+
--fps FPS frame sample rate for ingestion (default: 2.3)
|
|
186
|
+
--out OUT path to write the JSON report file to (default:
|
|
187
|
+
./continuityguard-report.json)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Naming your clips so CG02 can track characters
|
|
191
|
+
|
|
192
|
+
CG02 infers which character a clip belongs to from its filename, using a
|
|
193
|
+
`<character>_<shot-id>.<ext>` convention (for example `mei_shot01.mp4`,
|
|
194
|
+
`mei_shot02.mp4`). Clips sharing a character prefix are compared against
|
|
195
|
+
that character's first-seen shot. Clips that don't match the convention are
|
|
196
|
+
still decoded and scored by CG03, just not compared for character
|
|
197
|
+
consistency.
|
|
198
|
+
|
|
199
|
+
## How it works
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
directory of clips -> ffmpeg frame extraction (CG01, 2.3fps, 224x224 RGB24)
|
|
203
|
+
-> MobileNetV2 ONNX embeddings, cosine similarity vs. reference shot (CG02)
|
|
204
|
+
-> frame-to-frame diff vs. shot's own local median baseline (CG03)
|
|
205
|
+
-> terminal report + JSON report (CG04)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Full module-by-module documentation is in
|
|
209
|
+
[docs/concepts.md](https://github.com/RudrenduPaul/ContinuityGuard/blob/main/docs/concepts.md).
|
|
210
|
+
|
|
211
|
+
## Requirements
|
|
212
|
+
|
|
213
|
+
- Python >= 3.9.
|
|
214
|
+
- A system `ffmpeg` install on `PATH`. Not bundled: a static per-platform
|
|
215
|
+
ffmpeg build would be materially larger than this package's own
|
|
216
|
+
dependency footprint and its licensing terms shift between LGPL and GPL
|
|
217
|
+
depending on which codecs are compiled in -- a review this project isn't
|
|
218
|
+
taking on before there's evidence of real usage. `continuityguard scan`
|
|
219
|
+
checks for ffmpeg at startup and prints the exact install command for
|
|
220
|
+
your OS if it's missing.
|
|
221
|
+
|
|
222
|
+
## Known limitations (read before trusting a flag)
|
|
223
|
+
|
|
224
|
+
Identical caveats to the TypeScript CLI, since both run the same scoring
|
|
225
|
+
logic against the same model:
|
|
226
|
+
|
|
227
|
+
- Character-consistency scoring is best-validated on photorealistic
|
|
228
|
+
content. Its accuracy on stylized or anime-adjacent character designs,
|
|
229
|
+
which describes most short-drama content, is genuinely unverified.
|
|
230
|
+
- The consistency embedding (MobileNetV2's ImageNet-logit vector) measures
|
|
231
|
+
general visual similarity -- color, texture, coarse shape -- not a
|
|
232
|
+
dedicated face-identity embedding. See
|
|
233
|
+
`src/continuityguard/score/models/NOTICE.md` for why this model was used
|
|
234
|
+
instead of a purpose-built face/CLIP embedding model.
|
|
235
|
+
- Physics-plausibility scoring is a frame-to-frame diff heuristic, not a
|
|
236
|
+
physics simulator. Expect both false positives (legitimate fast motion,
|
|
237
|
+
stylized jump-cuts) and false negatives.
|
|
238
|
+
- Thresholds are calibrated on a small, fully synthetic fixture set
|
|
239
|
+
(solid-color clips, no real faces or recorded motion). See the root
|
|
240
|
+
`CHANGELOG.md` for the exact numbers and the command that produced them.
|
|
241
|
+
|
|
242
|
+
## Fidelity to the TypeScript source
|
|
243
|
+
|
|
244
|
+
This is a line-for-line port of the scoring math (`preprocess_frame`,
|
|
245
|
+
`cosine_similarity`, `compute_frame_diff`, `detect_discontinuities`) and
|
|
246
|
+
uses the identical bundled `mobilenetv2-7.onnx` weights. On this repo's
|
|
247
|
+
own fixture clips, the Python CLI reproduces the same flagged shots at the
|
|
248
|
+
same thresholds as the TypeScript CLI's documented benchmark (see the root
|
|
249
|
+
README's "What it does" section for the reference numbers). Floating-point
|
|
250
|
+
inference results can differ in the last few decimal places between
|
|
251
|
+
`onnxruntime` (Python) and `onnxruntime-node` (the same underlying ONNX
|
|
252
|
+
Runtime project, different language binding) on some hardware; this does
|
|
253
|
+
not change which shots cross the fixed 0.88 / 3x thresholds on the
|
|
254
|
+
committed fixtures.
|
|
255
|
+
|
|
256
|
+
## CI integration
|
|
257
|
+
|
|
258
|
+
```yaml
|
|
259
|
+
- uses: actions/checkout@v4
|
|
260
|
+
- uses: actions/setup-python@v5
|
|
261
|
+
with:
|
|
262
|
+
python-version: '3.12'
|
|
263
|
+
- run: sudo apt-get update && sudo apt-get install -y ffmpeg
|
|
264
|
+
- run: pip install continuityguard-cli
|
|
265
|
+
- run: continuityguard scan ./generated-clips --json --out report.json
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
Full walkthrough in
|
|
269
|
+
[docs/integrations/ci.md](https://github.com/RudrenduPaul/ContinuityGuard/blob/main/docs/integrations/ci.md).
|
|
270
|
+
|
|
271
|
+
## Security
|
|
272
|
+
|
|
273
|
+
ContinuityGuard never `eval()`s or dynamically executes anything read from
|
|
274
|
+
a scanned clip; clip bytes are only ever decoded by ffmpeg (invoked with an
|
|
275
|
+
explicit argument list, never a shell string) and read back as raw pixel
|
|
276
|
+
data. See
|
|
277
|
+
[SECURITY.md](https://github.com/RudrenduPaul/ContinuityGuard/blob/main/SECURITY.md)
|
|
278
|
+
for the disclosure process. **Honest note**: this project does not
|
|
279
|
+
currently publish SLSA provenance, Sigstore signatures, or an SBOM, and has
|
|
280
|
+
no OpenSSF Scorecard badge -- none of that infrastructure exists yet, so it
|
|
281
|
+
isn't claimed here.
|
|
282
|
+
|
|
283
|
+
## Contributing
|
|
284
|
+
|
|
285
|
+
See [CONTRIBUTING.md](https://github.com/RudrenduPaul/ContinuityGuard/blob/main/CONTRIBUTING.md).
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
cd python
|
|
289
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
290
|
+
pip install -e ".[dev]"
|
|
291
|
+
pytest
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
## License
|
|
295
|
+
|
|
296
|
+
Apache 2.0, see [LICENSE](https://github.com/RudrenduPaul/ContinuityGuard/blob/main/LICENSE).
|