← All DaVinci Resolve API guides
DaVinci Resolve APIIntermediateRender

How to Set an In/Out Render Range with the DaVinci Resolve Python API

Convert frames to timecode, call SetInOutPoints, and switch the Deliver page to In/Out Range

Turn a frame-based interval into Timeline timecodes, set In and Out points, and configure Resolve to render only that selected range.

API

Resolve Scripting API

Language

Python

Resolve

19–20+

Requires

Running Resolve

Syntax

timeline.SetInOutPoints(start_tc, end_tc)
project.SetRenderRange("In/Out Range")

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
import time
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 = safe_call(resolve, "GetProjectManager")
    project = safe_call(project_manager, "GetCurrentProject") if project_manager else None
    if not project:
        raise RuntimeError("No DaVinci Resolve project is open")

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

    return resolve, project, timeline


FALLBACK_FPS = 24.0


def frames_to_tc(frame: int, fps: float):
    fps_i = int(round(fps)) or int(FALLBACK_FPS)
    f = int(frame)
    hh = f // (fps_i * 3600)
    f %= fps_i * 3600
    mm = f // (fps_i * 60)
    f %= fps_i * 60
    ss = f // fps_i
    ff = f % fps_i
    return f"{hh:02d}:{mm:02d}:{ss:02d}:{ff:02d}"


def set_render_range_by_frames(project, timeline, start_frame: int, end_frame: int):
    if end_frame <= start_frame:
        raise ValueError("end_frame must be greater than start_frame")

    try:
        fps = float(safe_call(project, "GetSetting", "timelineFrameRate") or FALLBACK_FPS)
    except Exception:
        fps = FALLBACK_FPS

    start_tc = frames_to_tc(start_frame, fps)
    end_tc = frames_to_tc(end_frame, fps)

    if not safe_call(timeline, "SetInOutPoints", start_tc, end_tc):
        raise RuntimeError("Timeline did not accept the In/Out points")

    safe_call(project, "SetRenderRange", "In/Out Range")
    return start_tc, end_tc


resolve, project, timeline = get_project_and_timeline()
start_tc, end_tc = set_render_range_by_frames(project, timeline, 0, 240)
print("Render range:", start_tc, end_tc)

Guide

What the example does

The helper reads the Timeline frame rate, converts start and end frame numbers into timecodes, sets Timeline In/Out points, and tells the project to render the In/Out Range.

Why a timecode conversion is required

Resolve SetInOutPoints expects timecode values rather than raw frame numbers. Frame-driven automation therefore needs a frames-to-timecode helper that uses the same frame rate as the Timeline.

How to return to an Entire Timeline render

For a later full export, call timeline.ClearInOutPoints() and switch project.SetRenderRange() back to Entire Timeline. Do this explicitly so an old partial range cannot silently affect the next Render Job.

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 set an in/out render range 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

  • end_frame must be greater than start_frame.
  • Use the Timeline frame rate; a mismatched FPS value shifts the converted range.
  • Clear In/Out points before a later Entire Timeline export.
  • Projects with non-zero start timecode can require base-frame handling when frame values are absolute rather than Timeline-relative.

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