← All DaVinci Resolve API guides
DaVinci Resolve APIAdvancedRender

How to Apply V1 Source Resolution to Project and Render Settings

Use GetMediaPoolItem, GetClipProperty, SetSetting, and ResolutionWidth/ResolutionHeight

Detect the largest source resolution represented by clips on V1 and apply that width and height to project and render settings as part of an automated export-preparation step.

API

Resolve Scripting API

Language

Python

Resolve

19–20+

Requires

Running Resolve

Syntax

project.SetSetting("timelineResolutionWidth", width)
project.SetRenderSettings({"ResolutionWidth": width})

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

import re


def parse_resolution(value) -> tuple[int, int] | None:
    if value is None:
        return None
    match = re.search(r"(\\d{3,5})\\s*[xX×]\\s*(\\d{3,5})", str(value))
    if not match:
        return None
    width, height = int(match.group(1)), int(match.group(2))
    if width < 320 or height < 240:
        return None
    return width, height


def clip_resolution_from_media_pool_item(media_pool_item) -> tuple[int, int] | None:
    if not media_pool_item:
        return None
    for key in ("Resolution", "Video Resolution", "Frame Resolution", "Image Resolution", "Format"):
        parsed = parse_resolution(safe_call(media_pool_item, "GetClipProperty", key))
        if parsed:
            return parsed
    props = safe_call(media_pool_item, "GetClipProperty") or {}
    if isinstance(props, dict):
        for value in props.values():
            parsed = parse_resolution(value)
            if parsed:
                return parsed
    return None


def detect_v1_source_resolution(timeline) -> tuple[int, int] | None:
    candidates = []
    for item in safe_call(timeline, "GetItemListInTrack", "video", 1) or []:
        media_pool_item = safe_call(item, "GetMediaPoolItem")
        resolution = clip_resolution_from_media_pool_item(media_pool_item)
        if resolution:
            candidates.append(resolution)
    return max(candidates, key=lambda item: item[0] * item[1]) if candidates else None


def apply_project_resolution_from_v1(project, timeline) -> dict:
    detected = detect_v1_source_resolution(timeline)
    if not detected:
        return {"applied": False, "reason": "resolution_not_detected"}

    width, height = detected
    applied_width = safe_call(project, "SetSetting", "timelineResolutionWidth", str(width))
    applied_height = safe_call(project, "SetSetting", "timelineResolutionHeight", str(height))
    render_applied = safe_call(project, "SetRenderSettings", {"ResolutionWidth": width, "ResolutionHeight": height})

    return {"applied": bool(applied_width or applied_height or render_applied), "width": width, "height": height}


resolve, project, timeline = get_project_and_timeline()
print(apply_project_resolution_from_v1(project, timeline))

Guide

What the example does

The script walks V1, obtains each TimelineItem’s MediaPoolItem, and reads clip properties. It selects the largest detected resolution by pixel area, then attempts to apply the resulting width and height to both project settings and Render Settings.

Why V1 is used as the reference

V1 is commonly the base picture track, while upper tracks may contain overlays, titles, or occasional cutaways. In that workflow, V1 is a reasonable technical source for estimating the project’s primary picture resolution.

What happens when no resolution can be read

Resolve does not expose identical clip-property keys in every environment. The helper checks several likely fields and can inspect property values, but if no reliable dimensions are found the safer behavior is to leave the project unchanged.

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 apply v1 source resolution to project and render settings.

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

  • SetSetting() can reject a value in some project configurations.
  • Source resolution is not automatically the correct final master resolution.
  • Verify the resulting Deliver-page configuration before batch use.
  • Vertical-video workflows may need orientation-aware resolution rules rather than a simple largest-area policy.

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