How to Move the Playhead in DaVinci Resolve with the Python API
SetCurrentTimecode, SetCurrentFrame, and a defensive helper for jumping to an exact Timeline frame
Move the Resolve playhead to a known frame by trying SetCurrentTimecode first and falling back to SetCurrentFrame when that method is available in the current scripting build.
API
Resolve Scripting API
Language
Python
Resolve
19–20+
Requires
Running Resolve
Syntax
timeline.SetCurrentTimecode(frames_to_tc(frame, fps))Parameters
- • The relevant arguments are shown in the complete working example below. Validate paths, object types, and required project state before calling the API method.
Returns
Always validate the returned object, list, identifier, or boolean before continuing to the next automation step.
import os
import sys
from pathlib import Path
def import_resolve_module():
try:
import DaVinciResolveScript as dvr
return dvr
except ImportError:
search_paths = [
os.environ.get("RESOLVE_SCRIPT_API", ""),
os.environ.get("RESOLVE_MODULES", ""),
r"C:\\ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting\\Modules",
"/opt/resolve/Developer/Scripting/Modules",
"/opt/BlackmagicDesign/DaVinciResolve/Developer/Scripting/Modules",
"/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules",
str(Path.home() / "Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules"),
]
for path in search_paths:
if path and os.path.isdir(path) and path not in sys.path:
sys.path.append(path)
import DaVinciResolveScript as dvr
return dvr
def safe_call(obj, name, *args):
try:
fn = getattr(obj, name, None)
if callable(fn):
return fn(*args)
except Exception:
return None
return None
dvr = import_resolve_module()
resolve = dvr.scriptapp("Resolve")
if not resolve:
raise RuntimeError("DaVinci Resolve API is unavailable")
project = resolve.GetProjectManager().GetCurrentProject()
if not project:
raise RuntimeError("No DaVinci Resolve project is open")
timeline = project.GetCurrentTimeline()
if not timeline:
raise RuntimeError("No active Timeline")
def frames_to_tc(frame: int, fps: float) -> str:
fps_i = max(1, int(round(fps)))
total = int(round(frame))
ff = total % fps_i
seconds = total // fps_i
hh = seconds // 3600
mm = (seconds % 3600) // 60
ss = seconds % 60
return f"{hh:02d}:{mm:02d}:{ss:02d}:{ff:02d}"
def set_playhead(timeline, frame: int, fps: float) -> bool:
tc = frames_to_tc(frame, fps)
fn_tc = getattr(timeline, "SetCurrentTimecode", None)
if callable(fn_tc):
try:
if fn_tc(tc):
return True
except Exception:
pass
fn_frame = getattr(timeline, "SetCurrentFrame", None)
if callable(fn_frame):
try:
return bool(fn_frame(int(frame)))
except Exception:
pass
return False
fps = float(timeline.GetSetting("timelineFrameRate") or project.GetSetting("timelineFrameRate") or 24.0)
frame = 240
if not set_playhead(timeline, frame, fps):
raise RuntimeError("Could not move the playhead")
print("Playhead moved to", frames_to_tc(frame, fps))Guide
How the jump works
The primary path uses SetCurrentTimecode(). Because it accepts a timecode string, the target frame is first converted to HH:MM:SS:FF. If that call is unavailable or fails, the helper tries SetCurrentFrame() when the installed Resolve version exposes it.
Why the helper tries two methods
Resolve scripting behavior can differ across releases and platforms. A production-oriented helper should not assume one method is always present. Returning an explicit True or False also lets later automation stop instead of continuing from the wrong Timeline position.
Where this is useful
Moving the playhead is valuable before targeted Timeline checks, screenshots, manual validation, and workflows where an external process identifies an exact frame that an editor should inspect. The example itself does not cut, trim, or otherwise alter clips.
How the example works
Connect to Resolve
Establish a Resolve Scripting API connection and stop early if the application object is unavailable.
Validate the current context
Check the active project, Timeline, Media Pool, source paths, or Render Queue state required by this specific operation.
Run the core API operation
Execute the operation demonstrated in this guide: how to move the playhead in davinci resolve with the python api.
Validate the result
Check the returned value before the workflow continues. Resolve methods often signal an unavailable object or failed operation with None, False, or an empty result.
Resolve API notes
- SetCurrentTimecode expects a timecode string, not a raw frame number.
- SetCurrentFrame is not available in every Resolve scripting version.
- Use the active Timeline FPS or the converted position can drift.
- The operation changes the current UI playhead position but does not modify clip content.
Common errors
Resolve API is unavailable
Reason: Resolve is closed or Python cannot import/use DaVinciResolveScript.
Fix: Start Resolve and verify the Developer/Scripting/Modules path from the same Python interpreter used by the script.
The method returns None or False
Reason: A required project, Timeline, clip, preset, path, or application state is missing.
Fix: Validate each input and add explicit result checks after important Resolve API calls.
The script only works on one workstation
Reason: Paths or environment assumptions are hard-coded for a single operating system or machine.
Fix: Move paths into configuration and support the required Windows, Linux, and macOS locations explicitly.
Next step
Continue only after the current operation has returned the expected Resolve object or result.
Related API guides
Timeline
How to Convert Frames to Timecode for DaVinci Resolve in Python
Convert a Timeline frame number into HH:MM:SS:FF timecode before moving the playhead, setting In/Out points, or calling Resolve methods that expect timecode instead of seconds.
Timeline
How to Convert DaVinci Resolve Timecode to Frames in Python
Use a small parse_tc_to_frames() helper to convert Resolve timecode into a frame number so ranges, durations, offsets, and external Timeline data can be compared in one coordinate system.
Timeline
How to Get Timeline FPS with the DaVinci Resolve Python API
Read the active Timeline frame rate, convert string settings safely to float, and use project settings as a fallback when the Timeline does not expose a value.

