DaVinci Resolve API Issue: Managing Timeline Elements

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

SerhiiK

  • Posts: 4
  • Joined: Sat Mar 02, 2024 2:12 pm
  • Real Name: Serhii Kalinin

DaVinci Resolve API Issue: Managing Timeline Elements

PostSat Mar 02, 2024 2:14 pm

Hello everyone! I'm just starting to delve into scripting in DaVinci Resolve with Python and was initially amazed by the possibilities it opens up. However, the deeper I get, the more I encounter limitations and problems that prevent me from implementing my ideas. I've already spent a lot of time but haven't found a solution to my issues. Please help me figure this out.

One of the main problems I've faced is managing elements on the timeline. I need to move certain items along the timeline, but I don't understand how to do it properly. For instance, when I add two elements to the timeline, they are placed sequentially, one after the other. But I need one (a composition) to be on top of the other (a video), with both starting and ending simultaneously and having the same duration.

I've searched for solutions in the documentation, on YouTube, but haven't found a suitable answer. The only method that seems to work is editing the project's database through DB Browser for SQLite. Changes are applied after reloading the project, but this seems far from the best way.

I've also seen advice on using Python libraries to emulate mouse and keyboard actions to automate GUI interactions, but this seems to complicate the process and make it less reliable.

Therefore, I'm turning to experienced users: is it even possible to flexibly manage the placement and duration of clips on the timeline using the DaVinci Resolve API, perhaps through some hidden or undocumented functions? I would be grateful for any help and advice.
Offline

philipbowser

  • Posts: 267
  • Joined: Tue Oct 14, 2014 11:53 pm

Re: DaVinci Resolve API Issue: Managing Timeline Elements

PostMon Mar 11, 2024 3:56 pm

Hey Serhii,

I'm not an expert, but I may have enough info to help you out.

Unfortunately, you cannot "move" items on a timeline with the scripting API. However, you can add items to a timeline on any track, at any timecode, and for any duration, so you may not need to move clips to begin with.

The relevant method is:
Code: Select all
MediaPool.AppendToTimeline([{clipInfo}, ...])


You can read more about what "clipInfo" is in the documentation, but the basics are you need a dict / table of: mediaPoolItem, startFrame, endFrame, mediaType, trackIndex, and recordFrame.

If however you do need to "move" clips that are already on a timeline, the only way is to delete the old clip and append a new, identical clip to a different position using the above method. The downsides to this are that you cannot retain any clip effects as you'll be deleting the clip and the scripting API doesn't yet support reading or writing clip effects or keyframing any of the clip properties.

Return to Software Developers

Who is online

Users browsing this forum: SetupSucks and 11 guests