videopython 0.35.0__tar.gz → 0.36.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.35.0 → videopython-0.36.0}/PKG-INFO +2 -2
- {videopython-0.35.0 → videopython-0.36.0}/README.md +1 -1
- {videopython-0.35.0 → videopython-0.36.0}/pyproject.toml +11 -3
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/generation/qwen3.py +124 -19
- videopython-0.36.0/src/videopython/base/exceptions.py +123 -0
- videopython-0.36.0/src/videopython/base/fonts/Anton-OFL.txt +93 -0
- videopython-0.36.0/src/videopython/base/fonts/Anton-Regular.ttf +0 -0
- videopython-0.36.0/src/videopython/base/fonts/BebasNeue-OFL.txt +93 -0
- videopython-0.36.0/src/videopython/base/fonts/BebasNeue-Regular.ttf +0 -0
- videopython-0.36.0/src/videopython/base/fonts/Lato-Bold.ttf +0 -0
- videopython-0.36.0/src/videopython/base/fonts/Lato-OFL.txt +93 -0
- videopython-0.36.0/src/videopython/base/fonts/Poppins-Bold.ttf +0 -0
- videopython-0.36.0/src/videopython/base/fonts/Poppins-OFL.txt +93 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/fonts/__init__.py +28 -5
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/effects.py +20 -2
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/operation.py +69 -6
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/transcription_overlay.py +32 -7
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/transforms.py +36 -4
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/video_edit.py +267 -61
- videopython-0.35.0/src/videopython/base/exceptions.py +0 -73
- {videopython-0.35.0 → videopython-0.36.0}/.gitignore +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/LICENSE +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/_device.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/config.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/dubber.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/expressiveness.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/loudness.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/models.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/pipeline.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/quality.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/remux.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/timing.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/dubbing/voice_sample.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/generation/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/generation/audio.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/generation/image.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/generation/translation.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/generation/video.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/transforms.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/understanding/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/understanding/audio.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/understanding/faces.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/understanding/image.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/understanding/separation.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/understanding/temporal.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/video_analysis/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/video_analysis/analyzer.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/video_analysis/models.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/video_analysis/sampling.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/ai/video_analysis/stages.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/audio/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/audio/analysis.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/audio/audio.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/_dimensions.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/_ffmpeg.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/_video_io.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/description.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/fonts/DejaVuSans.ttf +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/fonts/LICENSE_DEJAVU +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/image_text.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/transcription.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/base/video.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/__init__.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/editing/streaming.py +0 -0
- {videopython-0.35.0 → videopython-0.36.0}/src/videopython/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: videopython
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.36.0
|
|
4
4
|
Summary: Minimal video generation and processing library.
|
|
5
5
|
Project-URL: Homepage, https://videopython.com
|
|
6
6
|
Project-URL: Repository, https://github.com/bartwojtowicz/videopython/
|
|
@@ -109,7 +109,7 @@ video.add_audio(audio).save("ai_video.mp4")
|
|
|
109
109
|
|
|
110
110
|
## LLM & AI Agent Integration
|
|
111
111
|
|
|
112
|
-
Every operation is a Pydantic model whose fields ARE the JSON wire format. `VideoEdit.json_schema()` returns a JSON Schema with a discriminated union over every
|
|
112
|
+
Every operation is a Pydantic model whose fields ARE the JSON wire format. `VideoEdit.json_schema()` returns a JSON Schema with a discriminated union over every LLM-exposed `Operation` (server-only ops like `image_overlay` are excluded by default) — pass it straight to Anthropic tool use, OpenAI function calling, or any structured-output API. Then `edit.validate()` dry-runs the plan via metadata before any frames are loaded, raising a typed `PlanValidationError` (with structured `.errors`) that can be fed back to the LLM and retried cheaply.
|
|
113
113
|
|
|
114
114
|
See the [LLM Integration Guide](https://videopython.com/guides/llm-integration/) for end-to-end examples, validation error loops, and operation discovery patterns.
|
|
115
115
|
|
|
@@ -60,7 +60,7 @@ video.add_audio(audio).save("ai_video.mp4")
|
|
|
60
60
|
|
|
61
61
|
## LLM & AI Agent Integration
|
|
62
62
|
|
|
63
|
-
Every operation is a Pydantic model whose fields ARE the JSON wire format. `VideoEdit.json_schema()` returns a JSON Schema with a discriminated union over every
|
|
63
|
+
Every operation is a Pydantic model whose fields ARE the JSON wire format. `VideoEdit.json_schema()` returns a JSON Schema with a discriminated union over every LLM-exposed `Operation` (server-only ops like `image_overlay` are excluded by default) — pass it straight to Anthropic tool use, OpenAI function calling, or any structured-output API. Then `edit.validate()` dry-runs the plan via metadata before any frames are loaded, raising a typed `PlanValidationError` (with structured `.errors`) that can be fed back to the LLM and retried cheaply.
|
|
64
64
|
|
|
65
65
|
See the [LLM Integration Guide](https://videopython.com/guides/llm-integration/) for end-to-end examples, validation error loops, and operation discovery patterns.
|
|
66
66
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "videopython"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.36.0"
|
|
4
4
|
description = "Minimal video generation and processing library."
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Bartosz Wójtowicz", email = "bartoszwojtowicz@outlook.com" },
|
|
@@ -186,11 +186,19 @@ build-backend = "hatchling.build"
|
|
|
186
186
|
|
|
187
187
|
[tool.hatch.build.targets.wheel]
|
|
188
188
|
packages = ["src/videopython"]
|
|
189
|
-
artifacts = [
|
|
189
|
+
artifacts = [
|
|
190
|
+
"src/videopython/base/fonts/*.ttf",
|
|
191
|
+
"src/videopython/base/fonts/LICENSE_DEJAVU",
|
|
192
|
+
"src/videopython/base/fonts/*-OFL.txt",
|
|
193
|
+
]
|
|
190
194
|
|
|
191
195
|
[tool.hatch.build.targets.sdist]
|
|
192
196
|
include = ["src/videopython", "src/videopython/py.typed"]
|
|
193
|
-
artifacts = [
|
|
197
|
+
artifacts = [
|
|
198
|
+
"src/videopython/base/fonts/*.ttf",
|
|
199
|
+
"src/videopython/base/fonts/LICENSE_DEJAVU",
|
|
200
|
+
"src/videopython/base/fonts/*-OFL.txt",
|
|
201
|
+
]
|
|
194
202
|
|
|
195
203
|
[tool.pytest.ini_options]
|
|
196
204
|
pythonpath = ["src/"]
|
|
@@ -92,6 +92,56 @@ _SPEECH_CHARS_DEFAULT = 12.0
|
|
|
92
92
|
_LOW_LOGPROB_HINT_THRESHOLD = -1.0
|
|
93
93
|
|
|
94
94
|
|
|
95
|
+
# Conservative chars-per-token used to size chunks without invoking the
|
|
96
|
+
# tokenizer. Morphologically rich languages land around 1.5-2.0
|
|
97
|
+
# chars/token; ASCII is ~3-4. We use the low end so chunks stay safe for
|
|
98
|
+
# any source language.
|
|
99
|
+
_CHARS_PER_TOKEN = 2.0
|
|
100
|
+
# Token reserve for the system prompt + user-prompt envelope ("Input
|
|
101
|
+
# segments:" / "Translations (...)" wrappers). Empirical upper bound.
|
|
102
|
+
_PROMPT_OVERHEAD_TOKENS = 300
|
|
103
|
+
# Per-segment JSON wrapper cost (keys, braces, commas, index). Added on
|
|
104
|
+
# top of len(seg.text) when sizing chunks.
|
|
105
|
+
_SEGMENT_ENVELOPE_CHARS = 40
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _chunk_segment_indices(
|
|
109
|
+
segments: list[TranscriptionSegment],
|
|
110
|
+
n_ctx: int,
|
|
111
|
+
max_tokens: int,
|
|
112
|
+
) -> list[list[int]]:
|
|
113
|
+
"""Group positions in ``segments`` into batches that fit one Qwen call.
|
|
114
|
+
|
|
115
|
+
Each batch must satisfy ``prompt_tokens + max_tokens <= n_ctx``, which
|
|
116
|
+
llama.cpp enforces. We approximate prompt token count from character
|
|
117
|
+
length using ``_CHARS_PER_TOKEN``; the conservative ratio means a chunk
|
|
118
|
+
estimated at the budget will tokenize to comfortably less.
|
|
119
|
+
|
|
120
|
+
A segment whose own serialized form exceeds the per-call budget goes in
|
|
121
|
+
its own chunk anyway — better to let llama.cpp report a clean overflow
|
|
122
|
+
on one giant segment than to silently swallow it.
|
|
123
|
+
"""
|
|
124
|
+
prompt_token_budget = n_ctx - max_tokens - _PROMPT_OVERHEAD_TOKENS
|
|
125
|
+
if prompt_token_budget <= 0:
|
|
126
|
+
return [[i] for i in range(len(segments))]
|
|
127
|
+
char_budget = int(prompt_token_budget * _CHARS_PER_TOKEN)
|
|
128
|
+
|
|
129
|
+
chunks: list[list[int]] = []
|
|
130
|
+
current: list[int] = []
|
|
131
|
+
current_chars = 0
|
|
132
|
+
for i, seg in enumerate(segments):
|
|
133
|
+
seg_chars = len(seg.text) + _SEGMENT_ENVELOPE_CHARS
|
|
134
|
+
if current and current_chars + seg_chars > char_budget:
|
|
135
|
+
chunks.append(current)
|
|
136
|
+
current = []
|
|
137
|
+
current_chars = 0
|
|
138
|
+
current.append(i)
|
|
139
|
+
current_chars += seg_chars
|
|
140
|
+
if current:
|
|
141
|
+
chunks.append(current)
|
|
142
|
+
return chunks
|
|
143
|
+
|
|
144
|
+
|
|
95
145
|
def _target_chars_for(duration_seconds: float, target_lang: str) -> int:
|
|
96
146
|
"""Character-count budget for a segment of ``duration_seconds`` in ``target_lang``."""
|
|
97
147
|
rate = _SPEECH_CHARS_PER_SEC.get(target_lang, _SPEECH_CHARS_DEFAULT)
|
|
@@ -170,9 +220,12 @@ class Qwen3Translator:
|
|
|
170
220
|
``DEFAULT_REPO_ID``; override for eval harnesses.
|
|
171
221
|
filename: GGUF filename within ``repo_id``. Defaults to
|
|
172
222
|
``DEFAULT_FILENAME``.
|
|
173
|
-
n_ctx: llama.cpp context window.
|
|
174
|
-
|
|
175
|
-
|
|
223
|
+
n_ctx: llama.cpp context window. ``translate_segments`` splits the
|
|
224
|
+
input across multiple calls when it doesn't fit, so 8192 stays
|
|
225
|
+
safe even for very long sources; raise to reduce the number of
|
|
226
|
+
calls (and gain cross-segment context per call) at the cost of
|
|
227
|
+
VRAM. Hard cap is the model's training context (262K for
|
|
228
|
+
Qwen3-4B-Instruct-2507).
|
|
176
229
|
max_tokens: Generation cap per call. 4× the input character count
|
|
177
230
|
is a safe upper bound for translation output.
|
|
178
231
|
temperature: Decoding temperature. 0.1 keeps output structurally
|
|
@@ -257,6 +310,52 @@ class Qwen3Translator:
|
|
|
257
310
|
raw = response["choices"][0]["text"]
|
|
258
311
|
return _parse_jsonl_response(raw)
|
|
259
312
|
|
|
313
|
+
def _qwen_translate_chunked(
|
|
314
|
+
self,
|
|
315
|
+
segments: list[TranscriptionSegment],
|
|
316
|
+
target_lang: str,
|
|
317
|
+
source_lang: str,
|
|
318
|
+
progress_callback: Callable[[float], None] | None = None,
|
|
319
|
+
progress_start: float = 0.0,
|
|
320
|
+
progress_end: float = 1.0,
|
|
321
|
+
) -> dict[int, str]:
|
|
322
|
+
"""Translate ``segments`` across one or more Qwen calls.
|
|
323
|
+
|
|
324
|
+
Returns a dict keyed by position in ``segments``. Splitting into
|
|
325
|
+
chunks keeps each call under llama.cpp's ``n_ctx`` cap — without
|
|
326
|
+
chunking, a long source with hundreds of dense segments easily
|
|
327
|
+
blows past the default 8192 token window.
|
|
328
|
+
|
|
329
|
+
Progress is reported as a linear ramp from ``progress_start`` to
|
|
330
|
+
``progress_end``, one tick per chunk completed.
|
|
331
|
+
"""
|
|
332
|
+
results: dict[int, str] = {}
|
|
333
|
+
if not segments:
|
|
334
|
+
if progress_callback is not None:
|
|
335
|
+
progress_callback(progress_end)
|
|
336
|
+
return results
|
|
337
|
+
|
|
338
|
+
chunks = _chunk_segment_indices(segments, self.n_ctx, self.max_tokens)
|
|
339
|
+
if len(chunks) > 1:
|
|
340
|
+
logger.info(
|
|
341
|
+
"Qwen3Translator: splitting %d segments into %d chunks (n_ctx=%d)",
|
|
342
|
+
len(segments),
|
|
343
|
+
len(chunks),
|
|
344
|
+
self.n_ctx,
|
|
345
|
+
)
|
|
346
|
+
for chunk_num, chunk_positions in enumerate(chunks):
|
|
347
|
+
chunk_segments = [segments[p] for p in chunk_positions]
|
|
348
|
+
chunk_result = self._qwen_translate(chunk_segments, target_lang, source_lang)
|
|
349
|
+
# chunk_result keys are 0..len(chunk_positions)-1; map back to
|
|
350
|
+
# positions in the caller-provided ``segments`` list.
|
|
351
|
+
for local_idx, text in chunk_result.items():
|
|
352
|
+
if 0 <= local_idx < len(chunk_positions):
|
|
353
|
+
results[chunk_positions[local_idx]] = text
|
|
354
|
+
if progress_callback is not None:
|
|
355
|
+
fraction = (chunk_num + 1) / len(chunks)
|
|
356
|
+
progress_callback(progress_start + (progress_end - progress_start) * fraction)
|
|
357
|
+
return results
|
|
358
|
+
|
|
260
359
|
def translate_segments(
|
|
261
360
|
self,
|
|
262
361
|
segments: list[TranscriptionSegment],
|
|
@@ -266,10 +365,10 @@ class Qwen3Translator:
|
|
|
266
365
|
) -> list[TranslatedSegment]:
|
|
267
366
|
"""Translate segments via Qwen with parse-retry + optional Marian fallback.
|
|
268
367
|
|
|
269
|
-
The progress_callback
|
|
270
|
-
Qwen
|
|
271
|
-
end.
|
|
272
|
-
|
|
368
|
+
The progress_callback ramps from 0 to 0.5 across the first-pass
|
|
369
|
+
Qwen chunks, hits 0.9 after the optional retry/fallback, and 1.0
|
|
370
|
+
at the end. Input larger than the model's context window is split
|
|
371
|
+
across multiple Qwen calls (see ``_qwen_translate_chunked``).
|
|
273
372
|
"""
|
|
274
373
|
effective_source = source_lang or "en"
|
|
275
374
|
self._failures_last_call = []
|
|
@@ -277,13 +376,15 @@ class Qwen3Translator:
|
|
|
277
376
|
translatable_indices = [i for i, seg in enumerate(segments) if _is_translatable_text(seg.text)]
|
|
278
377
|
translatable_segments = [segments[i] for i in translatable_indices]
|
|
279
378
|
|
|
280
|
-
# First attempt.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
379
|
+
# First attempt — chunked to fit n_ctx.
|
|
380
|
+
qwen_results = self._qwen_translate_chunked(
|
|
381
|
+
translatable_segments,
|
|
382
|
+
target_lang,
|
|
383
|
+
effective_source,
|
|
384
|
+
progress_callback=progress_callback,
|
|
385
|
+
progress_start=0.0,
|
|
386
|
+
progress_end=0.5,
|
|
387
|
+
)
|
|
287
388
|
|
|
288
389
|
# Identify segments Qwen failed (unparseable or missing index).
|
|
289
390
|
# Indices in qwen_results / translatable_segments are 0-based positions
|
|
@@ -299,11 +400,15 @@ class Qwen3Translator:
|
|
|
299
400
|
len(retry_segments),
|
|
300
401
|
len(translatable_segments),
|
|
301
402
|
)
|
|
302
|
-
retry_results = self.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
403
|
+
retry_results = self._qwen_translate_chunked(
|
|
404
|
+
retry_segments,
|
|
405
|
+
target_lang,
|
|
406
|
+
effective_source,
|
|
407
|
+
)
|
|
408
|
+
# retry_results keys are positions in retry_segments; map back to
|
|
409
|
+
# translatable_segments.
|
|
410
|
+
for retry_local, translation in retry_results.items():
|
|
411
|
+
qwen_results[missing_local_indices[retry_local]] = translation
|
|
307
412
|
if progress_callback is not None:
|
|
308
413
|
progress_callback(0.9)
|
|
309
414
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""Exception hierarchy for videopython.base module."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class VideoPythonError(Exception):
|
|
10
|
+
"""Base exception for all videopython errors."""
|
|
11
|
+
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FFmpegError(VideoPythonError):
|
|
16
|
+
"""Base exception for ffmpeg/ffprobe subprocess failures."""
|
|
17
|
+
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class FFmpegProbeError(FFmpegError):
|
|
22
|
+
"""Raised when an ffprobe invocation or its JSON output fails."""
|
|
23
|
+
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class FFmpegRunError(FFmpegError):
|
|
28
|
+
"""Raised when a blocking ffmpeg run returns a non-zero exit code."""
|
|
29
|
+
|
|
30
|
+
pass
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class VideoError(VideoPythonError):
|
|
34
|
+
"""Base exception for video-related errors."""
|
|
35
|
+
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class VideoLoadError(VideoError):
|
|
40
|
+
"""Raised when there's an error loading a video file."""
|
|
41
|
+
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class VideoMetadataError(VideoError):
|
|
46
|
+
"""Raised when there's an error getting video metadata."""
|
|
47
|
+
|
|
48
|
+
pass
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AudioError(VideoPythonError):
|
|
52
|
+
"""Base exception for audio-related errors."""
|
|
53
|
+
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class AudioLoadError(AudioError):
|
|
58
|
+
"""Raised when there's an error loading audio."""
|
|
59
|
+
|
|
60
|
+
pass
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class TransformError(VideoPythonError):
|
|
64
|
+
"""Base exception for transformation errors."""
|
|
65
|
+
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class TextRenderError(VideoPythonError):
|
|
70
|
+
"""Base exception for text rendering errors."""
|
|
71
|
+
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class OutOfBoundsError(TextRenderError):
|
|
76
|
+
"""Raised when text would be rendered outside image bounds."""
|
|
77
|
+
|
|
78
|
+
pass
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class PlanErrorCode(str, Enum):
|
|
82
|
+
"""Machine-readable failure classes raised while validating a ``VideoEdit``.
|
|
83
|
+
|
|
84
|
+
Scoped to what videopython owns. A consumer can branch on these codes
|
|
85
|
+
instead of substring-matching the human message text.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
SEGMENT_END_EXCEEDS_SOURCE = "segment_end_exceeds_source"
|
|
89
|
+
EFFECT_WINDOW_EXCEEDS_DURATION = "effect_window_exceeds_duration"
|
|
90
|
+
CUT_EXCEEDS_DURATION = "cut_exceeds_duration"
|
|
91
|
+
UNKNOWN_OP = "unknown_op"
|
|
92
|
+
CONCAT_MISMATCH = "concat_mismatch"
|
|
93
|
+
SUBTITLE_UNFITTABLE = "subtitle_unfittable"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@dataclass
|
|
97
|
+
class PlanError:
|
|
98
|
+
"""A single structured validation failure within a plan.
|
|
99
|
+
|
|
100
|
+
``location`` is a path into the plan (e.g. ``'segments[1].operations[0]'``);
|
|
101
|
+
the remaining fields are populated when meaningful for the ``code``.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
code: PlanErrorCode
|
|
105
|
+
location: str | None = None
|
|
106
|
+
op: str | None = None
|
|
107
|
+
field: str | None = None
|
|
108
|
+
value: float | None = None
|
|
109
|
+
limit: float | None = None
|
|
110
|
+
predicted_duration: float | None = None
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class PlanValidationError(ValueError):
|
|
114
|
+
"""Typed plan-validation failure carrying structured :class:`PlanError`s.
|
|
115
|
+
|
|
116
|
+
Subclasses ``ValueError`` so ``str(e)`` stays byte-identical to the bare
|
|
117
|
+
``ValueError`` prose emitted before this type existed -- existing
|
|
118
|
+
``pytest.raises(match=...)`` and consumer substring fallbacks keep working.
|
|
119
|
+
"""
|
|
120
|
+
|
|
121
|
+
def __init__(self, message: str, errors: list[PlanError]):
|
|
122
|
+
super().__init__(message)
|
|
123
|
+
self.errors = errors
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2020 The Anton Project Authors (https://github.com/googlefonts/AntonFont.git)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright © 2010 by Dharma Type.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato"
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|