← All DaVinci Resolve API guides
DaVinci Resolve APIIntermediateTimeline

How to Read the Timeline Start Timecode with the DaVinci Resolve Python API

Read timelineStartTimecode, fall back to GetStartTimecode, and convert the result to frames

Read the active Timeline start timecode from settings, use GetStartTimecode as a fallback, and convert HH:MM:SS:FF into a frame-based value for external synchronization.

API

Resolve Scripting API

Language

Python

Resolve

19–20+

Requires

Running Resolve

Syntax

start_tc = timeline.GetStartTimecode()

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.

Complete working Python exampleuse it as a starting point for your own script
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, **kwargs):
    try:
        fn = getattr(obj, name, None)
        if callable(fn):
            return fn(*args, **kwargs)
    except Exception:
        return None
    return None


def get_project_and_timeline():
    dvr = import_resolve_module()
    resolve = dvr.scriptapp("Resolve")
    if not resolve:
        raise RuntimeError("DaVinci Resolve API is unavailable")

    project_manager = resolve.GetProjectManager()
    project = project_manager.GetCurrentProject() if project_manager else None
    if not project:
        raise RuntimeError("No DaVinci Resolve project is open")

    timeline = project.GetCurrentTimeline()
    if not timeline:
        raise RuntimeError("No active Timeline")

    return resolve, project, timeline


def parse_tc_to_frames(tc: str, fps: float) -> int:
    try:
        hh, mm, ss, ff = [int(part) for part in str(tc).split(":")]
    except Exception:
        return 0
    return int(round(((hh * 3600) + (mm * 60) + ss) * fps + ff))


def get_timeline_fps(project, timeline) -> float:
    value = safe_call(timeline, "GetSetting", "timelineFrameRate")
    if value is None:
        value = safe_call(project, "GetSetting", "timelineFrameRate")
    try:
        return float(value)
    except Exception:
        return 24.0


def detect_timeline_start_frames(project, timeline) -> int:
    fps = get_timeline_fps(project, timeline)
    timecode = safe_call(timeline, "GetSetting", "timelineStartTimecode") or ""
    if not timecode:
        timecode = safe_call(timeline, "GetStartTimecode") or ""
    return parse_tc_to_frames(timecode, fps) if timecode else 0


resolve, project, timeline = get_project_and_timeline()
print("Timeline start frame from timecode:", detect_timeline_start_frames(project, timeline))

Guide

What the example does

The script reads Timeline FPS, then checks the timelineStartTimecode setting and falls back to GetStartTimecode() when necessary. The resulting HH:MM:SS:FF string is converted into a frame count so later calculations can stay numeric.

Why start timecode is useful

Some integrations care about the Timeline base frame, while others need the exact timecode shown in the Resolve interface. External subtitles, logs, conform data, and interchange files often use timecode, so preserving that reference prevents silent offsets.

Where to use the converted value

The frame value can be used when exporting Timeline maps, aligning titles, computing render ranges, or comparing Resolve positions with data generated by another application or service.

How the example works

1

Connect to Resolve

Establish a Resolve Scripting API connection and stop early if the application object is unavailable.

2

Validate the current context

Check the active project, Timeline, Media Pool, source paths, or Render Queue state required by this specific operation.

3

Run the core API operation

Execute the operation demonstrated in this guide: how to read the timeline start timecode with the davinci resolve python api.

4

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

  • The example expects HH:MM:SS:FF.
  • Drop-frame projects may require dedicated parsing rules.
  • Use the active Timeline FPS rather than an unrelated constant.
  • If no valid start timecode is available, the helper safely returns 0.

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