← All DaVinci Resolve API guides
DaVinci Resolve APIIntermediateTimeline

How to Build a Timeline Clip Map with the DaVinci Resolve API

Combine GetTrackCount, GetItemListInTrack, GetStart, GetEnd, and MediaPoolItem source data

Build a technical map of the active Timeline containing media type, track number, clip name, start, end, duration, and source file path when a linked MediaPoolItem is available.

API

Resolve Scripting API

Language

Python

Resolve

19–20+

Requires

Running Resolve

Syntax

items = timeline.GetItemListInTrack("video", 1)

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 item_name(item) -> str:
    return safe_call(item, "GetName") or "Untitled"


def item_track_info(media_type: str, track_index: int) -> str:
    prefix = "V" if media_type == "video" else "A"
    return f"{prefix}{track_index}"


def collect_timeline_clips(project, timeline) -> list[dict]:
    result = []
    for media_type in ("video", "audio"):
        track_count = int(safe_call(timeline, "GetTrackCount", media_type) or 0)
        for track_index in range(1, track_count + 1):
            items = safe_call(timeline, "GetItemListInTrack", media_type, track_index) or []
            for item in items:
                media_pool_item = safe_call(item, "GetMediaPoolItem")
                props = safe_call(media_pool_item, "GetClipProperty") or {}
                result.append({
                    "name": item_name(item),
                    "media_type": media_type,
                    "track": item_track_info(media_type, track_index),
                    "start": int(safe_call(item, "GetStart") or 0),
                    "end": int(safe_call(item, "GetEnd") or 0),
                    "duration": int(safe_call(item, "GetDuration") or 0),
                    "file_path": props.get("File Path") or props.get("FilePath") or "",
                })
    return result


resolve, project, timeline = get_project_and_timeline()
clips = collect_timeline_clips(project, timeline)
print("Clips found:", len(clips))
for clip in clips[:10]:
    print(clip)

Guide

What the example collects

The script iterates every video and audio track, reads each TimelineItem, and stores core technical fields. When an item is linked to a MediaPoolItem, the helper also reads File Path from the source clip properties.

Why a Timeline map is useful

A normalized clip map is the foundation for many serious integrations: render-range generation, validation reports, automated cleanup, duration checks, external synchronization, and reproducible debugging.

How to extend the map

Depending on the Resolve version and the production task, the result can be expanded with clip color, markers, compositing metadata, source properties, or audio information. Keep the basic schema stable and add optional fields only when they serve a concrete workflow.

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 build a timeline clip map with the davinci resolve 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

  • GetItemListInTrack returns items for one specific track.
  • Source file paths come from MediaPoolItem properties rather than directly from TimelineItem.
  • Generators, Fusion compositions, and some synthetic items may not have a normal File Path.
  • Interpret exported frame positions together with the Timeline start frame/timecode when absolute coordinates matter.

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