How to Set a Render Range from V1 Clips with the DaVinci Resolve API
Use GetItemListInTrack, SetInOutPoints, and SetRenderRange to render only the active V1 edit
Find the combined frame range occupied by clips on video track V1, convert that range to timecode, set Timeline In/Out points, and switch the Deliver page to In/Out 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.
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 get_v1_range_frames(timeline):
items = safe_call(timeline, "GetItemListInTrack", "video", 1) or []
starts = []
ends = []
for item in items:
try:
starts.append(int(item.GetStart()))
ends.append(int(item.GetEnd()))
except Exception:
props = safe_call(item, "GetProperty") or {}
if isinstance(props, dict):
starts.append(int(props.get("Start", 0)))
ends.append(int(props.get("End", 0)))
if not starts or not ends:
return 0, 0
return min(starts), max(ends)
fps = float(timeline.GetSetting("timelineFrameRate") or project.GetSetting("timelineFrameRate") or 24.0)
start_frame, end_frame = get_v1_range_frames(timeline)
if end_frame <= start_frame:
raise RuntimeError("No usable clip range was found on V1")
start_tc = frames_to_tc(start_frame, fps)
end_tc = frames_to_tc(end_frame, fps)
if not timeline.SetInOutPoints(start_tc, end_tc):
raise RuntimeError("Could not set Timeline In/Out points")
project.SetRenderRange("In/Out Range")
print("Render range:", start_tc, "—", end_tc)Guide
How the V1 range is calculated
The script reads every item on video track 1, obtains each item’s start and end frame, then takes the minimum start and maximum end. Those two values describe the overall occupied range of V1.
Why In/Out points are useful
A Timeline can be longer than the actual edit. Rendering Entire Timeline may therefore include empty frames before or after the program. In/Out Range limits the export to the region where the selected track actually contains clips.
Where this pattern fits
This approach is useful when V1 is the primary assembled program track and its clip boundaries define the intended export. It is a technical range calculation based on Timeline objects, not an editorial decision about which shots should remain.
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 set a render range from v1 clips with the davinci resolve 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
- The example intentionally uses V1: video track 1.
- If V1 contains no clips, no useful range can be calculated.
- SetInOutPoints() expects timecode values, so frame numbers are converted before the call.
- After setting the points, the project Render Range is switched to In/Out Range.
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 Iterate Timeline Clips with the DaVinci Resolve Python API
Walk every video and audio track on the active Timeline, inspect TimelineItem objects, and print the name, start frame, and end frame for each clip.
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.
Render
How to Start a DaVinci Resolve Render with the Python API
Drive the Render Queue from Python: load a preset, set the output directory and filename, add a render job, start the newly created job, and wait until Resolve finishes rendering.

