davinci-resolve-mcp 4.7.9 → 4.7.10

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 CHANGED
@@ -2,6 +2,30 @@
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.7.10 — drop-frame sync events are reported at the timecode they happen
6
+
7
+ ### Fixed
8
+
9
+ - **A sync event on a drop-frame clip was reported 3.6 seconds per hour early, and
10
+ rendered as non-drop.** ([#248](https://github.com/samuelgursky/davinci-resolve-mcp/pull/248), @Dev-next-gen)
11
+ `_timecode_for_event` reports an event at `start_timecode + offset`, where the start
12
+ timecode comes from the media's own timecode track via ffprobe and on an NTSC
13
+ deliverable is routinely drop-frame (`HH:MM:SS;FF`). `timecode_to_frames` honours
14
+ drop-frame (`01:00:00;00` at 29.97 is frame 107892), but the detector's private
15
+ `_frames_to_timecode` had no drop-frame arithmetic, so the frame numbers subtracted
16
+ on the way in were never added back: the head of a drop-frame clip came back as
17
+ `00:59:56:12`. That value is appended to the marker note written into the Resolve
18
+ project — the thing someone reads to line two cameras up off a 2-pop. The inverse
19
+ now lives next to the forward conversion in `src/utils/multicam.py` as
20
+ `frames_to_timecode`, so the pair cannot drift apart again, and `sync_detection`
21
+ carries the drop-frame spelling of the start timecode through to it. Non-drop
22
+ timecode is deliberately unchanged (29.97 colon timecode legitimately lags the wall
23
+ clock), and a semicolon at 23.976 still drops nothing because drop-frame is only
24
+ defined at nominal 30 and 60. Verified on landing by brute force against the forward
25
+ conversion: two hours at 29.97 (216,000 frames) and 59.94 (432,000 frames), zero
26
+ round-trip violations, every timecode unique, dropped numbers never at the top of a
27
+ non-tenth minute. Guard test: `tests/test_sync_event_timecode.py`.
28
+
5
29
  ## What's New in v4.7.9 — a negative still, album or item index is refused
6
30
 
7
31
  ### Fixed
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  English | [简体中文](README.zh-CN.md)
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.7.9-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-4.7.10-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
6
6
  [![npm](https://img.shields.io/npm/v/davinci-resolve-mcp.svg?label=npm&color=CB3837)](https://www.npmjs.com/package/davinci-resolve-mcp)
7
7
  [![API Coverage](https://img.shields.io/badge/API%20Coverage-100%25-brightgreen.svg)](docs/reference/api-coverage.md)
8
8
  [![Tools](https://img.shields.io/badge/MCP%20Tools-37%20(389%20full)-blue.svg)](#server-modes)
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | 简体中文
4
4
 
5
- [![Version](https://img.shields.io/badge/version-4.7.9-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
5
+ [![Version](https://img.shields.io/badge/version-4.7.10-blue.svg)](https://github.com/samuelgursky/davinci-resolve-mcp/releases)
6
6
  [![npm](https://img.shields.io/npm/v/davinci-resolve-mcp.svg?label=npm&color=CB3837)](https://www.npmjs.com/package/davinci-resolve-mcp)
7
7
  [![API Coverage](https://img.shields.io/badge/API%20Coverage-100%25-brightgreen.svg)](docs/reference/api-coverage.md)
8
8
  [![Tools](https://img.shields.io/badge/MCP%20Tools-37%20(389%20full)-blue.svg)](#服务器模式)
@@ -12,7 +12,7 @@
12
12
  [![Python](https://img.shields.io/badge/python-3.10+-green.svg)](https://www.python.org/downloads/)
13
13
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
14
14
 
15
- > 本翻译对应 v4.7.9 版 README。如与英文原版有出入,以 [英文原版](README.md) 为准。
15
+ > 本翻译对应 v4.7.10 版 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.7.9"
40
+ VERSION = "4.7.10"
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "davinci-resolve-mcp",
3
- "version": "4.7.9",
3
+ "version": "4.7.10",
4
4
  "description": "NPM bootstrapper for the DaVinci Resolve MCP Server.",
5
5
  "license": "MIT",
6
6
  "author": "Samuel Gursky <samgursky@gmail.com>",
@@ -93,7 +93,7 @@ if not logging.getLogger().handlers:
93
93
  handlers=[logging.StreamHandler()],
94
94
  )
95
95
 
96
- VERSION = "4.7.9"
96
+ VERSION = "4.7.10"
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.7.9"
14
+ VERSION = "4.7.10"
15
15
 
16
16
  import base64
17
17
  import os
@@ -99,6 +99,55 @@ def timecode_to_frames(timecode: Any, fps: Any, *, drop_frame: Optional[bool] =
99
99
  return total
100
100
 
101
101
 
102
+ def frames_to_timecode(frame: Any, fps: Any, *, drop_frame: bool = False) -> Optional[str]:
103
+ """Convert a frame count back to HH:MM:SS:FF timecode.
104
+
105
+ The exact inverse of `timecode_to_frames`, and it lives next to it so the
106
+ pair cannot drift apart: a frames->timecode helper written on its own
107
+ reliably forgets that drop-frame dropped frame NUMBERS on the way in, and
108
+ then reports a timecode 3.6 seconds early per hour.
109
+
110
+ `drop_frame` renders drop-frame timecode (semicolon separator) at the two
111
+ nominal rates where it is defined, 30 and 60; at any other rate it is
112
+ ignored, exactly as `timecode_to_frames` ignores a semicolon there.
113
+ """
114
+ rate = parse_frame_rate(fps)
115
+ if rate is None:
116
+ return None
117
+ try:
118
+ frame = max(0, int(frame))
119
+ except (TypeError, ValueError):
120
+ return None
121
+ nominal = _nominal_timecode_rate(rate)
122
+ if nominal <= 0:
123
+ return None
124
+
125
+ if drop_frame and nominal in (30, 60):
126
+ # Two (30) or four (60) frame numbers are skipped at the top of every
127
+ # minute except every tenth, so a ten-minute block holds one full
128
+ # minute and nine short ones.
129
+ drop = 2 if nominal == 30 else 4
130
+ per_minute = nominal * 60 - drop
131
+ per_ten = per_minute * 10 + drop
132
+ tens, rem = divmod(frame, per_ten)
133
+ if rem < nominal * 60:
134
+ minutes = tens * 10
135
+ frame_in_minute = rem
136
+ else:
137
+ rem -= nominal * 60
138
+ extra_minutes, frame_in_minute = divmod(rem, per_minute)
139
+ minutes = tens * 10 + 1 + extra_minutes
140
+ frame_in_minute += drop
141
+ hours, minutes = divmod(minutes, 60)
142
+ seconds, frames = divmod(frame_in_minute, nominal)
143
+ return f"{hours:02d}:{minutes:02d}:{seconds:02d};{frames:02d}"
144
+
145
+ hours, remainder = divmod(frame, nominal * 3600)
146
+ minutes, remainder = divmod(remainder, nominal * 60)
147
+ seconds, frames = divmod(remainder, nominal)
148
+ return f"{hours:02d}:{minutes:02d}:{seconds:02d}:{frames:02d}"
149
+
150
+
102
151
  def _get_clip_property_map(clip: Any) -> Dict[str, Any]:
103
152
  try:
104
153
  props = clip.GetClipProperty()
@@ -16,7 +16,7 @@ from array import array
16
16
  from pathlib import Path
17
17
  from typing import Any, Dict, Iterable, List, Optional, Sequence, Tuple
18
18
 
19
- from src.utils.multicam import timecode_to_frames
19
+ from src.utils.multicam import frames_to_timecode, timecode_to_frames
20
20
 
21
21
 
22
22
  SYNC_EVENT_TYPES = ("two_pop", "slate_clap")
@@ -237,38 +237,25 @@ def _probe_media(path: str, ffprobe_path: str, timeout: int) -> Dict[str, Any]:
237
237
  }
238
238
 
239
239
 
240
- def _nominal_timecode_rate(fps: float) -> int:
241
- if abs(fps - 23.976) < 0.02:
242
- return 24
243
- if abs(fps - 29.97) < 0.02:
244
- return 30
245
- if abs(fps - 47.952) < 0.05:
246
- return 48
247
- if abs(fps - 59.94) < 0.05:
248
- return 60
249
- return int(round(fps))
250
-
251
-
252
- def _frames_to_timecode(frame: int, fps: float) -> Optional[str]:
253
- if fps <= 0:
254
- return None
255
- nominal = _nominal_timecode_rate(fps)
256
- if nominal <= 0:
257
- return None
258
- frame = max(0, int(frame))
259
- hours, remainder = divmod(frame, nominal * 3600)
260
- minutes, remainder = divmod(remainder, nominal * 60)
261
- seconds, frames = divmod(remainder, nominal)
262
- return f"{hours:02d}:{minutes:02d}:{seconds:02d}:{frames:02d}"
263
-
264
-
265
240
  def _timecode_for_event(time_seconds: float, fps: Optional[float], start_timecode: Optional[str]) -> Optional[str]:
241
+ """Timecode of an event `time_seconds` into a clip whose head is `start_timecode`.
242
+
243
+ The start timecode comes from the media's own timecode track, via ffprobe,
244
+ so on an NTSC deliverable it is routinely DROP-FRAME (`HH:MM:SS;FF`).
245
+ `timecode_to_frames` subtracts the dropped frame numbers on the way in, so
246
+ the way back out has to add them again — carry the drop-frame spelling
247
+ through rather than rendering the result as non-drop.
248
+ """
266
249
  if not fps or not start_timecode:
267
250
  return None
268
251
  start_frame = timecode_to_frames(start_timecode, fps)
269
252
  if start_frame is None:
270
253
  return None
271
- return _frames_to_timecode(start_frame + int(round(time_seconds * fps)), fps)
254
+ return frames_to_timecode(
255
+ start_frame + int(round(time_seconds * fps)),
256
+ fps,
257
+ drop_frame=";" in str(start_timecode),
258
+ )
272
259
 
273
260
 
274
261
  def _event_marker_color(event_type: str, params: Dict[str, Any]) -> str: