opencontext-video 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.
Files changed (73) hide show
  1. opencontext_video-0.1.0/LICENSE +21 -0
  2. opencontext_video-0.1.0/PKG-INFO +253 -0
  3. opencontext_video-0.1.0/README.md +215 -0
  4. opencontext_video-0.1.0/pyproject.toml +69 -0
  5. opencontext_video-0.1.0/setup.cfg +4 -0
  6. opencontext_video-0.1.0/src/oc_worker/__init__.py +14 -0
  7. opencontext_video-0.1.0/src/oc_worker/agent.py +315 -0
  8. opencontext_video-0.1.0/src/oc_worker/aggregation.py +160 -0
  9. opencontext_video-0.1.0/src/oc_worker/api_client.py +296 -0
  10. opencontext_video-0.1.0/src/oc_worker/cli.py +895 -0
  11. opencontext_video-0.1.0/src/oc_worker/config.py +122 -0
  12. opencontext_video-0.1.0/src/oc_worker/context.py +590 -0
  13. opencontext_video-0.1.0/src/oc_worker/contract.py +113 -0
  14. opencontext_video-0.1.0/src/oc_worker/errors.py +30 -0
  15. opencontext_video-0.1.0/src/oc_worker/evaluation.py +148 -0
  16. opencontext_video-0.1.0/src/oc_worker/ffmpeg.py +276 -0
  17. opencontext_video-0.1.0/src/oc_worker/main.py +133 -0
  18. opencontext_video-0.1.0/src/oc_worker/mcp_server.py +151 -0
  19. opencontext_video-0.1.0/src/oc_worker/models.py +201 -0
  20. opencontext_video-0.1.0/src/oc_worker/pdf.py +74 -0
  21. opencontext_video-0.1.0/src/oc_worker/pipeline.py +699 -0
  22. opencontext_video-0.1.0/src/oc_worker/providers/__init__.py +143 -0
  23. opencontext_video-0.1.0/src/oc_worker/providers/http_status.py +31 -0
  24. opencontext_video-0.1.0/src/oc_worker/providers/ocr/__init__.py +7 -0
  25. opencontext_video-0.1.0/src/oc_worker/providers/ocr/base.py +17 -0
  26. opencontext_video-0.1.0/src/oc_worker/providers/ocr/fixture.py +19 -0
  27. opencontext_video-0.1.0/src/oc_worker/providers/ocr/tesseract.py +94 -0
  28. opencontext_video-0.1.0/src/oc_worker/providers/text/__init__.py +5 -0
  29. opencontext_video-0.1.0/src/oc_worker/providers/text/base.py +32 -0
  30. opencontext_video-0.1.0/src/oc_worker/providers/text/ollama.py +83 -0
  31. opencontext_video-0.1.0/src/oc_worker/providers/text/openai_compatible.py +93 -0
  32. opencontext_video-0.1.0/src/oc_worker/providers/text/template.py +17 -0
  33. opencontext_video-0.1.0/src/oc_worker/providers/transcription/__init__.py +5 -0
  34. opencontext_video-0.1.0/src/oc_worker/providers/transcription/base.py +17 -0
  35. opencontext_video-0.1.0/src/oc_worker/providers/transcription/faster_whisper.py +43 -0
  36. opencontext_video-0.1.0/src/oc_worker/providers/transcription/fixture.py +24 -0
  37. opencontext_video-0.1.0/src/oc_worker/providers/transcription/openai_audio.py +119 -0
  38. opencontext_video-0.1.0/src/oc_worker/providers/transcription/openai_compatible.py +85 -0
  39. opencontext_video-0.1.0/src/oc_worker/providers/vision/__init__.py +5 -0
  40. opencontext_video-0.1.0/src/oc_worker/providers/vision/base.py +20 -0
  41. opencontext_video-0.1.0/src/oc_worker/providers/vision/fixture.py +38 -0
  42. opencontext_video-0.1.0/src/oc_worker/providers/vision/ollama.py +69 -0
  43. opencontext_video-0.1.0/src/oc_worker/providers/vision/openai_compatible.py +166 -0
  44. opencontext_video-0.1.0/src/oc_worker/replay.py +411 -0
  45. opencontext_video-0.1.0/src/opencontext_video.egg-info/PKG-INFO +253 -0
  46. opencontext_video-0.1.0/src/opencontext_video.egg-info/SOURCES.txt +71 -0
  47. opencontext_video-0.1.0/src/opencontext_video.egg-info/dependency_links.txt +1 -0
  48. opencontext_video-0.1.0/src/opencontext_video.egg-info/entry_points.txt +3 -0
  49. opencontext_video-0.1.0/src/opencontext_video.egg-info/requires.txt +20 -0
  50. opencontext_video-0.1.0/src/opencontext_video.egg-info/top_level.txt +1 -0
  51. opencontext_video-0.1.0/tests/test_agent.py +127 -0
  52. opencontext_video-0.1.0/tests/test_aggregation.py +320 -0
  53. opencontext_video-0.1.0/tests/test_api_client.py +475 -0
  54. opencontext_video-0.1.0/tests/test_cli.py +380 -0
  55. opencontext_video-0.1.0/tests/test_config.py +120 -0
  56. opencontext_video-0.1.0/tests/test_context.py +359 -0
  57. opencontext_video-0.1.0/tests/test_e2e_fixture.py +356 -0
  58. opencontext_video-0.1.0/tests/test_evaluation.py +125 -0
  59. opencontext_video-0.1.0/tests/test_ffmpeg.py +63 -0
  60. opencontext_video-0.1.0/tests/test_fixture_providers.py +22 -0
  61. opencontext_video-0.1.0/tests/test_image_normalization.py +36 -0
  62. opencontext_video-0.1.0/tests/test_main.py +31 -0
  63. opencontext_video-0.1.0/tests/test_mcp_server.py +79 -0
  64. opencontext_video-0.1.0/tests/test_models.py +256 -0
  65. opencontext_video-0.1.0/tests/test_ocr_providers.py +82 -0
  66. opencontext_video-0.1.0/tests/test_opencode_audio_smoke.py +81 -0
  67. opencontext_video-0.1.0/tests/test_opencode_vision_smoke.py +183 -0
  68. opencontext_video-0.1.0/tests/test_pdf.py +35 -0
  69. opencontext_video-0.1.0/tests/test_pipeline.py +1071 -0
  70. opencontext_video-0.1.0/tests/test_provider_diagnostics.py +330 -0
  71. opencontext_video-0.1.0/tests/test_providers.py +100 -0
  72. opencontext_video-0.1.0/tests/test_replay.py +217 -0
  73. opencontext_video-0.1.0/tests/test_smoke.py +8 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OpenContext contributors
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.
@@ -0,0 +1,253 @@
1
+ Metadata-Version: 2.4
2
+ Name: opencontext-video
3
+ Version: 0.1.0
4
+ Summary: Turn video and images into evidence-linked developer context for text-only AI
5
+ Author: OpenContext contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/kylosonic/opencontext
8
+ Project-URL: Repository, https://github.com/kylosonic/opencontext
9
+ Project-URL: Issues, https://github.com/kylosonic/opencontext/issues
10
+ Keywords: video,transcription,ocr,developer-context,ai
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Multimedia :: Video
17
+ Requires-Python: >=3.13
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: httpx
21
+ Requires-Dist: imageio-ffmpeg
22
+ Requires-Dist: pillow
23
+ Requires-Dist: pydantic
24
+ Requires-Dist: pypdfium2
25
+ Requires-Dist: python-dotenv
26
+ Provides-Extra: dev
27
+ Requires-Dist: build; extra == "dev"
28
+ Requires-Dist: mcp<3,>=2.3; extra == "dev"
29
+ Requires-Dist: pytest; extra == "dev"
30
+ Requires-Dist: ruff; extra == "dev"
31
+ Requires-Dist: twine; extra == "dev"
32
+ Provides-Extra: agent
33
+ Requires-Dist: mcp<3,>=2.3; extra == "agent"
34
+ Provides-Extra: local
35
+ Requires-Dist: faster-whisper; extra == "local"
36
+ Requires-Dist: av<19,>=11; extra == "local"
37
+ Dynamic: license-file
38
+
39
+ # opencontext-video
40
+
41
+ The OpenContext media processing worker. It ingests uploaded videos, still
42
+ images, image sets, and PDFs, then runs the media-to-context pipeline:
43
+ extracting audio and frames, rendering PDF pages, transcribing speech when
44
+ present, applying vision and OCR, aligning results on a shared timeline, and
45
+ producing evidence-linked developer context.
46
+
47
+ The worker polls the OpenContext API, processes jobs through resumable stages,
48
+ and stores timestamped transcript, visual, and OCR evidence in the result
49
+ payload. Text claims carry stable evidence IDs and certainty labels in both
50
+ Markdown and JSON exports.
51
+
52
+ ## Install
53
+
54
+ ```bash
55
+ pip install opencontext-video
56
+ ```
57
+
58
+ For local speech recognition:
59
+
60
+ ```bash
61
+ pip install "opencontext-video[local]"
62
+ ```
63
+
64
+ The `local` extra pins PyAV below 19 because Faster Whisper 1.2.1 still passes
65
+ the removed `metadata_errors` argument to `av.open()`. Remove the pin after
66
+ Faster Whisper publishes a release compatible with PyAV 19+.
67
+
68
+ ## CLI
69
+
70
+ Analyze a local video without running the web app or database:
71
+
72
+ ```bash
73
+ opencontext analyze video.mp4 --out context.md --json context.json
74
+ ```
75
+
76
+ Still images use the same command and output contract:
77
+
78
+ ```bash
79
+ opencontext analyze mockup.png --out context.md --json context.json
80
+ ```
81
+
82
+ PDFs up to 30 pages use the same output contract and combine embedded text with
83
+ rendered-page vision evidence:
84
+
85
+ ```bash
86
+ opencontext analyze reference.pdf --out context.md --json context.json
87
+ ```
88
+
89
+ The web upload flow can submit up to 10 images as one ordered image-set job with
90
+ cross-image comparisons. CLI batch mode analyzes each file independently and
91
+ keeps collision-safe per-file outputs.
92
+
93
+ Use `--offline` to run the full extraction and export path with clearly labeled
94
+ fixture transcription and vision output:
95
+
96
+ ```bash
97
+ opencontext analyze video.mp4 --offline --out context.md --json context.json
98
+ ```
99
+
100
+ The CLI accepts `LOW`, `MEDIUM`, or `HIGH` via `--detail-level`, and provider
101
+ overrides via `--transcription-provider`, `--vision-provider`, and
102
+ `--text-provider`.
103
+
104
+ Analyze every supported file in a directory:
105
+
106
+ ```bash
107
+ opencontext analyze ./recordings --output-dir ./context --offline
108
+ ```
109
+
110
+ Batch mode writes collision-safe `<name>.md` and `<name>.json` pairs and prints
111
+ a JSON summary with success and failure counts. It continues after an invalid
112
+ input, preserves outputs that already succeeded, and exits non-zero when any
113
+ item fails. Use `--quiet` to suppress the summary.
114
+
115
+ Turn an existing result into a repository-aware implementation brief:
116
+
117
+ ```bash
118
+ opencontext brief context.json --repo ../my-app \
119
+ --task "Implement the recorded settings flow" --out implementation-brief.md
120
+ ```
121
+
122
+ The brief preserves evidence IDs, detects repository languages and manifests,
123
+ and separates observed behavior from inferred or uncertain claims.
124
+
125
+ Score a context result against a ground-truth evaluation item:
126
+
127
+ ```bash
128
+ opencontext evaluate context.json \
129
+ --truth docs/evaluation/fixture-dataset.json \
130
+ --model-name fixture --model-version 1 \
131
+ --measurement-kind fixture-baseline --out evaluation.json
132
+ ```
133
+
134
+ The report includes transcript WER/CER, OCR precision/recall/F1, and visual
135
+ keyword recall. Fixture, smoke-test, and measured runs remain separately labeled.
136
+
137
+ Check the local runtime and configured providers before submitting a job:
138
+
139
+ ```bash
140
+ opencontext doctor --offline
141
+ opencontext doctor --offline --json
142
+ ```
143
+
144
+ The report labels each item `OK`, `MISSING`, or `UNVERIFIED` without printing
145
+ API keys or tokens. Network checks are opt-in with `--check-network` and use a
146
+ three-second timeout. `--json` emits one document containing an overall `ok`
147
+ value and ordered checks for setup scripts and CI preflight checks.
148
+
149
+ When configuring `TRANSCRIPTION_PROVIDER=faster_whisper` as in `.env.example`,
150
+ install the `local` extra alongside `dev`:
151
+
152
+ ```bash
153
+ cd workers/processor
154
+ python -m venv .venv
155
+ # Windows
156
+ .venv/Scripts/python -m pip install -e ".[dev,local]"
157
+ .venv/Scripts/python -m oc_worker.main
158
+ # macOS/Linux
159
+ .venv/bin/python -m pip install -e ".[dev,local]"
160
+ .venv/bin/python -m oc_worker.main
161
+ ```
162
+
163
+ Use `--once` to claim and process at most one job, which is useful for
164
+ integration tests and cron-style deployments:
165
+
166
+ ```bash
167
+ python -m oc_worker.main --once
168
+ ```
169
+
170
+ Set `WORKER_API_TOKEN` to the same value used by the web app before starting
171
+ the worker. Provider settings are read from the worker process environment.
172
+
173
+ ## Local providers
174
+
175
+ - `TRANSCRIPTION_PROVIDER=faster_whisper` runs speech recognition locally;
176
+ install the `local` extra and allow the first model download.
177
+ - `TRANSCRIPTION_PROVIDER=openai_audio` sends extracted WAV audio to an
178
+ audio-capable OpenAI-compatible chat model through the same `OPENAI_BASE_URL`
179
+ and API-key settings used for hosted vision.
180
+ - `VISION_PROVIDER=ollama` remains available for a local Ollama server.
181
+ - `VISION_PROVIDER=openai_compatible` can call OpenCode Go with
182
+ `OPENAI_BASE_URL=https://opencode.ai/inference/go/openai/v1`,
183
+ `OPENCODE_API_KEY`, and an image-capable `VISION_MODEL`.
184
+ - `OCR_PROVIDER=tesseract` extracts text independently with the local
185
+ Tesseract binary. `OCR_PROVIDER=vision` keeps the compatibility behavior of
186
+ deriving OCR rows from the vision provider's `visibleText`.
187
+ - `TRANSCRIPTION_PROVIDER=fixture` and `VISION_PROVIDER=fixture` provide
188
+ deterministic, clearly labeled output for offline tests. They do not run
189
+ speech recognition or computer vision and should not be used to claim real
190
+ analysis quality.
191
+
192
+ The generated-media integration tests in `tests/test_e2e_fixture.py` invoke
193
+ real FFmpeg and PDFium for probing, audio and frame extraction, still-image
194
+ conversion, image sets, and PDF page rendering, while using fixture providers
195
+ for inference.
196
+
197
+ ## Real OpenCode Go vision smoke test
198
+
199
+ The hosted vision test is opt-in because it calls an external API:
200
+
201
+ ```bash
202
+ export OPENCODE_API_KEY=...
203
+ export OPENAI_BASE_URL=https://opencode.ai/inference/go/openai/v1
204
+ export VISION_MODEL=glm-5.3-flash
205
+ OPENCONTEXT_OPENCODE_E2E=1 pytest tests/test_opencode_vision_smoke.py -q
206
+ ```
207
+
208
+ The test verifies the model catalog accepts image input, analyzes a generated
209
+ frame, and runs a synthetic checkout reference through the full image pipeline.
210
+ It requires the model to recover at least two of the expected UI/OCR labels.
211
+ This is a setup smoke test, not evidence of broad model quality.
212
+
213
+ ## Real OpenCode Go audio smoke test
214
+
215
+ ```bash
216
+ export OPENCODE_API_KEY=...
217
+ export OPENAI_BASE_URL=https://opencode.ai/inference/go/openai/v1
218
+ export TRANSCRIPTION_MODEL=mimo-v2.6-pro
219
+ OPENCONTEXT_OPENCODE_AUDIO_E2E=1 pytest tests/test_opencode_audio_smoke.py -q
220
+ ```
221
+
222
+ This checks model-catalog audio support and transcribes the attributed Harvard
223
+ sentence recording committed under `docs/evaluation/`.
224
+
225
+ ## MCP server
226
+
227
+ Install the agent extra:
228
+
229
+ ```bash
230
+ pip install "opencontext-video[agent]"
231
+ opencontext-mcp
232
+ ```
233
+
234
+ The stdio MCP server exposes:
235
+
236
+ - `analyze_media` — analyze a local video or image and return an evidence-linked
237
+ brief.
238
+ - `analyze_video` and `analyze_image` — explicit compatibility entry points.
239
+ - `implementation_brief` — convert an existing context JSON result into a brief.
240
+ - `context_evidence` — return the bounded evidence ledger.
241
+
242
+ Example client configuration:
243
+
244
+ ```json
245
+ {
246
+ "mcpServers": {
247
+ "opencontext": {
248
+ "command": "opencontext-mcp",
249
+ "args": []
250
+ }
251
+ }
252
+ }
253
+ ```
@@ -0,0 +1,215 @@
1
+ # opencontext-video
2
+
3
+ The OpenContext media processing worker. It ingests uploaded videos, still
4
+ images, image sets, and PDFs, then runs the media-to-context pipeline:
5
+ extracting audio and frames, rendering PDF pages, transcribing speech when
6
+ present, applying vision and OCR, aligning results on a shared timeline, and
7
+ producing evidence-linked developer context.
8
+
9
+ The worker polls the OpenContext API, processes jobs through resumable stages,
10
+ and stores timestamped transcript, visual, and OCR evidence in the result
11
+ payload. Text claims carry stable evidence IDs and certainty labels in both
12
+ Markdown and JSON exports.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install opencontext-video
18
+ ```
19
+
20
+ For local speech recognition:
21
+
22
+ ```bash
23
+ pip install "opencontext-video[local]"
24
+ ```
25
+
26
+ The `local` extra pins PyAV below 19 because Faster Whisper 1.2.1 still passes
27
+ the removed `metadata_errors` argument to `av.open()`. Remove the pin after
28
+ Faster Whisper publishes a release compatible with PyAV 19+.
29
+
30
+ ## CLI
31
+
32
+ Analyze a local video without running the web app or database:
33
+
34
+ ```bash
35
+ opencontext analyze video.mp4 --out context.md --json context.json
36
+ ```
37
+
38
+ Still images use the same command and output contract:
39
+
40
+ ```bash
41
+ opencontext analyze mockup.png --out context.md --json context.json
42
+ ```
43
+
44
+ PDFs up to 30 pages use the same output contract and combine embedded text with
45
+ rendered-page vision evidence:
46
+
47
+ ```bash
48
+ opencontext analyze reference.pdf --out context.md --json context.json
49
+ ```
50
+
51
+ The web upload flow can submit up to 10 images as one ordered image-set job with
52
+ cross-image comparisons. CLI batch mode analyzes each file independently and
53
+ keeps collision-safe per-file outputs.
54
+
55
+ Use `--offline` to run the full extraction and export path with clearly labeled
56
+ fixture transcription and vision output:
57
+
58
+ ```bash
59
+ opencontext analyze video.mp4 --offline --out context.md --json context.json
60
+ ```
61
+
62
+ The CLI accepts `LOW`, `MEDIUM`, or `HIGH` via `--detail-level`, and provider
63
+ overrides via `--transcription-provider`, `--vision-provider`, and
64
+ `--text-provider`.
65
+
66
+ Analyze every supported file in a directory:
67
+
68
+ ```bash
69
+ opencontext analyze ./recordings --output-dir ./context --offline
70
+ ```
71
+
72
+ Batch mode writes collision-safe `<name>.md` and `<name>.json` pairs and prints
73
+ a JSON summary with success and failure counts. It continues after an invalid
74
+ input, preserves outputs that already succeeded, and exits non-zero when any
75
+ item fails. Use `--quiet` to suppress the summary.
76
+
77
+ Turn an existing result into a repository-aware implementation brief:
78
+
79
+ ```bash
80
+ opencontext brief context.json --repo ../my-app \
81
+ --task "Implement the recorded settings flow" --out implementation-brief.md
82
+ ```
83
+
84
+ The brief preserves evidence IDs, detects repository languages and manifests,
85
+ and separates observed behavior from inferred or uncertain claims.
86
+
87
+ Score a context result against a ground-truth evaluation item:
88
+
89
+ ```bash
90
+ opencontext evaluate context.json \
91
+ --truth docs/evaluation/fixture-dataset.json \
92
+ --model-name fixture --model-version 1 \
93
+ --measurement-kind fixture-baseline --out evaluation.json
94
+ ```
95
+
96
+ The report includes transcript WER/CER, OCR precision/recall/F1, and visual
97
+ keyword recall. Fixture, smoke-test, and measured runs remain separately labeled.
98
+
99
+ Check the local runtime and configured providers before submitting a job:
100
+
101
+ ```bash
102
+ opencontext doctor --offline
103
+ opencontext doctor --offline --json
104
+ ```
105
+
106
+ The report labels each item `OK`, `MISSING`, or `UNVERIFIED` without printing
107
+ API keys or tokens. Network checks are opt-in with `--check-network` and use a
108
+ three-second timeout. `--json` emits one document containing an overall `ok`
109
+ value and ordered checks for setup scripts and CI preflight checks.
110
+
111
+ When configuring `TRANSCRIPTION_PROVIDER=faster_whisper` as in `.env.example`,
112
+ install the `local` extra alongside `dev`:
113
+
114
+ ```bash
115
+ cd workers/processor
116
+ python -m venv .venv
117
+ # Windows
118
+ .venv/Scripts/python -m pip install -e ".[dev,local]"
119
+ .venv/Scripts/python -m oc_worker.main
120
+ # macOS/Linux
121
+ .venv/bin/python -m pip install -e ".[dev,local]"
122
+ .venv/bin/python -m oc_worker.main
123
+ ```
124
+
125
+ Use `--once` to claim and process at most one job, which is useful for
126
+ integration tests and cron-style deployments:
127
+
128
+ ```bash
129
+ python -m oc_worker.main --once
130
+ ```
131
+
132
+ Set `WORKER_API_TOKEN` to the same value used by the web app before starting
133
+ the worker. Provider settings are read from the worker process environment.
134
+
135
+ ## Local providers
136
+
137
+ - `TRANSCRIPTION_PROVIDER=faster_whisper` runs speech recognition locally;
138
+ install the `local` extra and allow the first model download.
139
+ - `TRANSCRIPTION_PROVIDER=openai_audio` sends extracted WAV audio to an
140
+ audio-capable OpenAI-compatible chat model through the same `OPENAI_BASE_URL`
141
+ and API-key settings used for hosted vision.
142
+ - `VISION_PROVIDER=ollama` remains available for a local Ollama server.
143
+ - `VISION_PROVIDER=openai_compatible` can call OpenCode Go with
144
+ `OPENAI_BASE_URL=https://opencode.ai/inference/go/openai/v1`,
145
+ `OPENCODE_API_KEY`, and an image-capable `VISION_MODEL`.
146
+ - `OCR_PROVIDER=tesseract` extracts text independently with the local
147
+ Tesseract binary. `OCR_PROVIDER=vision` keeps the compatibility behavior of
148
+ deriving OCR rows from the vision provider's `visibleText`.
149
+ - `TRANSCRIPTION_PROVIDER=fixture` and `VISION_PROVIDER=fixture` provide
150
+ deterministic, clearly labeled output for offline tests. They do not run
151
+ speech recognition or computer vision and should not be used to claim real
152
+ analysis quality.
153
+
154
+ The generated-media integration tests in `tests/test_e2e_fixture.py` invoke
155
+ real FFmpeg and PDFium for probing, audio and frame extraction, still-image
156
+ conversion, image sets, and PDF page rendering, while using fixture providers
157
+ for inference.
158
+
159
+ ## Real OpenCode Go vision smoke test
160
+
161
+ The hosted vision test is opt-in because it calls an external API:
162
+
163
+ ```bash
164
+ export OPENCODE_API_KEY=...
165
+ export OPENAI_BASE_URL=https://opencode.ai/inference/go/openai/v1
166
+ export VISION_MODEL=glm-5.3-flash
167
+ OPENCONTEXT_OPENCODE_E2E=1 pytest tests/test_opencode_vision_smoke.py -q
168
+ ```
169
+
170
+ The test verifies the model catalog accepts image input, analyzes a generated
171
+ frame, and runs a synthetic checkout reference through the full image pipeline.
172
+ It requires the model to recover at least two of the expected UI/OCR labels.
173
+ This is a setup smoke test, not evidence of broad model quality.
174
+
175
+ ## Real OpenCode Go audio smoke test
176
+
177
+ ```bash
178
+ export OPENCODE_API_KEY=...
179
+ export OPENAI_BASE_URL=https://opencode.ai/inference/go/openai/v1
180
+ export TRANSCRIPTION_MODEL=mimo-v2.6-pro
181
+ OPENCONTEXT_OPENCODE_AUDIO_E2E=1 pytest tests/test_opencode_audio_smoke.py -q
182
+ ```
183
+
184
+ This checks model-catalog audio support and transcribes the attributed Harvard
185
+ sentence recording committed under `docs/evaluation/`.
186
+
187
+ ## MCP server
188
+
189
+ Install the agent extra:
190
+
191
+ ```bash
192
+ pip install "opencontext-video[agent]"
193
+ opencontext-mcp
194
+ ```
195
+
196
+ The stdio MCP server exposes:
197
+
198
+ - `analyze_media` — analyze a local video or image and return an evidence-linked
199
+ brief.
200
+ - `analyze_video` and `analyze_image` — explicit compatibility entry points.
201
+ - `implementation_brief` — convert an existing context JSON result into a brief.
202
+ - `context_evidence` — return the bounded evidence ledger.
203
+
204
+ Example client configuration:
205
+
206
+ ```json
207
+ {
208
+ "mcpServers": {
209
+ "opencontext": {
210
+ "command": "opencontext-mcp",
211
+ "args": []
212
+ }
213
+ }
214
+ }
215
+ ```
@@ -0,0 +1,69 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "opencontext-video"
7
+ version = "0.1.0"
8
+ description = "Turn video and images into evidence-linked developer context for text-only AI"
9
+ readme = "README.md"
10
+ requires-python = ">=3.13"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "OpenContext contributors" }]
14
+ keywords = ["video", "transcription", "ocr", "developer-context", "ai"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.13",
21
+ "Topic :: Multimedia :: Video",
22
+ ]
23
+ dependencies = [
24
+ "httpx",
25
+ "imageio-ffmpeg",
26
+ "pillow",
27
+ "pydantic",
28
+ "pypdfium2",
29
+ "python-dotenv",
30
+ ]
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/kylosonic/opencontext"
34
+ Repository = "https://github.com/kylosonic/opencontext"
35
+ Issues = "https://github.com/kylosonic/opencontext/issues"
36
+
37
+ [project.scripts]
38
+ opencontext = "oc_worker.cli:main"
39
+ opencontext-mcp = "oc_worker.mcp_server:main"
40
+
41
+ [project.optional-dependencies]
42
+ dev = [
43
+ "build",
44
+ "mcp>=2.3,<3",
45
+ "pytest",
46
+ "ruff",
47
+ "twine",
48
+ ]
49
+ agent = [
50
+ "mcp>=2.3,<3",
51
+ ]
52
+ local = [
53
+ "faster-whisper",
54
+ "av>=11,<19",
55
+ ]
56
+
57
+ [tool.setuptools.packages.find]
58
+ where = ["src"]
59
+
60
+
61
+ [tool.ruff]
62
+ line-length = 100
63
+ target-version = "py313"
64
+
65
+ [tool.ruff.lint]
66
+ select = ["E", "F", "I", "UP", "B"]
67
+
68
+ [tool.pytest.ini_options]
69
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ """OpenContext media processing worker."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+
6
+ def package_version() -> str:
7
+ """Return the installed package version without a second release literal."""
8
+ try:
9
+ return version("opencontext-video")
10
+ except PackageNotFoundError:
11
+ return "0.0.0+unknown"
12
+
13
+
14
+ __version__ = package_version()