davinci-resolve-mcp 4.19.1 → 4.19.3
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 +13 -2
- package/src/utils/embeddings.py +46 -0
- package/src/utils/media_analysis.py +19 -0
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.3 — Timeline pin verifies the switch; audio-only media analyzes cleanly
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **A pinned timeline write can no longer land on the caller's timeline (#344).** The pin trusted the boolean `SetCurrentTimeline` returned, which can answer True and stay put. It now reads the current timeline back and returns `TIMELINE_PIN_FAILED` if the switch did not happen, restoring the caller's timeline first.
|
|
10
|
+
- **`media_analysis analyze_file` on audio-only media (#345).** A file with audio and no video stream no longer fails the clip because the vision layer produced no frames. Vision is reported as `not_applicable`, so the clip registers and `build_embeddings(kinds=['audio'])` has a clip to target.
|
|
11
|
+
|
|
12
|
+
### Not changed
|
|
13
|
+
|
|
14
|
+
- Covered by mocked unit tests only: not run against a live Resolve or a real audio file. `probe_audio_backend()` still has no tool action.
|
|
15
|
+
|
|
16
|
+
## What's New in v4.19.2 — Media analysis says whether CLAP audio embedding actually works
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- **`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.
|
|
21
|
+
- **`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.
|
|
22
|
+
|
|
23
|
+
### Not changed
|
|
24
|
+
|
|
25
|
+
- `audio.available` keeps its import-level meaning.
|
|
26
|
+
- 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.
|
|
27
|
+
|
|
5
28
|
## What's New in v4.19.1 — CLAP audio embeddings work on transformers 5.x
|
|
6
29
|
|
|
7
30
|
### Fixed
|
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.3 版 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.3"
|
|
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.3"
|
|
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
|
@@ -11,7 +11,7 @@ Usage:
|
|
|
11
11
|
python src/server.py --full # Start the 377-tool granular server instead
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
VERSION = "4.19.
|
|
14
|
+
VERSION = "4.19.3"
|
|
15
15
|
|
|
16
16
|
import base64
|
|
17
17
|
import os
|
|
@@ -1896,7 +1896,18 @@ class _CallScope:
|
|
|
1896
1896
|
if current is not None and current.GetUniqueId() == target.GetUniqueId():
|
|
1897
1897
|
self.pin = (proj, None, target)
|
|
1898
1898
|
return None
|
|
1899
|
-
|
|
1899
|
+
switched = proj.SetCurrentTimeline(target)
|
|
1900
|
+
# Verified by readback: SetCurrentTimeline can answer True and stay
|
|
1901
|
+
# put, which would land a "pinned" write on the caller's timeline.
|
|
1902
|
+
after = proj.GetCurrentTimeline() if switched else None
|
|
1903
|
+
if not switched or after is None or after.GetUniqueId() != target.GetUniqueId():
|
|
1904
|
+
if switched and current is not None:
|
|
1905
|
+
# Restore state the call may have half-changed.
|
|
1906
|
+
try:
|
|
1907
|
+
if not proj.SetCurrentTimeline(current):
|
|
1908
|
+
logger.warning("Could not restore the current timeline after a failed pin")
|
|
1909
|
+
except Exception:
|
|
1910
|
+
logger.warning("Could not restore the current timeline after a failed pin")
|
|
1900
1911
|
return _err(
|
|
1901
1912
|
f"Could not make timeline {target.GetName()!r} current to act on it",
|
|
1902
1913
|
code="TIMELINE_PIN_FAILED", category="resolve_api_failed",
|
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
|
}
|
|
@@ -391,6 +400,38 @@ def _clap_process_audio(processor: Any, waveforms: List[Any]) -> Any:
|
|
|
391
400
|
return processor(audios=waveforms, **kwargs)
|
|
392
401
|
|
|
393
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
|
+
|
|
394
435
|
def _clap_audio_vectors(waveforms: List[Any]) -> Tuple[List[List[float]], str]:
|
|
395
436
|
backend, state = _clap_state()
|
|
396
437
|
if backend == "transformers_clap":
|
|
@@ -443,7 +484,9 @@ def embed_audio_windows(file_path: str, windows: List[Tuple[float, float]]) -> D
|
|
|
443
484
|
try:
|
|
444
485
|
vectors, model = _clap_audio_vectors(waveforms)
|
|
445
486
|
except Exception as exc: # noqa: BLE001 — backend failures surface as data
|
|
487
|
+
_clap_record(exc)
|
|
446
488
|
return {"success": False, "error": f"{type(exc).__name__}: {exc}"}
|
|
489
|
+
_clap_record(None)
|
|
447
490
|
return {
|
|
448
491
|
"success": True,
|
|
449
492
|
"vectors": [vectors[slot] if slot is not None else None for slot in slots],
|
|
@@ -471,11 +514,14 @@ def embed_text_for_audio_query(text: str) -> Dict[str, Any]:
|
|
|
471
514
|
with torch.no_grad():
|
|
472
515
|
features = _clap_embedding_tensor(model.get_text_features(**inputs))
|
|
473
516
|
features = features / features.norm(dim=-1, keepdim=True)
|
|
517
|
+
_clap_record(None)
|
|
474
518
|
return {"success": True, "vector": [float(x) for x in features[0].tolist()],
|
|
475
519
|
"model": f"transformers_clap:{CLAP_HF_MODEL}"}
|
|
476
520
|
vectors = state.get_text_embedding([str(text), ""], use_tensor=False)
|
|
521
|
+
_clap_record(None)
|
|
477
522
|
return {"success": True, "vector": [float(x) for x in vectors[0]], "model": "laion_clap:default"}
|
|
478
523
|
except Exception as exc: # noqa: BLE001
|
|
524
|
+
_clap_record(exc)
|
|
479
525
|
return {"success": False, "error": f"{type(exc).__name__}: {exc}"}
|
|
480
526
|
|
|
481
527
|
|
|
@@ -2769,6 +2769,12 @@ def _ffprobe_summary(raw: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
2769
2769
|
}
|
|
2770
2770
|
|
|
2771
2771
|
|
|
2772
|
+
def _is_audio_only(technical: Dict[str, Any]) -> bool:
|
|
2773
|
+
"""True when ffprobe found audio stream(s) and no video stream."""
|
|
2774
|
+
summary = (technical or {}).get("summary") or {}
|
|
2775
|
+
return not (summary.get("video") or []) and bool(summary.get("audio") or [])
|
|
2776
|
+
|
|
2777
|
+
|
|
2772
2778
|
def _media_duration_seconds(record: Dict[str, Any], technical: Dict[str, Any]) -> Optional[float]:
|
|
2773
2779
|
summary = technical.get("summary") or {}
|
|
2774
2780
|
duration = ((summary.get("format") or {}).get("duration_seconds"))
|
|
@@ -5864,8 +5870,21 @@ async def execute_plan_async(
|
|
|
5864
5870
|
transcript = _transcribe(source, artifacts, options, caps)
|
|
5865
5871
|
vision = await _maybe_run_vision_analysis(record, motion, options, artifacts, caps, vision_runner)
|
|
5866
5872
|
vision_pending = vision_is_pending_host_analysis(vision)
|
|
5873
|
+
if (
|
|
5874
|
+
vision_requested(options)
|
|
5875
|
+
and not visual_analysis_completed(vision)
|
|
5876
|
+
and _is_audio_only(technical)
|
|
5877
|
+
):
|
|
5878
|
+
# No video stream means there is nothing to see: vision does not
|
|
5879
|
+
# apply, so its non-completion is not a clip failure.
|
|
5880
|
+
vision = {
|
|
5881
|
+
"success": True,
|
|
5882
|
+
"status": "not_applicable",
|
|
5883
|
+
"reason": "Audio-only media has no video stream.",
|
|
5884
|
+
}
|
|
5867
5885
|
vision_failed = (
|
|
5868
5886
|
vision_requested(options)
|
|
5887
|
+
and vision.get("status") != "not_applicable"
|
|
5869
5888
|
and not vision_pending
|
|
5870
5889
|
and not visual_analysis_completed(vision)
|
|
5871
5890
|
)
|