videopython 0.58.0__tar.gz → 0.59.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.
- videopython-0.59.0/PKG-INFO +167 -0
- videopython-0.59.0/README.md +110 -0
- {videopython-0.58.0 → videopython-0.59.0}/pyproject.toml +1 -1
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/__init__.py +2 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/analyzer.py +63 -2
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/models.py +30 -8
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/source_metadata.py +1 -3
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/mcp/_models.py +3 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/mcp/server.py +3 -2
- videopython-0.58.0/PKG-INFO +0 -198
- videopython-0.58.0/README.md +0 -141
- {videopython-0.58.0 → videopython-0.59.0}/.gitignore +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/LICENSE +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/_device.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/_ollama.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/_optional.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/_predictor.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/_revisions.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/backend.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/catalog.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/editor.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/local.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/models.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/auto_edit/resolve.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/_tts_backend.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/audio_ops.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/config.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/dubber.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/models.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/pipeline.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/quality.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/remux.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/separation.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/timing.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/translation.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/dubbing/voice_sample.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/effects.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/errors.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/generation/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/generation/audio.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/generation/image.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/generation/video.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/keyframe.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/ops.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/transforms.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/_detector.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/audio.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/classification.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/faces.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/image.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/objects.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/understanding/temporal.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/detectors.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/sampling.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/audio/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/audio/analysis.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/audio/audio.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/_dimensions.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/_ffmpeg.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/_video_io.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/description.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/draw_detections.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/exceptions.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/Anton-OFL.txt +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/Anton-Regular.ttf +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/BebasNeue-OFL.txt +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/BebasNeue-Regular.ttf +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/DejaVuSans.ttf +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/LICENSE_DEJAVU +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/Lato-Bold.ttf +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/Lato-OFL.txt +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/Poppins-Bold.ttf +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/Poppins-OFL.txt +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/fonts/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/transcription.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/base/video.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/_ass.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/_easing.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/_schema.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/audio_ops.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/effects.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/operation.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/streaming.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/transcription_overlay.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/transforms.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/editing/video_edit.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/mcp/__init__.py +0 -0
- {videopython-0.58.0 → videopython-0.59.0}/src/videopython/py.typed +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: videopython
|
|
3
|
+
Version: 0.59.0
|
|
4
|
+
Summary: LLM-friendly Python video editing with JSON plans, local AI, and MCP tools.
|
|
5
|
+
Project-URL: Homepage, https://videopython.com
|
|
6
|
+
Project-URL: Repository, https://github.com/bartwojtowicz/videopython/
|
|
7
|
+
Project-URL: Documentation, https://videopython.com
|
|
8
|
+
Author-email: Bartosz Wójtowicz <bartoszwojtowicz@outlook.com>, Bartosz Rudnikowicz <bartoszrudnikowicz840@gmail.com>, Piotr Pukisz <piotr.pukisz@gmail.com>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,ai-agents,editing,ffmpeg,generation,llm,mcp,movie,ollama,opencv,python,shorts,video,video-editing,videopython
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Requires-Python: <3.15,>=3.11
|
|
20
|
+
Requires-Dist: numpy>=1.25.2
|
|
21
|
+
Requires-Dist: opencv-python-headless>=4.9.0.80
|
|
22
|
+
Requires-Dist: pillow>=12.1.1
|
|
23
|
+
Requires-Dist: pydantic>=2.8.0
|
|
24
|
+
Requires-Dist: resvg-py>=0.3.2
|
|
25
|
+
Requires-Dist: soxr>=0.5
|
|
26
|
+
Requires-Dist: tqdm>=4.66.3
|
|
27
|
+
Provides-Extra: ai
|
|
28
|
+
Requires-Dist: accelerate>=0.29.2; extra == 'ai'
|
|
29
|
+
Requires-Dist: demucs>=4.0.0; extra == 'ai'
|
|
30
|
+
Requires-Dist: diffusers>=0.35.0; extra == 'ai'
|
|
31
|
+
Requires-Dist: ftfy>=6.1; extra == 'ai'
|
|
32
|
+
Requires-Dist: imagehash>=4.3; extra == 'ai'
|
|
33
|
+
Requires-Dist: numba>=0.62; extra == 'ai'
|
|
34
|
+
Requires-Dist: ollama>=0.5.0; extra == 'ai'
|
|
35
|
+
Requires-Dist: openai-whisper>=20240930; extra == 'ai'
|
|
36
|
+
Requires-Dist: pyannote-audio>=4.0.0; extra == 'ai'
|
|
37
|
+
Requires-Dist: pyloudnorm>=0.1.1; extra == 'ai'
|
|
38
|
+
Requires-Dist: silero-vad>=5.1; extra == 'ai'
|
|
39
|
+
Requires-Dist: torch>=2.8.0; extra == 'ai'
|
|
40
|
+
Requires-Dist: torchaudio>=2.8.0; extra == 'ai'
|
|
41
|
+
Requires-Dist: torchcodec>=0.7.0; extra == 'ai'
|
|
42
|
+
Requires-Dist: torchvision>=0.23.0; extra == 'ai'
|
|
43
|
+
Requires-Dist: transformers>=5.2.0; extra == 'ai'
|
|
44
|
+
Requires-Dist: transnetv2-pytorch>=1.0.5; extra == 'ai'
|
|
45
|
+
Requires-Dist: videopython-chatterbox>=0.1.7.post1; extra == 'ai'
|
|
46
|
+
Provides-Extra: mcp
|
|
47
|
+
Requires-Dist: imagehash>=4.3; extra == 'mcp'
|
|
48
|
+
Requires-Dist: mcp<2,>=1.27; extra == 'mcp'
|
|
49
|
+
Requires-Dist: numba>=0.62; extra == 'mcp'
|
|
50
|
+
Requires-Dist: ollama>=0.5.0; extra == 'mcp'
|
|
51
|
+
Requires-Dist: openai-whisper>=20240930; extra == 'mcp'
|
|
52
|
+
Requires-Dist: torch>=2.8.0; extra == 'mcp'
|
|
53
|
+
Requires-Dist: torchvision>=0.23.0; extra == 'mcp'
|
|
54
|
+
Requires-Dist: transformers>=5.2.0; extra == 'mcp'
|
|
55
|
+
Requires-Dist: transnetv2-pytorch>=1.0.5; extra == 'mcp'
|
|
56
|
+
Description-Content-Type: text/markdown
|
|
57
|
+
|
|
58
|
+
# videopython
|
|
59
|
+
|
|
60
|
+
[](https://pypi.org/project/videopython/)
|
|
61
|
+
[](https://pypi.org/project/videopython/)
|
|
62
|
+
[](LICENSE)
|
|
63
|
+
[](https://github.com/BartWojtowicz/videopython/actions/workflows/ci.yml)
|
|
64
|
+
|
|
65
|
+
Structured, local-first video editing for Python and AI agents.
|
|
66
|
+
|
|
67
|
+
Videopython represents an edit as a validated Python model or JSON plan. Whether the
|
|
68
|
+
plan comes from your code, an LLM, or an MCP client, it renders through the same
|
|
69
|
+
bounded-memory streaming engine.
|
|
70
|
+
|
|
71
|
+
[Documentation](https://videopython.com) ·
|
|
72
|
+
[First edit](https://videopython.com/tutorials/first-edit/) ·
|
|
73
|
+
[API reference](https://videopython.com/reference/) ·
|
|
74
|
+
[Roadmap](ROADMAP.md)
|
|
75
|
+
|
|
76
|
+
## Why videopython?
|
|
77
|
+
|
|
78
|
+
- **Structured edits** — segments and operations are Pydantic models with a generated
|
|
79
|
+
JSON Schema.
|
|
80
|
+
- **Predictable rendering** — validate dimensions, timing, and operation constraints
|
|
81
|
+
before decoding frames.
|
|
82
|
+
- **Bounded memory** — stream decode, effects, and encode without loading the full
|
|
83
|
+
source into memory.
|
|
84
|
+
- **Local AI** — add transcription, scene understanding, generation, dubbing, and
|
|
85
|
+
automatic editing without cloud inference APIs.
|
|
86
|
+
- **Agent-ready tools** — expose analysis, planning, validation, and rendering through
|
|
87
|
+
the included MCP server.
|
|
88
|
+
|
|
89
|
+
## Installation
|
|
90
|
+
|
|
91
|
+
Install [FFmpeg](https://ffmpeg.org/download.html), then choose the package extras you
|
|
92
|
+
need:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pip install videopython # core video and audio editing
|
|
96
|
+
pip install "videopython[ai]" # all local AI features
|
|
97
|
+
pip install "videopython[mcp]" # MCP and its focused analysis stack
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Videopython supports Python `>=3.11, <3.15`. The `ai` and `mcp` extras are independent;
|
|
101
|
+
install `videopython[ai,mcp]` if you need both. See the
|
|
102
|
+
[installation guide](https://videopython.com/install/) for FFmpeg features, model
|
|
103
|
+
downloads, Ollama setup, and hardware requirements.
|
|
104
|
+
|
|
105
|
+
## Quick start
|
|
106
|
+
|
|
107
|
+
Describe the edit, validate it without loading frames, then render it:
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from videopython.editing import VideoEdit
|
|
111
|
+
|
|
112
|
+
edit = VideoEdit.from_dict({
|
|
113
|
+
"segments": [
|
|
114
|
+
{
|
|
115
|
+
"source": "input.mp4",
|
|
116
|
+
"start": 10.0,
|
|
117
|
+
"end": 20.0,
|
|
118
|
+
"operations": [
|
|
119
|
+
{"op": "resize", "width": 1080, "height": 1920},
|
|
120
|
+
{"op": "color_adjust", "saturation": 1.15, "contrast": 1.05},
|
|
121
|
+
{"op": "fade", "mode": "in", "duration": 0.5},
|
|
122
|
+
],
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
edit.validate()
|
|
128
|
+
edit.run_to_file("output.mp4")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`run_to_file()` streams the source through FFmpeg and the operation pipeline, so memory
|
|
132
|
+
use stays bounded for long videos. Continue with
|
|
133
|
+
[Your first edit](https://videopython.com/tutorials/first-edit/).
|
|
134
|
+
|
|
135
|
+
## What you can build
|
|
136
|
+
|
|
137
|
+
| Area | Capabilities | Start here |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| Editing | Cuts, transforms, effects, overlays, subtitles, audio, and multi-segment plans | [Editing guides](https://videopython.com/how-to/) |
|
|
140
|
+
| AI workflows | Transcription, detection, scene understanding, generation, dubbing, and automatic editing | [Local AI](https://videopython.com/explanation/local-ai/) |
|
|
141
|
+
| LLM integrations | Generated schemas, structured validation, repair, and dimension normalization | [LLM plan guide](https://videopython.com/how-to/llm-plans/) |
|
|
142
|
+
| MCP agents | Local tools for media analysis, planning, validation, and rendering | [MCP guide](https://videopython.com/how-to/mcp-server/) |
|
|
143
|
+
|
|
144
|
+
Core editing does not install PyTorch or other model runtimes. AI dependencies load only
|
|
145
|
+
when you use an AI feature.
|
|
146
|
+
|
|
147
|
+
## Documentation
|
|
148
|
+
|
|
149
|
+
The documentation follows [Diataxis](https://diataxis.fr/):
|
|
150
|
+
|
|
151
|
+
- [Tutorials](https://videopython.com/tutorials/) teach the library through complete
|
|
152
|
+
examples.
|
|
153
|
+
- [How-to guides](https://videopython.com/how-to/) cover specific editing and AI tasks.
|
|
154
|
+
- [Reference](https://videopython.com/reference/) documents the API, operations, and
|
|
155
|
+
JSON wire format.
|
|
156
|
+
- [Explanation](https://videopython.com/explanation/) covers the streaming engine,
|
|
157
|
+
plan lifecycle, architecture, and LLM-first design.
|
|
158
|
+
|
|
159
|
+
## Project status
|
|
160
|
+
|
|
161
|
+
Videopython is pre-1.0, so public interfaces can still change. See the
|
|
162
|
+
[roadmap](ROADMAP.md) for the stability criteria and [release notes](RELEASE_NOTES.md)
|
|
163
|
+
for changes between versions. Report vulnerabilities through the [security
|
|
164
|
+
policy](SECURITY.md).
|
|
165
|
+
|
|
166
|
+
For local setup, tests, documentation builds, and releases, see
|
|
167
|
+
[DEVELOPMENT.md](DEVELOPMENT.md).
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# videopython
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/videopython/)
|
|
4
|
+
[](https://pypi.org/project/videopython/)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://github.com/BartWojtowicz/videopython/actions/workflows/ci.yml)
|
|
7
|
+
|
|
8
|
+
Structured, local-first video editing for Python and AI agents.
|
|
9
|
+
|
|
10
|
+
Videopython represents an edit as a validated Python model or JSON plan. Whether the
|
|
11
|
+
plan comes from your code, an LLM, or an MCP client, it renders through the same
|
|
12
|
+
bounded-memory streaming engine.
|
|
13
|
+
|
|
14
|
+
[Documentation](https://videopython.com) ·
|
|
15
|
+
[First edit](https://videopython.com/tutorials/first-edit/) ·
|
|
16
|
+
[API reference](https://videopython.com/reference/) ·
|
|
17
|
+
[Roadmap](ROADMAP.md)
|
|
18
|
+
|
|
19
|
+
## Why videopython?
|
|
20
|
+
|
|
21
|
+
- **Structured edits** — segments and operations are Pydantic models with a generated
|
|
22
|
+
JSON Schema.
|
|
23
|
+
- **Predictable rendering** — validate dimensions, timing, and operation constraints
|
|
24
|
+
before decoding frames.
|
|
25
|
+
- **Bounded memory** — stream decode, effects, and encode without loading the full
|
|
26
|
+
source into memory.
|
|
27
|
+
- **Local AI** — add transcription, scene understanding, generation, dubbing, and
|
|
28
|
+
automatic editing without cloud inference APIs.
|
|
29
|
+
- **Agent-ready tools** — expose analysis, planning, validation, and rendering through
|
|
30
|
+
the included MCP server.
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
Install [FFmpeg](https://ffmpeg.org/download.html), then choose the package extras you
|
|
35
|
+
need:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install videopython # core video and audio editing
|
|
39
|
+
pip install "videopython[ai]" # all local AI features
|
|
40
|
+
pip install "videopython[mcp]" # MCP and its focused analysis stack
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Videopython supports Python `>=3.11, <3.15`. The `ai` and `mcp` extras are independent;
|
|
44
|
+
install `videopython[ai,mcp]` if you need both. See the
|
|
45
|
+
[installation guide](https://videopython.com/install/) for FFmpeg features, model
|
|
46
|
+
downloads, Ollama setup, and hardware requirements.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
Describe the edit, validate it without loading frames, then render it:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from videopython.editing import VideoEdit
|
|
54
|
+
|
|
55
|
+
edit = VideoEdit.from_dict({
|
|
56
|
+
"segments": [
|
|
57
|
+
{
|
|
58
|
+
"source": "input.mp4",
|
|
59
|
+
"start": 10.0,
|
|
60
|
+
"end": 20.0,
|
|
61
|
+
"operations": [
|
|
62
|
+
{"op": "resize", "width": 1080, "height": 1920},
|
|
63
|
+
{"op": "color_adjust", "saturation": 1.15, "contrast": 1.05},
|
|
64
|
+
{"op": "fade", "mode": "in", "duration": 0.5},
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
edit.validate()
|
|
71
|
+
edit.run_to_file("output.mp4")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`run_to_file()` streams the source through FFmpeg and the operation pipeline, so memory
|
|
75
|
+
use stays bounded for long videos. Continue with
|
|
76
|
+
[Your first edit](https://videopython.com/tutorials/first-edit/).
|
|
77
|
+
|
|
78
|
+
## What you can build
|
|
79
|
+
|
|
80
|
+
| Area | Capabilities | Start here |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| Editing | Cuts, transforms, effects, overlays, subtitles, audio, and multi-segment plans | [Editing guides](https://videopython.com/how-to/) |
|
|
83
|
+
| AI workflows | Transcription, detection, scene understanding, generation, dubbing, and automatic editing | [Local AI](https://videopython.com/explanation/local-ai/) |
|
|
84
|
+
| LLM integrations | Generated schemas, structured validation, repair, and dimension normalization | [LLM plan guide](https://videopython.com/how-to/llm-plans/) |
|
|
85
|
+
| MCP agents | Local tools for media analysis, planning, validation, and rendering | [MCP guide](https://videopython.com/how-to/mcp-server/) |
|
|
86
|
+
|
|
87
|
+
Core editing does not install PyTorch or other model runtimes. AI dependencies load only
|
|
88
|
+
when you use an AI feature.
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
The documentation follows [Diataxis](https://diataxis.fr/):
|
|
93
|
+
|
|
94
|
+
- [Tutorials](https://videopython.com/tutorials/) teach the library through complete
|
|
95
|
+
examples.
|
|
96
|
+
- [How-to guides](https://videopython.com/how-to/) cover specific editing and AI tasks.
|
|
97
|
+
- [Reference](https://videopython.com/reference/) documents the API, operations, and
|
|
98
|
+
JSON wire format.
|
|
99
|
+
- [Explanation](https://videopython.com/explanation/) covers the streaming engine,
|
|
100
|
+
plan lifecycle, architecture, and LLM-first design.
|
|
101
|
+
|
|
102
|
+
## Project status
|
|
103
|
+
|
|
104
|
+
Videopython is pre-1.0, so public interfaces can still change. See the
|
|
105
|
+
[roadmap](ROADMAP.md) for the stability criteria and [release notes](RELEASE_NOTES.md)
|
|
106
|
+
for changes between versions. Report vulnerabilities through the [security
|
|
107
|
+
policy](SECURITY.md).
|
|
108
|
+
|
|
109
|
+
For local setup, tests, documentation builds, and releases, see
|
|
110
|
+
[DEVELOPMENT.md](DEVELOPMENT.md).
|
|
@@ -17,6 +17,7 @@ from .models import (
|
|
|
17
17
|
SCENE_VLM,
|
|
18
18
|
SEMANTIC_SCENE_DETECTOR,
|
|
19
19
|
AnalysisRunInfo,
|
|
20
|
+
AnalyzerOutcome,
|
|
20
21
|
AudioAnalysisSection,
|
|
21
22
|
GeoMetadata,
|
|
22
23
|
SceneAnalysisSample,
|
|
@@ -30,6 +31,7 @@ __all__ = [
|
|
|
30
31
|
"ALL_ANALYZER_IDS",
|
|
31
32
|
"AUDIO_CLASSIFIER",
|
|
32
33
|
"AUDIO_TO_TEXT",
|
|
34
|
+
"AnalyzerOutcome",
|
|
33
35
|
"AnalysisRunInfo",
|
|
34
36
|
"AudioAnalysisSection",
|
|
35
37
|
"FACE_TRACKER",
|
|
@@ -16,12 +16,14 @@ from videopython.base.video import Video, VideoMetadata
|
|
|
16
16
|
|
|
17
17
|
from . import detectors, source_metadata
|
|
18
18
|
from .models import (
|
|
19
|
+
ALL_ANALYZER_IDS,
|
|
19
20
|
AUDIO_CLASSIFIER,
|
|
20
21
|
AUDIO_TO_TEXT,
|
|
21
22
|
FACE_TRACKER,
|
|
22
23
|
SCENE_VLM,
|
|
23
24
|
SEMANTIC_SCENE_DETECTOR,
|
|
24
25
|
AnalysisRunInfo,
|
|
26
|
+
AnalyzerOutcome,
|
|
25
27
|
AudioAnalysisSection,
|
|
26
28
|
SceneAnalysisSample,
|
|
27
29
|
SceneAnalysisSection,
|
|
@@ -103,11 +105,20 @@ class VideoAnalyzer:
|
|
|
103
105
|
raise ValueError("Either `source_path` or `video` must be provided")
|
|
104
106
|
|
|
105
107
|
enabled = self.config.enabled_analyzers
|
|
108
|
+
analyzer_outcomes: dict[str, AnalyzerOutcome] = {
|
|
109
|
+
analyzer: AnalyzerOutcome(
|
|
110
|
+
analyzer=analyzer,
|
|
111
|
+
status="completed" if analyzer in enabled else "skipped",
|
|
112
|
+
reason=None if analyzer in enabled else "disabled",
|
|
113
|
+
)
|
|
114
|
+
for analyzer in ALL_ANALYZER_IDS
|
|
115
|
+
}
|
|
106
116
|
|
|
107
117
|
run_info = AnalysisRunInfo(
|
|
108
118
|
created_at=detectors.utc_now_iso(),
|
|
109
119
|
mode=mode,
|
|
110
120
|
library_version=detectors.library_version(),
|
|
121
|
+
analyzer_outcomes=list(analyzer_outcomes.values()),
|
|
111
122
|
)
|
|
112
123
|
|
|
113
124
|
t_analysis_start = time.perf_counter()
|
|
@@ -136,6 +147,19 @@ class VideoAnalyzer:
|
|
|
136
147
|
with detectors.record_stage(run_info, "scene_detection"):
|
|
137
148
|
detected = detectors.run_scene_detection(config=self.config, source_path=source_path, video=video)
|
|
138
149
|
|
|
150
|
+
if run_whisper and transcription is None:
|
|
151
|
+
analyzer_outcomes[AUDIO_TO_TEXT] = AnalyzerOutcome(
|
|
152
|
+
analyzer=AUDIO_TO_TEXT,
|
|
153
|
+
status="failed",
|
|
154
|
+
reason="execution_failed",
|
|
155
|
+
)
|
|
156
|
+
if run_scene_det and detected is None:
|
|
157
|
+
analyzer_outcomes[SEMANTIC_SCENE_DETECTOR] = AnalyzerOutcome(
|
|
158
|
+
analyzer=SEMANTIC_SCENE_DETECTOR,
|
|
159
|
+
status="failed",
|
|
160
|
+
reason="execution_failed",
|
|
161
|
+
)
|
|
162
|
+
|
|
139
163
|
if run_scene_det:
|
|
140
164
|
detectors.reset_transnetv2_torch_state()
|
|
141
165
|
|
|
@@ -160,11 +184,13 @@ class VideoAnalyzer:
|
|
|
160
184
|
metadata=metadata,
|
|
161
185
|
scenes=scenes,
|
|
162
186
|
run_info=run_info,
|
|
187
|
+
analyzer_outcomes=analyzer_outcomes,
|
|
163
188
|
)
|
|
164
189
|
|
|
165
190
|
audio_section = AudioAnalysisSection(transcription=transcription) if transcription is not None else None
|
|
166
191
|
|
|
167
192
|
run_info.total_duration_seconds = time.perf_counter() - t_analysis_start
|
|
193
|
+
run_info.analyzer_outcomes = list(analyzer_outcomes.values())
|
|
168
194
|
logger.info("Total analysis completed in %.2fs", run_info.total_duration_seconds)
|
|
169
195
|
return VideoAnalysis(
|
|
170
196
|
source=source,
|
|
@@ -182,11 +208,11 @@ class VideoAnalyzer:
|
|
|
182
208
|
metadata: VideoMetadata,
|
|
183
209
|
scenes: list[SceneBoundary],
|
|
184
210
|
run_info: AnalysisRunInfo,
|
|
211
|
+
analyzer_outcomes: dict[str, AnalyzerOutcome],
|
|
185
212
|
) -> SceneAnalysisSection:
|
|
186
213
|
enabled = self.config.enabled_analyzers
|
|
187
214
|
|
|
188
|
-
#
|
|
189
|
-
# analyzer to "skipped" rather than aborting the whole run.
|
|
215
|
+
# A missing extra or model-load failure does not abort the other analyzers.
|
|
190
216
|
scene_vlm = (
|
|
191
217
|
source_metadata.try_init(lambda: SceneVLM(**self.config.get_params(SCENE_VLM)), "SceneVLM")
|
|
192
218
|
if SCENE_VLM in enabled
|
|
@@ -205,6 +231,18 @@ class VideoAnalyzer:
|
|
|
205
231
|
else None
|
|
206
232
|
)
|
|
207
233
|
|
|
234
|
+
for analyzer, component in (
|
|
235
|
+
(SCENE_VLM, scene_vlm),
|
|
236
|
+
(AUDIO_CLASSIFIER, audio_classifier),
|
|
237
|
+
(FACE_TRACKER, face_tracker),
|
|
238
|
+
):
|
|
239
|
+
if analyzer in enabled and component is None:
|
|
240
|
+
analyzer_outcomes[analyzer] = AnalyzerOutcome(
|
|
241
|
+
analyzer=analyzer,
|
|
242
|
+
status="failed",
|
|
243
|
+
reason="initialization_failed",
|
|
244
|
+
)
|
|
245
|
+
|
|
208
246
|
path_audio: Audio | None = None
|
|
209
247
|
if audio_classifier is not None and source_path is not None:
|
|
210
248
|
try:
|
|
@@ -231,8 +269,16 @@ class VideoAnalyzer:
|
|
|
231
269
|
)
|
|
232
270
|
except (IndexError, OSError, RuntimeError, ValueError):
|
|
233
271
|
logger.warning("Batched SceneVLM failed, skipping visual understanding", exc_info=True)
|
|
272
|
+
if any(description is None for description in descriptions):
|
|
273
|
+
analyzer_outcomes[SCENE_VLM] = AnalyzerOutcome(
|
|
274
|
+
analyzer=SCENE_VLM,
|
|
275
|
+
status="failed",
|
|
276
|
+
reason="execution_failed",
|
|
277
|
+
)
|
|
234
278
|
|
|
235
279
|
samples: list[SceneAnalysisSample] = []
|
|
280
|
+
audio_classifier_failed = False
|
|
281
|
+
face_tracker_failed = False
|
|
236
282
|
audio_ctx = (
|
|
237
283
|
detectors.record_stage(run_info, "audio_classification") if audio_classifier is not None else nullcontext()
|
|
238
284
|
)
|
|
@@ -269,6 +315,7 @@ class VideoAnalyzer:
|
|
|
269
315
|
scene_end=scene.end,
|
|
270
316
|
)
|
|
271
317
|
except (OSError, RuntimeError, ValueError):
|
|
318
|
+
audio_classifier_failed = True
|
|
272
319
|
logger.warning(
|
|
273
320
|
"AudioClassifier failed for scene %d (%.1f-%.1fs)",
|
|
274
321
|
index,
|
|
@@ -287,6 +334,7 @@ class VideoAnalyzer:
|
|
|
287
334
|
scene=scene,
|
|
288
335
|
)
|
|
289
336
|
except (IndexError, OSError, RuntimeError, ValueError):
|
|
337
|
+
face_tracker_failed = True
|
|
290
338
|
logger.warning(
|
|
291
339
|
"FaceShotTracker failed for scene %d (%.1f-%.1fs)",
|
|
292
340
|
index,
|
|
@@ -297,6 +345,19 @@ class VideoAnalyzer:
|
|
|
297
345
|
|
|
298
346
|
samples.append(sample)
|
|
299
347
|
|
|
348
|
+
if audio_classifier_failed:
|
|
349
|
+
analyzer_outcomes[AUDIO_CLASSIFIER] = AnalyzerOutcome(
|
|
350
|
+
analyzer=AUDIO_CLASSIFIER,
|
|
351
|
+
status="failed",
|
|
352
|
+
reason="execution_failed",
|
|
353
|
+
)
|
|
354
|
+
if face_tracker_failed:
|
|
355
|
+
analyzer_outcomes[FACE_TRACKER] = AnalyzerOutcome(
|
|
356
|
+
analyzer=FACE_TRACKER,
|
|
357
|
+
status="failed",
|
|
358
|
+
reason="execution_failed",
|
|
359
|
+
)
|
|
360
|
+
|
|
300
361
|
return SceneAnalysisSection(samples=samples)
|
|
301
362
|
|
|
302
363
|
def _load_scene_video_clip(
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
from typing import Annotated, Any
|
|
6
|
+
from typing import Annotated, Any, Literal
|
|
7
7
|
|
|
8
8
|
from pydantic import BaseModel, BeforeValidator, ConfigDict, Field, PlainSerializer, model_validator
|
|
9
9
|
|
|
@@ -14,6 +14,7 @@ __all__ = [
|
|
|
14
14
|
"ALL_ANALYZER_IDS",
|
|
15
15
|
"AUDIO_CLASSIFIER",
|
|
16
16
|
"AUDIO_TO_TEXT",
|
|
17
|
+
"AnalyzerOutcome",
|
|
17
18
|
"AnalysisRunInfo",
|
|
18
19
|
"AudioAnalysisSection",
|
|
19
20
|
"FACE_TRACKER",
|
|
@@ -27,13 +28,21 @@ __all__ = [
|
|
|
27
28
|
"VideoAnalysisSource",
|
|
28
29
|
]
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
_AnalyzerId = Literal[
|
|
32
|
+
"audio_to_text",
|
|
33
|
+
"audio_classifier",
|
|
34
|
+
"semantic_scene_detector",
|
|
35
|
+
"scene_vlm",
|
|
36
|
+
"face_tracker",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
AUDIO_TO_TEXT: _AnalyzerId = "audio_to_text"
|
|
40
|
+
AUDIO_CLASSIFIER: _AnalyzerId = "audio_classifier"
|
|
41
|
+
SEMANTIC_SCENE_DETECTOR: _AnalyzerId = "semantic_scene_detector"
|
|
42
|
+
SCENE_VLM: _AnalyzerId = "scene_vlm"
|
|
43
|
+
FACE_TRACKER: _AnalyzerId = "face_tracker"
|
|
35
44
|
|
|
36
|
-
ALL_ANALYZER_IDS: tuple[
|
|
45
|
+
ALL_ANALYZER_IDS: tuple[_AnalyzerId, ...] = (
|
|
37
46
|
AUDIO_TO_TEXT,
|
|
38
47
|
AUDIO_CLASSIFIER,
|
|
39
48
|
SEMANTIC_SCENE_DETECTOR,
|
|
@@ -120,9 +129,21 @@ class VideoAnalysisSource(BaseModel):
|
|
|
120
129
|
raw_tags: dict[str, str] | None = None
|
|
121
130
|
|
|
122
131
|
|
|
132
|
+
class AnalyzerOutcome(BaseModel):
|
|
133
|
+
"""Completion state for one configured analyzer."""
|
|
134
|
+
|
|
135
|
+
model_config = ConfigDict(extra="forbid")
|
|
136
|
+
|
|
137
|
+
analyzer: _AnalyzerId
|
|
138
|
+
status: Literal["completed", "skipped", "failed"]
|
|
139
|
+
reason: Literal["disabled", "initialization_failed", "execution_failed"] | None
|
|
140
|
+
|
|
141
|
+
|
|
123
142
|
class AnalysisRunInfo(BaseModel):
|
|
124
143
|
"""Runtime/provenance metadata for a full analysis run.
|
|
125
144
|
|
|
145
|
+
``analyzer_outcomes`` records whether each configured analyzer completed,
|
|
146
|
+
was disabled, or failed during initialization or execution.
|
|
126
147
|
``stage_durations_seconds`` is populated by the analyzer with per-stage
|
|
127
148
|
wall-clock times (whisper, scene_detection, scene_analysis, scene_vlm,
|
|
128
149
|
audio_classification, and -- when both run together --
|
|
@@ -133,6 +154,7 @@ class AnalysisRunInfo(BaseModel):
|
|
|
133
154
|
created_at: str
|
|
134
155
|
mode: str
|
|
135
156
|
library_version: str | None = None
|
|
157
|
+
analyzer_outcomes: list[AnalyzerOutcome]
|
|
136
158
|
stage_durations_seconds: dict[str, float] = Field(default_factory=dict)
|
|
137
159
|
total_duration_seconds: float | None = None
|
|
138
160
|
|
|
@@ -151,7 +173,7 @@ class VideoAnalysisConfig(BaseModel):
|
|
|
151
173
|
)
|
|
152
174
|
"""
|
|
153
175
|
|
|
154
|
-
enabled_analyzers: set[str] = Field(default_factory=lambda:
|
|
176
|
+
enabled_analyzers: set[str] = Field(default_factory=lambda: {str(analyzer) for analyzer in ALL_ANALYZER_IDS})
|
|
155
177
|
analyzer_params: dict[str, dict[str, Any]] = Field(default_factory=dict)
|
|
156
178
|
|
|
157
179
|
@model_validator(mode="after")
|
{videopython-0.58.0 → videopython-0.59.0}/src/videopython/ai/video_analysis/source_metadata.py
RENAMED
|
@@ -37,9 +37,7 @@ _GEO_TAG_KEYS: tuple[str, ...] = (
|
|
|
37
37
|
def try_init(factory: Callable[[], T], name: str) -> T | None:
|
|
38
38
|
"""Construct a component, or log and return ``None`` on a load/runtime error.
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
model-load failure degrades that analyzer to "skipped" instead of aborting
|
|
42
|
-
the whole analysis run.
|
|
40
|
+
A missing extra or model-load failure does not abort the other analyzers.
|
|
43
41
|
"""
|
|
44
42
|
try:
|
|
45
43
|
return factory()
|
|
@@ -4,6 +4,8 @@ from typing import Any
|
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, ConfigDict
|
|
6
6
|
|
|
7
|
+
from videopython.ai.video_analysis.models import AnalyzerOutcome
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
class SchemaIssue(BaseModel):
|
|
9
11
|
"""One Pydantic schema-validation issue."""
|
|
@@ -53,6 +55,7 @@ class AnalyzeVideoResult(BaseModel):
|
|
|
53
55
|
width: int | None
|
|
54
56
|
height: int | None
|
|
55
57
|
scenes: int
|
|
58
|
+
analyzers: list[AnalyzerOutcome]
|
|
56
59
|
|
|
57
60
|
|
|
58
61
|
class ValidateEditResult(BaseModel):
|
|
@@ -57,8 +57,8 @@ def analyze_video(path: str, profile: Literal["full", "editing"] = "editing") ->
|
|
|
57
57
|
|
|
58
58
|
The default ``profile="editing"`` skips audio classification; the catalog
|
|
59
59
|
(captions + transcript + face flag) is unaffected. ``profile="full"`` adds
|
|
60
|
-
audio classification.
|
|
61
|
-
then build_catalog.
|
|
60
|
+
audio classification. The result reports whether each analyzer completed,
|
|
61
|
+
was disabled, or failed. Call this once per source, then build_catalog.
|
|
62
62
|
"""
|
|
63
63
|
# Heavy analyzer deps (e.g. transnetv2-pytorch) bare-print to stdout, which here is
|
|
64
64
|
# the stdio JSON-RPC channel; send that to stderr so the transport stays clean.
|
|
@@ -73,6 +73,7 @@ def analyze_video(path: str, profile: Literal["full", "editing"] = "editing") ->
|
|
|
73
73
|
width=src.width,
|
|
74
74
|
height=src.height,
|
|
75
75
|
scenes=len(analysis.scenes.samples) if analysis.scenes else 0,
|
|
76
|
+
analyzers=analysis.run_info.analyzer_outcomes,
|
|
76
77
|
)
|
|
77
78
|
|
|
78
79
|
|