videopython 0.56.0__tar.gz → 0.58.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 (93) hide show
  1. {videopython-0.56.0 → videopython-0.58.0}/PKG-INFO +42 -22
  2. {videopython-0.56.0 → videopython-0.58.0}/README.md +39 -20
  3. {videopython-0.56.0 → videopython-0.58.0}/pyproject.toml +5 -3
  4. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/audio/audio.py +0 -12
  5. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/_video_io.py +1 -1
  6. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/video.py +1 -1
  7. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/streaming.py +3 -3
  8. videopython-0.58.0/src/videopython/mcp/_models.py +83 -0
  9. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/mcp/server.py +58 -44
  10. {videopython-0.56.0 → videopython-0.58.0}/.gitignore +0 -0
  11. {videopython-0.56.0 → videopython-0.58.0}/LICENSE +0 -0
  12. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/__init__.py +0 -0
  13. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/__init__.py +0 -0
  14. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/_device.py +0 -0
  15. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/_ollama.py +0 -0
  16. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/_optional.py +0 -0
  17. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/_predictor.py +0 -0
  18. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/_revisions.py +0 -0
  19. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/__init__.py +0 -0
  20. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/backend.py +0 -0
  21. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/catalog.py +0 -0
  22. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/editor.py +0 -0
  23. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/local.py +0 -0
  24. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/models.py +0 -0
  25. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/auto_edit/resolve.py +0 -0
  26. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/__init__.py +0 -0
  27. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/_tts_backend.py +0 -0
  28. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/audio_ops.py +0 -0
  29. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/config.py +0 -0
  30. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/dubber.py +0 -0
  31. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/models.py +0 -0
  32. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/pipeline.py +0 -0
  33. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/quality.py +0 -0
  34. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/remux.py +0 -0
  35. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/separation.py +0 -0
  36. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/timing.py +0 -0
  37. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/translation.py +0 -0
  38. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/dubbing/voice_sample.py +0 -0
  39. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/effects.py +0 -0
  40. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/errors.py +0 -0
  41. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/generation/__init__.py +0 -0
  42. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/generation/audio.py +0 -0
  43. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/generation/image.py +0 -0
  44. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/generation/video.py +0 -0
  45. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/keyframe.py +0 -0
  46. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/ops.py +0 -0
  47. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/transforms.py +0 -0
  48. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/__init__.py +0 -0
  49. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/_detector.py +0 -0
  50. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/audio.py +0 -0
  51. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/classification.py +0 -0
  52. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/faces.py +0 -0
  53. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/image.py +0 -0
  54. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/objects.py +0 -0
  55. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/understanding/temporal.py +0 -0
  56. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/video_analysis/__init__.py +0 -0
  57. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/video_analysis/analyzer.py +0 -0
  58. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/video_analysis/detectors.py +0 -0
  59. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/video_analysis/models.py +0 -0
  60. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/video_analysis/sampling.py +0 -0
  61. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/ai/video_analysis/source_metadata.py +0 -0
  62. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/audio/__init__.py +0 -0
  63. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/audio/analysis.py +0 -0
  64. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/__init__.py +0 -0
  65. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/_dimensions.py +0 -0
  66. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/_ffmpeg.py +0 -0
  67. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/description.py +0 -0
  68. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/draw_detections.py +0 -0
  69. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/exceptions.py +0 -0
  70. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/Anton-OFL.txt +0 -0
  71. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/Anton-Regular.ttf +0 -0
  72. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/BebasNeue-OFL.txt +0 -0
  73. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/BebasNeue-Regular.ttf +0 -0
  74. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/DejaVuSans.ttf +0 -0
  75. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/LICENSE_DEJAVU +0 -0
  76. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/Lato-Bold.ttf +0 -0
  77. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/Lato-OFL.txt +0 -0
  78. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/Poppins-Bold.ttf +0 -0
  79. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/Poppins-OFL.txt +0 -0
  80. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/fonts/__init__.py +0 -0
  81. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/base/transcription.py +0 -0
  82. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/__init__.py +0 -0
  83. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/_ass.py +0 -0
  84. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/_easing.py +0 -0
  85. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/_schema.py +0 -0
  86. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/audio_ops.py +0 -0
  87. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/effects.py +0 -0
  88. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/operation.py +0 -0
  89. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/transcription_overlay.py +0 -0
  90. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/transforms.py +0 -0
  91. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/editing/video_edit.py +0 -0
  92. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/mcp/__init__.py +0 -0
  93. {videopython-0.56.0 → videopython-0.58.0}/src/videopython/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: videopython
3
- Version: 0.56.0
3
+ Version: 0.58.0
4
4
  Summary: LLM-friendly Python video editing with JSON plans, local AI, and MCP tools.
5
5
  Project-URL: Homepage, https://videopython.com
6
6
  Project-URL: Repository, https://github.com/bartwojtowicz/videopython/
@@ -15,7 +15,8 @@ Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Programming Language :: Python :: 3.11
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
- Requires-Python: <3.14,>=3.11
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: <3.15,>=3.11
19
20
  Requires-Dist: numpy>=1.25.2
20
21
  Requires-Dist: opencv-python-headless>=4.9.0.80
21
22
  Requires-Dist: pillow>=12.1.1
@@ -61,20 +62,32 @@ Description-Content-Type: text/markdown
61
62
  [![License](https://img.shields.io/github/license/BartWojtowicz/videopython)](LICENSE)
62
63
  [![CI](https://github.com/BartWojtowicz/videopython/actions/workflows/ci.yml/badge.svg)](https://github.com/BartWojtowicz/videopython/actions/workflows/ci.yml)
63
64
 
64
- Minimal, LLM-friendly Python library for programmatic video editing, processing, and AI video workflows.
65
+ Python library for structured, local-first video editing, processing, and AI workflows.
66
+ Build edits as validated Python models or JSON plans, then render them through a
67
+ bounded-memory streaming engine.
65
68
 
66
69
  Full documentation: [videopython.com](https://videopython.com)
67
70
 
68
71
  ## Installation
69
72
 
70
73
  ```bash
71
- # Install FFmpeg first (macOS: brew install ffmpeg | Debian: apt-get install ffmpeg)
74
+ # Install FFmpeg first (macOS: brew install ffmpeg-full | Debian: apt-get install ffmpeg)
72
75
  pip install videopython # core video/audio editing
73
- pip install "videopython[ai]" # + ALL local AI features (GPU recommended)
74
- pip install "videopython[mcp]" # focused MCP agent-editing stack
76
+ pip install "videopython[ai]" # + all local AI features
77
+ pip install "videopython[mcp]" # + MCP and its focused analysis/editing stack
75
78
  ```
76
79
 
77
- Python `>=3.11, <3.14`. AI features run locally — no cloud API keys required, but model weights are downloaded on first use. LLM-driven editing and scene captioning use a local [Ollama](https://ollama.com) server (`ollama pull qwen3.6:27b`). See the [install guide](https://videopython.com/install/) for FFmpeg, Ollama, and hardware details.
80
+ `[ai]` and `[mcp]` are independent. Use `[ai,mcp]` when one environment needs every AI
81
+ capability and the MCP server.
82
+
83
+ Python `>=3.11, <3.15`. AI features run locally without cloud inference APIs, but model
84
+ weights are downloaded on first use. LLM-driven editing and scene captioning use a local
85
+ [Ollama](https://ollama.com) server (`ollama pull qwen3.6:27b`). Image and video
86
+ generation require an NVIDIA CUDA GPU. See the [install guide](https://videopython.com/install/)
87
+ for FFmpeg, Ollama, model downloads, and hardware details.
88
+
89
+ Videopython is pre-1.0. Public interfaces can still change before the stable release;
90
+ see the [roadmap](ROADMAP.md) for the stability criteria.
78
91
 
79
92
  ## Quick start
80
93
 
@@ -101,6 +114,11 @@ edit.run_to_file("output.mp4") # streams ffmpeg decode → effects → encode
101
114
 
102
115
  `run_to_file()` streams, so memory stays bounded even for hour-long sources. Walk through it in [Tutorial 1](https://videopython.com/tutorials/first-edit/).
103
116
 
117
+ [![A vertical clip rendered from a videopython JSON plan](https://videopython.com/assets/edit-plan-demo-poster.jpg)](https://videopython.com/how-to/agent-edit-demo/)
118
+
119
+ *A reproducible eight-second edit rendered from a JSON plan. View the plan, source, and
120
+ replay script in the [demo](https://videopython.com/how-to/agent-edit-demo/).*
121
+
104
122
  ### Automatic editing (local LLM)
105
123
 
106
124
  Give `AutoEditor` your clips and a brief; a local Ollama vision model selects and orders the shots, and you get back a runnable `VideoEdit`:
@@ -120,6 +138,9 @@ The model picks scenes **by id** from a catalog built from scene detection + cap
120
138
 
121
139
  ### AI generation
122
140
 
141
+ Image and video generation use large CUDA-only models. Speech generation can run on CPU
142
+ or CUDA.
143
+
123
144
  ```python
124
145
  from videopython.ai import TextToImage, ImageToVideo, TextToSpeech
125
146
 
@@ -129,18 +150,20 @@ audio = TextToSpeech().generate_audio("Welcome to videopython.")
129
150
  video.add_audio(audio).save("ai_video.mp4")
130
151
  ```
131
152
 
132
- ## LLM & AI agent integration
133
-
134
- Putting an LLM in the loop works three ways, differing in who owns the model:
153
+ ## Structured plans and automation
135
154
 
136
- 1. **Bring your own LLM** — videopython gives your model the JSON Schema and a structured refine loop; your model authors the plans. [Guide](https://videopython.com/how-to/llm-plans/)
137
- 2. **`AutoEditor`** — a local Ollama vision model is the planner. [Guide](https://videopython.com/how-to/auto-editing/)
138
- 3. **MCP server** — `videopython-mcp` exposes the pipeline as [Model Context Protocol](https://modelcontextprotocol.io) tools, so an agent like Claude drives editing with its own model. [Guide](https://videopython.com/how-to/mcp-server/)
155
+ The same validation and rendering path works whether a plan is written directly, loaded
156
+ from JSON, produced by a model, or submitted through MCP:
139
157
 
140
- See the [reproducible agent-authored edit demo](https://videopython.com/how-to/agent-edit-demo/)
141
- for a complete prompt, JSON plan, and rendered result that needs no model or API key.
158
+ 1. **Python or JSON** — construct `VideoEdit` directly, as in the quick start.
159
+ 2. **Your own LLM** — use the generated JSON Schema and structured refine loop. [Guide](https://videopython.com/how-to/llm-plans/)
160
+ 3. **`AutoEditor`** — use a local Ollama vision model to select and order scenes. [Guide](https://videopython.com/how-to/auto-editing/)
161
+ 4. **MCP** — expose analysis, planning, validation, and rendering tools to any compatible client. [Guide](https://videopython.com/how-to/mcp-server/)
142
162
 
143
- Mode 1 in brief: every operation is a Pydantic model whose fields *are* the JSON wire format, so `VideoEdit.json_schema()` hands your model a ready-made tool schema — a discriminated union over every LLM-exposed op (pass `strict=True` for provider grammar modes). Plans parse permissively and own their numeric bounds at validation, so a refine loop converges fast:
163
+ For schema-driven integrations, every operation is a Pydantic model whose fields are the
164
+ JSON wire format. `VideoEdit.json_schema()` returns a discriminated union over every
165
+ exposed operation; pass `strict=True` for provider grammar modes. Plans parse
166
+ permissively and report numeric bounds during validation, so a refine loop can use:
144
167
 
145
168
  - **`edit.check(meta)`** — collect *every* structured error in one pass, not just the first
146
169
  - **`edit.repair(meta)`** — auto-clamp mechanical violations (overruns, negatives) with a changelog
@@ -153,10 +176,10 @@ Why it is built this way: [LLM-first design](https://videopython.com/explanation
153
176
  - **`videopython.base`** — `Video`, `VideoMetadata`, `FrameIterator`, `Transcription`, and shared result types (`BoundingBox`, `FaceTrack`, `SceneBoundary`, ...). No AI dependencies.
154
177
  - **`videopython.audio`** — `Audio` with overlay, concat, normalize, time-stretch, silence detection, segment classification.
155
178
  - **`videopython.editing`** — `Operation`/`Effect` foundation, `VideoEdit` plan runner with JSON Schema + streaming execution. Transforms (resize, crop, fps, speed, freeze, silence removal; cutting is the segment's own start/end) and effects (blur, zoom, color grading, vignette, Ken Burns, fade, overlays, animated subtitles).
156
- - **`videopython.ai`** *(install with `[ai]`)* — generation (`TextToVideo`, `ImageToVideo`, `TextToImage`, `TextToSpeech`, `TextToMusic`), understanding (`AudioToText`, `AudioClassifier`, `SceneVLM`, `FaceTracker`, `ObjectDetector`, `SemanticSceneDetector`), the `FaceTrackingCrop` transform, the `ObjectDetectionOverlay` effect, and the full-pipeline `VideoAnalyzer`. Scene captioning and dubbing translation run on a local [Ollama](https://ollama.com) model.
179
+ - **`videopython.ai`** *(install with `[ai]`)* — generation (`TextToVideo`, `ImageToVideo`, `TextToImage`, `TextToSpeech`, `TextToMusic`), understanding (`AudioToText`, `AudioClassifier`, `SceneVLM`, `FaceShotTracker`, `FaceSmoothingTracker`, `ObjectDetector`, `SemanticSceneDetector`), the `FaceTrackingCrop` transform, the `ObjectDetectionOverlay` effect, and the full-pipeline `VideoAnalyzer`. Scene captioning and dubbing translation run on a local [Ollama](https://ollama.com) model.
157
180
  - **`videopython.ai.auto_edit`** — `AutoEditor` + `OllamaVisionLLM`: plan and render an edit from sources + a one-line brief.
158
181
  - **`videopython.ai.dubbing`** — `VideoDubber` for voice-cloned revoicing with timing sync.
159
- - **`videopython.mcp`** *(install with `[mcp]`)* — `videopython-mcp`, an MCP stdio server exposing the auto-edit pipeline so an agent drives editing. The extra includes the analysis and AI editing dependencies, but not generation, dubbing, diarization, source separation, or TTS.
182
+ - **`videopython.mcp`** *(install with `[mcp]`)* — `videopython-mcp`, an MCP stdio server exposing the auto-edit pipeline to compatible clients. The extra includes the analysis and AI editing dependencies, but not generation, dubbing, diarization, source separation, or TTS.
160
183
 
161
184
  ## Documentation
162
185
 
@@ -172,7 +195,4 @@ The docs follow [Diátaxis](https://diataxis.fr): four sections, each answering
172
195
  ## Development
173
196
 
174
197
  See [`DEVELOPMENT.md`](DEVELOPMENT.md) for local setup, testing, docs, and the release workflow.
175
-
176
- ## Project provenance
177
-
178
- This project started as a hand-written hobby project, but most of the code is now produced by LLM agents. Humans drive direction, approve changes, and own design decisions.
198
+ See [`ROADMAP.md`](ROADMAP.md) for project direction and the criteria for 1.0.
@@ -5,20 +5,32 @@
5
5
  [![License](https://img.shields.io/github/license/BartWojtowicz/videopython)](LICENSE)
6
6
  [![CI](https://github.com/BartWojtowicz/videopython/actions/workflows/ci.yml/badge.svg)](https://github.com/BartWojtowicz/videopython/actions/workflows/ci.yml)
7
7
 
8
- Minimal, LLM-friendly Python library for programmatic video editing, processing, and AI video workflows.
8
+ Python library for structured, local-first video editing, processing, and AI workflows.
9
+ Build edits as validated Python models or JSON plans, then render them through a
10
+ bounded-memory streaming engine.
9
11
 
10
12
  Full documentation: [videopython.com](https://videopython.com)
11
13
 
12
14
  ## Installation
13
15
 
14
16
  ```bash
15
- # Install FFmpeg first (macOS: brew install ffmpeg | Debian: apt-get install ffmpeg)
17
+ # Install FFmpeg first (macOS: brew install ffmpeg-full | Debian: apt-get install ffmpeg)
16
18
  pip install videopython # core video/audio editing
17
- pip install "videopython[ai]" # + ALL local AI features (GPU recommended)
18
- pip install "videopython[mcp]" # focused MCP agent-editing stack
19
+ pip install "videopython[ai]" # + all local AI features
20
+ pip install "videopython[mcp]" # + MCP and its focused analysis/editing stack
19
21
  ```
20
22
 
21
- Python `>=3.11, <3.14`. AI features run locally — no cloud API keys required, but model weights are downloaded on first use. LLM-driven editing and scene captioning use a local [Ollama](https://ollama.com) server (`ollama pull qwen3.6:27b`). See the [install guide](https://videopython.com/install/) for FFmpeg, Ollama, and hardware details.
23
+ `[ai]` and `[mcp]` are independent. Use `[ai,mcp]` when one environment needs every AI
24
+ capability and the MCP server.
25
+
26
+ Python `>=3.11, <3.15`. AI features run locally without cloud inference APIs, but model
27
+ weights are downloaded on first use. LLM-driven editing and scene captioning use a local
28
+ [Ollama](https://ollama.com) server (`ollama pull qwen3.6:27b`). Image and video
29
+ generation require an NVIDIA CUDA GPU. See the [install guide](https://videopython.com/install/)
30
+ for FFmpeg, Ollama, model downloads, and hardware details.
31
+
32
+ Videopython is pre-1.0. Public interfaces can still change before the stable release;
33
+ see the [roadmap](ROADMAP.md) for the stability criteria.
22
34
 
23
35
  ## Quick start
24
36
 
@@ -45,6 +57,11 @@ edit.run_to_file("output.mp4") # streams ffmpeg decode → effects → encode
45
57
 
46
58
  `run_to_file()` streams, so memory stays bounded even for hour-long sources. Walk through it in [Tutorial 1](https://videopython.com/tutorials/first-edit/).
47
59
 
60
+ [![A vertical clip rendered from a videopython JSON plan](https://videopython.com/assets/edit-plan-demo-poster.jpg)](https://videopython.com/how-to/agent-edit-demo/)
61
+
62
+ *A reproducible eight-second edit rendered from a JSON plan. View the plan, source, and
63
+ replay script in the [demo](https://videopython.com/how-to/agent-edit-demo/).*
64
+
48
65
  ### Automatic editing (local LLM)
49
66
 
50
67
  Give `AutoEditor` your clips and a brief; a local Ollama vision model selects and orders the shots, and you get back a runnable `VideoEdit`:
@@ -64,6 +81,9 @@ The model picks scenes **by id** from a catalog built from scene detection + cap
64
81
 
65
82
  ### AI generation
66
83
 
84
+ Image and video generation use large CUDA-only models. Speech generation can run on CPU
85
+ or CUDA.
86
+
67
87
  ```python
68
88
  from videopython.ai import TextToImage, ImageToVideo, TextToSpeech
69
89
 
@@ -73,18 +93,20 @@ audio = TextToSpeech().generate_audio("Welcome to videopython.")
73
93
  video.add_audio(audio).save("ai_video.mp4")
74
94
  ```
75
95
 
76
- ## LLM & AI agent integration
77
-
78
- Putting an LLM in the loop works three ways, differing in who owns the model:
96
+ ## Structured plans and automation
79
97
 
80
- 1. **Bring your own LLM** — videopython gives your model the JSON Schema and a structured refine loop; your model authors the plans. [Guide](https://videopython.com/how-to/llm-plans/)
81
- 2. **`AutoEditor`** — a local Ollama vision model is the planner. [Guide](https://videopython.com/how-to/auto-editing/)
82
- 3. **MCP server** — `videopython-mcp` exposes the pipeline as [Model Context Protocol](https://modelcontextprotocol.io) tools, so an agent like Claude drives editing with its own model. [Guide](https://videopython.com/how-to/mcp-server/)
98
+ The same validation and rendering path works whether a plan is written directly, loaded
99
+ from JSON, produced by a model, or submitted through MCP:
83
100
 
84
- See the [reproducible agent-authored edit demo](https://videopython.com/how-to/agent-edit-demo/)
85
- for a complete prompt, JSON plan, and rendered result that needs no model or API key.
101
+ 1. **Python or JSON** — construct `VideoEdit` directly, as in the quick start.
102
+ 2. **Your own LLM** — use the generated JSON Schema and structured refine loop. [Guide](https://videopython.com/how-to/llm-plans/)
103
+ 3. **`AutoEditor`** — use a local Ollama vision model to select and order scenes. [Guide](https://videopython.com/how-to/auto-editing/)
104
+ 4. **MCP** — expose analysis, planning, validation, and rendering tools to any compatible client. [Guide](https://videopython.com/how-to/mcp-server/)
86
105
 
87
- Mode 1 in brief: every operation is a Pydantic model whose fields *are* the JSON wire format, so `VideoEdit.json_schema()` hands your model a ready-made tool schema — a discriminated union over every LLM-exposed op (pass `strict=True` for provider grammar modes). Plans parse permissively and own their numeric bounds at validation, so a refine loop converges fast:
106
+ For schema-driven integrations, every operation is a Pydantic model whose fields are the
107
+ JSON wire format. `VideoEdit.json_schema()` returns a discriminated union over every
108
+ exposed operation; pass `strict=True` for provider grammar modes. Plans parse
109
+ permissively and report numeric bounds during validation, so a refine loop can use:
88
110
 
89
111
  - **`edit.check(meta)`** — collect *every* structured error in one pass, not just the first
90
112
  - **`edit.repair(meta)`** — auto-clamp mechanical violations (overruns, negatives) with a changelog
@@ -97,10 +119,10 @@ Why it is built this way: [LLM-first design](https://videopython.com/explanation
97
119
  - **`videopython.base`** — `Video`, `VideoMetadata`, `FrameIterator`, `Transcription`, and shared result types (`BoundingBox`, `FaceTrack`, `SceneBoundary`, ...). No AI dependencies.
98
120
  - **`videopython.audio`** — `Audio` with overlay, concat, normalize, time-stretch, silence detection, segment classification.
99
121
  - **`videopython.editing`** — `Operation`/`Effect` foundation, `VideoEdit` plan runner with JSON Schema + streaming execution. Transforms (resize, crop, fps, speed, freeze, silence removal; cutting is the segment's own start/end) and effects (blur, zoom, color grading, vignette, Ken Burns, fade, overlays, animated subtitles).
100
- - **`videopython.ai`** *(install with `[ai]`)* — generation (`TextToVideo`, `ImageToVideo`, `TextToImage`, `TextToSpeech`, `TextToMusic`), understanding (`AudioToText`, `AudioClassifier`, `SceneVLM`, `FaceTracker`, `ObjectDetector`, `SemanticSceneDetector`), the `FaceTrackingCrop` transform, the `ObjectDetectionOverlay` effect, and the full-pipeline `VideoAnalyzer`. Scene captioning and dubbing translation run on a local [Ollama](https://ollama.com) model.
122
+ - **`videopython.ai`** *(install with `[ai]`)* — generation (`TextToVideo`, `ImageToVideo`, `TextToImage`, `TextToSpeech`, `TextToMusic`), understanding (`AudioToText`, `AudioClassifier`, `SceneVLM`, `FaceShotTracker`, `FaceSmoothingTracker`, `ObjectDetector`, `SemanticSceneDetector`), the `FaceTrackingCrop` transform, the `ObjectDetectionOverlay` effect, and the full-pipeline `VideoAnalyzer`. Scene captioning and dubbing translation run on a local [Ollama](https://ollama.com) model.
101
123
  - **`videopython.ai.auto_edit`** — `AutoEditor` + `OllamaVisionLLM`: plan and render an edit from sources + a one-line brief.
102
124
  - **`videopython.ai.dubbing`** — `VideoDubber` for voice-cloned revoicing with timing sync.
103
- - **`videopython.mcp`** *(install with `[mcp]`)* — `videopython-mcp`, an MCP stdio server exposing the auto-edit pipeline so an agent drives editing. The extra includes the analysis and AI editing dependencies, but not generation, dubbing, diarization, source separation, or TTS.
125
+ - **`videopython.mcp`** *(install with `[mcp]`)* — `videopython-mcp`, an MCP stdio server exposing the auto-edit pipeline to compatible clients. The extra includes the analysis and AI editing dependencies, but not generation, dubbing, diarization, source separation, or TTS.
104
126
 
105
127
  ## Documentation
106
128
 
@@ -116,7 +138,4 @@ The docs follow [Diátaxis](https://diataxis.fr): four sections, each answering
116
138
  ## Development
117
139
 
118
140
  See [`DEVELOPMENT.md`](DEVELOPMENT.md) for local setup, testing, docs, and the release workflow.
119
-
120
- ## Project provenance
121
-
122
- This project started as a hand-written hobby project, but most of the code is now produced by LLM agents. Humans drive direction, approve changes, and own design decisions.
141
+ See [`ROADMAP.md`](ROADMAP.md) for project direction and the criteria for 1.0.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "videopython"
3
- version = "0.56.0"
3
+ version = "0.58.0"
4
4
  description = "LLM-friendly Python video editing with JSON plans, local AI, and MCP tools."
5
5
  authors = [
6
6
  { name = "Bartosz Wójtowicz", email = "bartoszwojtowicz@outlook.com" },
@@ -9,7 +9,7 @@ authors = [
9
9
  ]
10
10
  license = { text = "Apache-2.0" }
11
11
  readme = "README.md"
12
- requires-python = ">=3.11, <3.14"
12
+ requires-python = ">=3.11, <3.15"
13
13
  keywords = [
14
14
  "python",
15
15
  "videopython",
@@ -33,6 +33,7 @@ classifiers = [
33
33
  "Programming Language :: Python :: 3.11",
34
34
  "Programming Language :: Python :: 3.12",
35
35
  "Programming Language :: Python :: 3.13",
36
+ "Programming Language :: Python :: 3.14",
36
37
  "Operating System :: OS Independent",
37
38
  ]
38
39
 
@@ -79,7 +80,8 @@ ai = [
79
80
  "openai-whisper>=20240930",
80
81
  # Floored, not capped: numba declares the numpy cap, and without a floor a
81
82
  # resolver satisfies a newer numpy by backtracking numba instead, breaking
82
- # `import whisper`. 0.62 is the oldest release covering Python 3.11-3.13.
83
+ # `import whisper`. 0.62 is the oldest release for the lower supported
84
+ # Python versions; Numba's metadata selects a compatible release on 3.14.
83
85
  "numba>=0.62",
84
86
  "pyannote-audio>=4.0.0",
85
87
  "silero-vad>=5.1",
@@ -302,18 +302,6 @@ class Audio:
302
302
 
303
303
  return cls(data, metadata)
304
304
 
305
- @classmethod
306
- def from_file(cls, file_path: str | Path) -> Audio:
307
- """Deprecated: Use from_path() instead."""
308
- import warnings
309
-
310
- warnings.warn(
311
- "Audio.from_file() is deprecated, use Audio.from_path() instead",
312
- DeprecationWarning,
313
- stacklevel=2,
314
- )
315
- return cls.from_path(file_path)
316
-
317
305
  @classmethod
318
306
  def silence(
319
307
  cls,
@@ -268,7 +268,7 @@ def encode_video(
268
268
  "+faststart",
269
269
  "-t",
270
270
  str(duration),
271
- "-vsync",
271
+ "-fps_mode",
272
272
  "cfr",
273
273
  str(filename),
274
274
  ]
@@ -405,7 +405,7 @@ def extract_frames_at_indices(
405
405
  str(path),
406
406
  "-vf",
407
407
  f"select='{select_expr}'",
408
- "-vsync",
408
+ "-fps_mode",
409
409
  "vfr", # Variable frame rate output
410
410
  "-f",
411
411
  "rawvideo",
@@ -525,7 +525,7 @@ class FrameEncoder:
525
525
  "yuv420p",
526
526
  "-movflags",
527
527
  "+faststart",
528
- "-vsync",
528
+ "-fps_mode",
529
529
  "cfr",
530
530
  ]
531
531
  )
@@ -684,7 +684,7 @@ def stream_segment_filtergraph(
684
684
  "yuv420p",
685
685
  "-movflags",
686
686
  "+faststart",
687
- "-vsync",
687
+ "-fps_mode",
688
688
  "cfr",
689
689
  "-r",
690
690
  f"{final_fps:.10g}",
@@ -960,7 +960,7 @@ def stream_transition_pair(
960
960
  "yuv420p",
961
961
  "-movflags",
962
962
  "+faststart",
963
- "-vsync",
963
+ "-fps_mode",
964
964
  "cfr",
965
965
  "-r",
966
966
  str(fps),
@@ -0,0 +1,83 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel, ConfigDict
6
+
7
+
8
+ class SchemaIssue(BaseModel):
9
+ """One Pydantic schema-validation issue."""
10
+
11
+ model_config = ConfigDict(extra="forbid")
12
+
13
+ loc: list[str | int]
14
+ msg: str
15
+ type: str
16
+
17
+
18
+ class McpError(BaseModel):
19
+ """Structured error returned by an editing tool."""
20
+
21
+ model_config = ConfigDict(extra="forbid")
22
+
23
+ code: str
24
+ message: str
25
+ location: str | None = None
26
+ op: str | None = None
27
+ field: str | None = None
28
+ value: float | list[str] | None = None
29
+ limit: float | None = None
30
+ detail: str | list[SchemaIssue] | None = None
31
+
32
+
33
+ class McpRepair(BaseModel):
34
+ """One change made while repairing an edit plan."""
35
+
36
+ model_config = ConfigDict(extra="forbid")
37
+
38
+ location: str
39
+ field: str
40
+ old: float | str | None
41
+ new: float | str | None
42
+ code: str
43
+
44
+
45
+ class AnalyzeVideoResult(BaseModel):
46
+ """Summary returned after analysis is cached."""
47
+
48
+ model_config = ConfigDict(extra="forbid")
49
+
50
+ source: str
51
+ duration: float | None
52
+ fps: float | None
53
+ width: int | None
54
+ height: int | None
55
+ scenes: int
56
+
57
+
58
+ class ValidateEditResult(BaseModel):
59
+ """Result of edit-plan validation."""
60
+
61
+ model_config = ConfigDict(extra="forbid")
62
+
63
+ valid: bool
64
+ errors: list[McpError]
65
+
66
+
67
+ class RepairEditResult(BaseModel):
68
+ """Concrete repaired edit and its change records."""
69
+
70
+ model_config = ConfigDict(extra="forbid")
71
+
72
+ edit: dict[str, Any] | None
73
+ repairs: list[McpRepair]
74
+ errors: list[McpError]
75
+
76
+
77
+ class RunEditResult(BaseModel):
78
+ """Rendered output path or the errors that prevented rendering."""
79
+
80
+ model_config = ConfigDict(extra="forbid")
81
+
82
+ output_path: str | None
83
+ errors: list[McpError]
@@ -25,6 +25,16 @@ from videopython.ai.auto_edit import build_catalog as _build_scene_catalog
25
25
  from videopython.ai.keyframe import keyframe_to_png_b64
26
26
  from videopython.editing import VideoEdit
27
27
 
28
+ from ._models import (
29
+ AnalyzeVideoResult,
30
+ McpError,
31
+ McpRepair,
32
+ RepairEditResult,
33
+ RunEditResult,
34
+ SchemaIssue,
35
+ ValidateEditResult,
36
+ )
37
+
28
38
  if TYPE_CHECKING:
29
39
  from videopython.ai.auto_edit import CatalogBundle
30
40
  from videopython.ai.video_analysis import VideoAnalysis, VideoAnalyzer
@@ -42,7 +52,7 @@ _MAX_INLINE_KEYFRAMES = 12 # cap inlined keyframes in build_catalog; pull the r
42
52
 
43
53
 
44
54
  @mcp.tool()
45
- def analyze_video(path: str, profile: Literal["full", "editing"] = "editing") -> dict[str, Any]:
55
+ def analyze_video(path: str, profile: Literal["full", "editing"] = "editing") -> AnalyzeVideoResult:
46
56
  """Analyze a source video (scenes, transcript, captions) and cache it for build_catalog.
47
57
 
48
58
  The default ``profile="editing"`` skips audio classification; the catalog
@@ -56,14 +66,14 @@ def analyze_video(path: str, profile: Literal["full", "editing"] = "editing") ->
56
66
  analysis = _get_analyzer(profile).analyze_path(path)
57
67
  _analyses[str(Path(path))] = analysis
58
68
  src = analysis.source
59
- return {
60
- "source": str(Path(path)),
61
- "duration": src.duration,
62
- "fps": src.fps,
63
- "width": src.width,
64
- "height": src.height,
65
- "scenes": len(analysis.scenes.samples) if analysis.scenes else 0,
66
- }
69
+ return AnalyzeVideoResult(
70
+ source=str(Path(path)),
71
+ duration=src.duration,
72
+ fps=src.fps,
73
+ width=src.width,
74
+ height=src.height,
75
+ scenes=len(analysis.scenes.samples) if analysis.scenes else 0,
76
+ )
67
77
 
68
78
 
69
79
  @mcp.tool(structured_output=False)
@@ -113,7 +123,7 @@ def scene_keyframes(scene_ids: list[str]) -> list[TextContent | ImageContent]:
113
123
 
114
124
 
115
125
  @mcp.tool()
116
- def validate_edit(plan: dict[str, Any]) -> dict[str, Any]:
126
+ def validate_edit(plan: dict[str, Any]) -> ValidateEditResult:
117
127
  """Validate an edit plan (an EditPlan referencing catalog scene ids).
118
128
 
119
129
  Returns every problem at once as structured errors; ``valid`` is True when
@@ -122,13 +132,13 @@ def validate_edit(plan: dict[str, Any]) -> dict[str, Any]:
122
132
  """
123
133
  edit, errors = _resolve(plan)
124
134
  if edit is None:
125
- return {"valid": False, "errors": errors}
135
+ return ValidateEditResult(valid=False, errors=errors)
126
136
  errors = [_error_dict(e) for e in edit.check(_source_metadata(edit), context=_context())]
127
- return {"valid": not errors, "errors": errors}
137
+ return ValidateEditResult(valid=not errors, errors=errors)
128
138
 
129
139
 
130
140
  @mcp.tool()
131
- def repair_edit(plan: dict[str, Any]) -> dict[str, Any]:
141
+ def repair_edit(plan: dict[str, Any]) -> RepairEditResult:
132
142
  """Repair the mechanical issues in an edit plan and normalize segment dimensions.
133
143
 
134
144
  Returns the resolved+repaired VideoEdit and a changelog, for inspection;
@@ -139,16 +149,20 @@ def repair_edit(plan: dict[str, Any]) -> dict[str, Any]:
139
149
  """
140
150
  edit, errors = _resolve(plan)
141
151
  if edit is None:
142
- return {"edit": None, "repairs": [], "errors": errors}
152
+ return RepairEditResult(edit=None, repairs=[], errors=errors)
143
153
  metadata = _source_metadata(edit)
144
154
  context = _context()
145
155
  edit, repairs = edit.repair(metadata, context=context, clamp_segment_end=True)
146
156
  edit, dim_repairs = edit.normalize_dimensions(metadata, "largest", context=context)
147
- return {"edit": edit.to_dict(), "repairs": [_repair_dict(r) for r in (*repairs, *dim_repairs)], "errors": []}
157
+ return RepairEditResult(
158
+ edit=edit.to_dict(),
159
+ repairs=[_repair_dict(r) for r in (*repairs, *dim_repairs)],
160
+ errors=[],
161
+ )
148
162
 
149
163
 
150
164
  @mcp.tool()
151
- def run_edit(plan: dict[str, Any], output_path: str) -> dict[str, Any]:
165
+ def run_edit(plan: dict[str, Any], output_path: str) -> RunEditResult:
152
166
  """Render an edit plan to an MP4 file (the path suffix is normalized to .mp4).
153
167
 
154
168
  Resolves scene ids, repairs + normalizes, validates, then renders. If the
@@ -157,16 +171,16 @@ def run_edit(plan: dict[str, Any], output_path: str) -> dict[str, Any]:
157
171
  """
158
172
  edit, errors = _resolve(plan)
159
173
  if edit is None:
160
- return {"output_path": None, "errors": errors}
174
+ return RunEditResult(output_path=None, errors=errors)
161
175
  metadata = _source_metadata(edit)
162
176
  context = _context()
163
177
  edit, _ = edit.repair(metadata, context=context, clamp_segment_end=True)
164
178
  edit, _ = edit.normalize_dimensions(metadata, "largest", context=context)
165
179
  errors = [_error_dict(e) for e in edit.check(metadata, context=context)]
166
180
  if errors:
167
- return {"output_path": None, "errors": errors}
181
+ return RunEditResult(output_path=None, errors=errors)
168
182
  out = edit.run_to_file(output_path, context=context)
169
- return {"output_path": str(out), "errors": []}
183
+ return RunEditResult(output_path=str(out), errors=[])
170
184
 
171
185
 
172
186
  @mcp.resource("schema://videopython/edit-plan", mime_type="application/json")
@@ -202,17 +216,17 @@ def _keyframe_blocks(scene_ids: list[str]) -> list[TextContent | ImageContent]:
202
216
  return blocks
203
217
 
204
218
 
205
- def _resolve(plan: dict[str, Any]) -> tuple[VideoEdit | None, list[dict[str, Any]]]:
219
+ def _resolve(plan: dict[str, Any]) -> tuple[VideoEdit | None, list[McpError]]:
206
220
  """Resolve a by-id plan, or return (None, structured errors) for the agent's plan mistakes."""
207
221
  if _bundle is None:
208
222
  raise ValueError("No catalog cached; call build_catalog first.")
209
223
  try:
210
224
  edit = resolve_plan(EditPlan.model_validate(plan), _bundle.catalog)
211
225
  except ValidationError as exc:
212
- detail = [{"loc": list(e["loc"]), "msg": e["msg"], "type": e["type"]} for e in exc.errors()]
213
- return None, [{"code": "schema_invalid", "detail": detail, "message": str(exc)}]
226
+ detail = [SchemaIssue(loc=list(e["loc"]), msg=e["msg"], type=e["type"]) for e in exc.errors()]
227
+ return None, [McpError(code="schema_invalid", detail=detail, message=str(exc))]
214
228
  except UnknownSceneIdsError as exc:
215
- return None, [{"code": "unknown_scene_ids", "value": sorted(set(exc.ids)), "message": str(exc)}]
229
+ return None, [McpError(code="unknown_scene_ids", value=sorted(set(exc.ids)), message=str(exc))]
216
230
  return edit, []
217
231
 
218
232
 
@@ -231,27 +245,27 @@ def _context() -> dict[str, Any] | None:
231
245
  return {"transcription": transcriptions} if transcriptions else None
232
246
 
233
247
 
234
- def _error_dict(error: PlanError) -> dict[str, Any]:
235
- return {
236
- "code": error.code.value,
237
- "location": error.location,
238
- "op": error.op,
239
- "field": error.field,
240
- "value": error.value,
241
- "limit": error.limit,
242
- "detail": error.detail,
243
- "message": error.to_prompt_line(),
244
- }
245
-
246
-
247
- def _repair_dict(repair: PlanRepair) -> dict[str, Any]:
248
- return {
249
- "location": repair.location,
250
- "field": repair.field,
251
- "old": repair.old,
252
- "new": repair.new,
253
- "code": repair.code.value,
254
- }
248
+ def _error_dict(error: PlanError) -> McpError:
249
+ return McpError(
250
+ code=error.code.value,
251
+ location=error.location,
252
+ op=error.op,
253
+ field=error.field,
254
+ value=error.value,
255
+ limit=error.limit,
256
+ detail=error.detail,
257
+ message=error.to_prompt_line(),
258
+ )
259
+
260
+
261
+ def _repair_dict(repair: PlanRepair) -> McpRepair:
262
+ return McpRepair(
263
+ location=repair.location,
264
+ field=repair.field,
265
+ old=repair.old,
266
+ new=repair.new,
267
+ code=repair.code.value,
268
+ )
255
269
 
256
270
 
257
271
  def main() -> None:
File without changes
File without changes