Created
March 8, 2023 21:22
-
-
Save DanielBaulig/3b95897e705d664ca8c597316527c5ab to your computer and use it in GitHub Desktop.
Davinci Resolve Script to calculate the total duration of all clips on a track, filterable by clip color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configuration | |
# Track to be used to calculate duration | |
videoTrack = 1 | |
# Clip color to filter for; empty is default | |
filterColor = "" | |
# Frames per second used | |
fps = 60 | |
from datetime import timedelta | |
manager = resolve.GetProjectManager() | |
manager.SaveProject() | |
project = manager.GetCurrentProject() | |
timeline = project.GetCurrentTimeline() | |
timelineItems = timeline.GetItemListInTrack('Video', 1) | |
totalDurationFrames = 0 | |
for item in timelineItems: | |
totalDurationFrames += item.GetDuration() if item.GetClipColor() == filterColor else 0 | |
totalDurationTimeDelta = timedelta(seconds=totalDurationFrames/fps) | |
print("Total Duration (frames):", totalDurationFrames) | |
print("Total Duration:", totalDurationTimeDelta) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment