davinci-resolve-mcp 4.19.0 → 4.19.2
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.
- package/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/README.zh-CN.md +2 -2
- package/install.py +1 -1
- package/package.json +1 -1
- package/src/granular/common.py +1 -1
- package/src/server.py +1 -1
- package/src/utils/embeddings.py +73 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Release history for the DaVinci Resolve MCP Server. The latest release is summarized in the root README; older entries live here to keep the README focused.
|
|
4
4
|
|
|
5
|
+
## What's New in v4.19.2 — Media analysis says whether CLAP audio embedding actually works
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- **`audio.verified` and `audio.last_error` in the embedding capabilities.** `audio.available` only means the packages import, which is how #343 reported `clap_audio` as available while no embedding call had ever succeeded. `verified` is true once an embedding call has succeeded in this process. `last_error` is the most recent failure of one, and the next success clears it.
|
|
10
|
+
- **`probe_audio_backend()`** runs one real audio embedding (a second of silence) and one text embedding, and fills those two fields. It loads the model, so the first call may download it. Capability detection never runs it.
|
|
11
|
+
|
|
12
|
+
### Not changed
|
|
13
|
+
|
|
14
|
+
- `audio.available` keeps its import-level meaning.
|
|
15
|
+
- Nothing calls the probe from a tool yet; it is a library function. Covered by mocked tests only: not run against a real model or a real transformers 5.x install. No Resolve behavior changed.
|
|
16
|
+
|
|
17
|
+
## What's New in v4.19.1 — CLAP audio embeddings work on transformers 5.x
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **`media_analysis` CLAP audio embeddings on transformers 5.x** (#343, reported by @willturner-maker). The `transformers_clap` backend failed twice on 5.x: the processor rejected the old `audios=` keyword, and `get_audio_features` / `get_text_features` now return a `BaseModelOutputWithPooling` instead of a tensor, so the normalisation raised `AttributeError`. The processor is now called with `audio=` and falls back to `audios=` on older releases, and the embedding is read from `pooler_output` when the result is not a tensor. Both audio-window and text-query embedding take the same path.
|
|
22
|
+
|
|
23
|
+
### Not changed
|
|
24
|
+
|
|
25
|
+
- `capabilities()` still reports `clap_audio` available when `transformers` imports; it does not load the model to check it can produce embeddings.
|
|
26
|
+
- Checked with fake processor and model objects for both return shapes. Not run against a real transformers 5.x install, and no Resolve behavior changed.
|
|
27
|
+
|
|
5
28
|
## What's New in v4.19.0 — Studio 21 speed ramps, keyframed grades and Magic Mask clicks (offline writers)
|
|
6
29
|
|
|
7
30
|
@Reaperiguess measured three things the scripting API cannot do on Studio 21 and wrote offline writers for them, each checked by renders on Studio 21.0.4.5 (Windows) (#312).
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
[](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
|
|
6
6
|
[](https://www.npmjs.com/package/davinci-resolve-mcp)
|
|
7
7
|
[](docs/reference/api-coverage.md)
|
|
8
8
|
[-blue.svg)](#server-modes)
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
[](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
|
|
6
6
|
[](https://www.npmjs.com/package/davinci-resolve-mcp)
|
|
7
7
|
[](docs/reference/api-coverage.md)
|
|
8
8
|
[-blue.svg)](#服务器模式)
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
[](https://www.python.org/downloads/)
|
|
13
13
|
[](https://opensource.org/licenses/MIT)
|
|
14
14
|
|
|
15
|
-
> 本翻译对应 v4.19.
|
|
15
|
+
> 本翻译对应 v4.19.2 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
|
|
16
16
|
|
|
17
17
|
一个 Model Context Protocol (MCP) 服务器,让 AI 助手通过官方脚本 API 控制 DaVinci Resolve Studio(达芬奇)。它提供完整的 API 覆盖,外加带护栏的工作流助手,涵盖剪辑、媒体池整理、渲染设置、审阅标记、调色、Fusion、Fairlight、项目生命周期任务、扩展开发,以及不碰源媒体的媒体分析。
|
|
18
18
|
|
package/install.py
CHANGED
|
@@ -37,7 +37,7 @@ from src.utils.update_check import (
|
|
|
37
37
|
|
|
38
38
|
# ─── Version ──────────────────────────────────────────────────────────────────
|
|
39
39
|
|
|
40
|
-
VERSION = "4.19.
|
|
40
|
+
VERSION = "4.19.2"
|
|
41
41
|
# Only hard floor: mcp[cli] requires Python 3.10+. There is no upper bound —
|
|
42
42
|
# Resolve's scripting bridge loads into newer interpreters on recent builds
|
|
43
43
|
# (Python 3.14 verified against Resolve Studio 20.3.2). Older Resolve builds
|
package/package.json
CHANGED
package/src/granular/common.py
CHANGED
|
@@ -93,7 +93,7 @@ if not logging.getLogger().handlers:
|
|
|
93
93
|
handlers=[logging.StreamHandler()],
|
|
94
94
|
)
|
|
95
95
|
|
|
96
|
-
VERSION = "4.19.
|
|
96
|
+
VERSION = "4.19.2"
|
|
97
97
|
logger = logging.getLogger("davinci-resolve-mcp")
|
|
98
98
|
logger.info(f"Starting DaVinci Resolve MCP Server v{VERSION}")
|
|
99
99
|
logger.info(f"Detected platform: {get_platform()}")
|
package/src/server.py
CHANGED
package/src/utils/embeddings.py
CHANGED
|
@@ -51,6 +51,10 @@ _EMBED_TIMEOUT_SECONDS = 120.0
|
|
|
51
51
|
_ST_MODEL = None
|
|
52
52
|
_CLIP_STATE: Optional[Tuple[Any, Any, Any]] = None # (model, preprocess, torch)
|
|
53
53
|
_CLAP_STATE: Optional[Tuple[str, Any]] = None # (backend, state)
|
|
54
|
+
# What this process has actually observed of the audio backend. ``available``
|
|
55
|
+
# only means the packages import; these say whether an embedding call worked.
|
|
56
|
+
_CLAP_VERIFIED = False
|
|
57
|
+
_CLAP_LAST_ERROR: Optional[str] = None
|
|
54
58
|
|
|
55
59
|
|
|
56
60
|
def _now() -> str:
|
|
@@ -189,6 +193,11 @@ def detect_embedding_capabilities() -> Dict[str, Any]:
|
|
|
189
193
|
"backends": audio_backends,
|
|
190
194
|
"model": CLAP_HF_MODEL if audio_backends else None,
|
|
191
195
|
"ffmpeg": ffmpeg_available,
|
|
196
|
+
# ``available`` is import-level only. ``verified`` is True once an
|
|
197
|
+
# embedding call has succeeded in this process; ``last_error`` is
|
|
198
|
+
# the most recent failure of one (cleared by the next success).
|
|
199
|
+
"verified": _CLAP_VERIFIED,
|
|
200
|
+
"last_error": _CLAP_LAST_ERROR,
|
|
192
201
|
},
|
|
193
202
|
"install_guidance": guidance,
|
|
194
203
|
}
|
|
@@ -367,15 +376,71 @@ def _extract_audio_window(file_path: str, start_seconds: float, duration_seconds
|
|
|
367
376
|
return samples if samples.size else None
|
|
368
377
|
|
|
369
378
|
|
|
379
|
+
def _clap_embedding_tensor(output: Any) -> Any:
|
|
380
|
+
"""Unwrap a ``get_*_features`` result to the embedding tensor.
|
|
381
|
+
|
|
382
|
+
transformers < 5 returns the tensor directly; 5.x returns a
|
|
383
|
+
``BaseModelOutputWithPooling`` whose ``pooler_output`` is the embedding.
|
|
384
|
+
"""
|
|
385
|
+
if hasattr(output, "norm"):
|
|
386
|
+
return output
|
|
387
|
+
pooled = getattr(output, "pooler_output", None)
|
|
388
|
+
if pooled is not None:
|
|
389
|
+
return pooled
|
|
390
|
+
raise TypeError(f"Unrecognised CLAP feature output: {type(output).__name__}")
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def _clap_process_audio(processor: Any, waveforms: List[Any]) -> Any:
|
|
394
|
+
"""Call the CLAP processor with ``audio=`` (5.x), falling back to the
|
|
395
|
+
older ``audios=`` keyword."""
|
|
396
|
+
kwargs = {"sampling_rate": CLAP_SAMPLE_RATE, "return_tensors": "pt", "padding": True}
|
|
397
|
+
try:
|
|
398
|
+
return processor(audio=waveforms, **kwargs)
|
|
399
|
+
except (TypeError, ValueError):
|
|
400
|
+
return processor(audios=waveforms, **kwargs)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def _clap_record(error: Optional[BaseException]) -> None:
|
|
404
|
+
global _CLAP_VERIFIED, _CLAP_LAST_ERROR
|
|
405
|
+
if error is None:
|
|
406
|
+
_CLAP_VERIFIED, _CLAP_LAST_ERROR = True, None
|
|
407
|
+
else:
|
|
408
|
+
_CLAP_VERIFIED, _CLAP_LAST_ERROR = False, f"{type(error).__name__}: {error}"
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def probe_audio_backend() -> Dict[str, Any]:
|
|
412
|
+
"""Run one real CLAP embedding on a second of silence.
|
|
413
|
+
|
|
414
|
+
Loads the model (the first call may download it), so it is never run by
|
|
415
|
+
``detect_embedding_capabilities``. The outcome lands in that report's
|
|
416
|
+
``audio.verified`` / ``audio.last_error``.
|
|
417
|
+
"""
|
|
418
|
+
caps = detect_embedding_capabilities()["audio"]
|
|
419
|
+
if not caps["available"]:
|
|
420
|
+
return {"success": False, "error": "No audio-embedding backend available"}
|
|
421
|
+
try:
|
|
422
|
+
import numpy as np
|
|
423
|
+
|
|
424
|
+
vectors, model = _clap_audio_vectors([np.zeros(CLAP_SAMPLE_RATE, dtype=np.float32)])
|
|
425
|
+
except Exception as exc: # noqa: BLE001
|
|
426
|
+
_clap_record(exc)
|
|
427
|
+
return {"success": False, "error": _CLAP_LAST_ERROR}
|
|
428
|
+
text = embed_text_for_audio_query("probe") # records its own outcome
|
|
429
|
+
if not text.get("success"):
|
|
430
|
+
return {"success": False, "error": text.get("error")}
|
|
431
|
+
_clap_record(None)
|
|
432
|
+
return {"success": True, "model": model, "dimensions": len(vectors[0])}
|
|
433
|
+
|
|
434
|
+
|
|
370
435
|
def _clap_audio_vectors(waveforms: List[Any]) -> Tuple[List[List[float]], str]:
|
|
371
436
|
backend, state = _clap_state()
|
|
372
437
|
if backend == "transformers_clap":
|
|
373
438
|
import torch
|
|
374
439
|
|
|
375
440
|
model, processor = state
|
|
376
|
-
inputs = processor
|
|
441
|
+
inputs = _clap_process_audio(processor, waveforms)
|
|
377
442
|
with torch.no_grad():
|
|
378
|
-
features = model.get_audio_features(**inputs)
|
|
443
|
+
features = _clap_embedding_tensor(model.get_audio_features(**inputs))
|
|
379
444
|
features = features / features.norm(dim=-1, keepdim=True)
|
|
380
445
|
return [[float(x) for x in row.tolist()] for row in features], f"transformers_clap:{CLAP_HF_MODEL}"
|
|
381
446
|
import numpy as np
|
|
@@ -419,7 +484,9 @@ def embed_audio_windows(file_path: str, windows: List[Tuple[float, float]]) -> D
|
|
|
419
484
|
try:
|
|
420
485
|
vectors, model = _clap_audio_vectors(waveforms)
|
|
421
486
|
except Exception as exc: # noqa: BLE001 — backend failures surface as data
|
|
487
|
+
_clap_record(exc)
|
|
422
488
|
return {"success": False, "error": f"{type(exc).__name__}: {exc}"}
|
|
489
|
+
_clap_record(None)
|
|
423
490
|
return {
|
|
424
491
|
"success": True,
|
|
425
492
|
"vectors": [vectors[slot] if slot is not None else None for slot in slots],
|
|
@@ -445,13 +512,16 @@ def embed_text_for_audio_query(text: str) -> Dict[str, Any]:
|
|
|
445
512
|
model, processor = state
|
|
446
513
|
inputs = processor(text=[str(text)], return_tensors="pt", padding=True)
|
|
447
514
|
with torch.no_grad():
|
|
448
|
-
features = model.get_text_features(**inputs)
|
|
515
|
+
features = _clap_embedding_tensor(model.get_text_features(**inputs))
|
|
449
516
|
features = features / features.norm(dim=-1, keepdim=True)
|
|
517
|
+
_clap_record(None)
|
|
450
518
|
return {"success": True, "vector": [float(x) for x in features[0].tolist()],
|
|
451
519
|
"model": f"transformers_clap:{CLAP_HF_MODEL}"}
|
|
452
520
|
vectors = state.get_text_embedding([str(text), ""], use_tensor=False)
|
|
521
|
+
_clap_record(None)
|
|
453
522
|
return {"success": True, "vector": [float(x) for x in vectors[0]], "model": "laion_clap:default"}
|
|
454
523
|
except Exception as exc: # noqa: BLE001
|
|
524
|
+
_clap_record(exc)
|
|
455
525
|
return {"success": False, "error": f"{type(exc).__name__}: {exc}"}
|
|
456
526
|
|
|
457
527
|
|