How to Detect Source Resolution on V1 with the DaVinci Resolve API
Read MediaPoolItem clip properties and find the largest source resolution on the primary video track
Walk the clips on V1, resolve each TimelineItem back to its MediaPoolItem, read source properties, and determine a representative maximum resolution for project or render setup.
API
Resolve Scripting API
Language
Python
Resolve
19–20+
Requires
Running Resolve
Syntax
props = item.GetMediaPoolItem().GetClipProperty()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")
import re
def parse_resolution_value(value):
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 = int(match.group(1))
height = 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):
if not media_pool_item:
return None
keys = ["Resolution", "Video Resolution", "Frame Resolution", "Image Resolution", "Format"]
for key in keys:
resolution = parse_resolution_value(safe_call(media_pool_item, "GetClipProperty", key))
if resolution:
return resolution
props = safe_call(media_pool_item, "GetClipProperty") or {}
if isinstance(props, dict):
for value in props.values():
resolution = parse_resolution_value(value)
if resolution:
return resolution
return None
def detect_v1_source_resolution(timeline):
items = safe_call(timeline, "GetItemListInTrack", "video", 1) or []
candidates = []
for item in items:
media_pool_item = safe_call(item, "GetMediaPoolItem")
resolution = clip_resolution_from_media_pool_item(media_pool_item)
if resolution:
candidates.append(resolution)
if not candidates:
return None
return max(candidates, key=lambda size: size[0] * size[1])
resolution = detect_v1_source_resolution(timeline)
if resolution:
width, height = resolution
project.SetRenderSettings({"ResolutionWidth": width, "ResolutionHeight": height})
print("V1 source resolution:", width, "x", height)
else:
print("Could not detect the resolution of V1 clips")Guide
What the script reads
TimelineItem does not always expose every source-media property directly. The example therefore obtains the linked MediaPoolItem and reads its Clip Property dictionary. Because Resolve versions may label resolution fields differently, the helper checks several common keys.
Why the largest resolution is selected
If V1 mixes 1080p and 4K sources, using the largest detected source size is a useful technical signal when preparing an automated master export. It helps prevent an automation script from silently choosing a lower frame size than the source workflow expects.
Where to use the result
The detected width and height can feed SetRenderSettings() or project resolution settings. Treat the value as an input to your export policy, not as a universal rule: the desired master resolution can still differ from the source resolution.
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 detect source resolution on v1 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
- GetClipProperty key names can vary between Resolve versions.
- If no resolution can be read, the script should avoid changing project or render settings.
- ResolutionWidth and ResolutionHeight support can depend on the current render configuration.
- The scan uses V1 because it is a common primary video track in editing workflows.
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
Render
How to Set a Render Range from V1 Clips with the DaVinci Resolve API
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.
Render
How to Configure MOV H.265 Render Settings with the DaVinci Resolve API
Configure a practical MOV + H.265/HEVC export from Python, including output directory, base file name, video and audio settings, bitrate, and codec-name fallbacks for different Resolve environments.
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.

