Undocumented Resolve API functions

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Undocumented Resolve API functions

PostWed May 06, 2020 1:24 pm

I had a look at the Resolve executable and found some API functions that aren't yet listed in the API documentation.

After some trial and error I was able to work out the parameters needed.
  • Timeline
    • bool AddTrack(string trackType, string audioChannelSubType)
    • bool DeleteTrack(string trackType, int index)
    • bool SetTrackEnable(string trackType, int index, bool enable)
    • bool GetIsTrackEnabled(string trackType, int index)
    • bool SetTrackLock(string trackType, int index, bool lock)
    • bool GetIsTrackLocked(string trackType, int index)
    • bool SetClipsLinked(table items, bool link)
  • TimelineItem
    • bool GetClipEnabled()
    • bool SetClipEnabled(bool enable)
    • bool SetNodeLocked(int nodeIndex, bool lock)
  • MediaPool
    • table TimelineItem AppendToTimeline(table clipInfo)
      In addition to the documented clipInfo properties; mediaPoolItem, startFrame, endFrame and mediaType, it also accepts trackIndex and recordFrame. This means we can finally place clips anywhere on the timeline!

It all seems to work just fine, but since it's not documented you should probably expect changes in later releases.

Here's the same list in a similar form as the API readme (including the possible values for trackType and audioChannelSubType that I could find):
Code: Select all
Timeline
  AddTrack(trackType, audioChannelSubType)        --> Bool               # Adds a track of the given type ("audio", "video" or "subtitle") to the timeline. The audioChannelSubType is only needed for audio tracks and is one of "mono", "stereo", "5.1film", "7.1film", or "adaptive1" to "adaptive24".
  DeleteTrack(trackType, index)                   --> Bool               # Deletes a track of the given type at the specified index (int). 1 <= index <= GetTrackCount(trackType)
  SetTrackEnable(trackType, index, enable)        --> Bool               # Enables or disables the given track. The enable parameter is a boolean value.
  GetIsTrackEnabled(trackType, index)             --> Bool               # Returns whether a track is enabled or not.
  SetTrackLock(trackType, index, lock)            --> Bool               # Locks or unlocks the given track. The lock parameter is a boolean value.
  GetIsTrackLocked(trackType, index)              --> Bool               # Returns whether a track is locked or not.
  SetClipsLinked([items], link)                   --> Bool               # Links or unlinks the given clips (TimelineItem objects). The link parameter is a boolean value.

TimelineItem
  GetClipEnabled()                                --> Bool               # Returns whether a clip is enabled or not.
  SetClipEnabled(enable)                          --> Bool               # Enables or disables a clips. The enable parameter is a boolean value.
  SetNodeLocked(nodeIndex, lock)                  --> Bool               # Locks or unlocks a Color page node at the given nodeIndex (int). The lock parameter is a boolean value.

Updated for DaVinci Resolve 18.1
Last edited by roger.magnusson on Thu Dec 08, 2022 8:40 pm, edited 2 times in total.
Offline
User avatar

iddos-l

  • Posts: 704
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Undocumented Resolve v16.2.1 API functions

PostWed May 06, 2020 2:16 pm

Very interesting!
Thanks for sharing.
By the way I was using your class browser the other day. It was a great help.
Cheers


Sent from my iPhone using Tapatalk
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve v16.2.1 API functions

PostWed May 06, 2020 7:04 pm

I'm glad you've found it useful!
Offline

BrettRayner

  • Posts: 10
  • Joined: Tue Oct 03, 2017 1:57 pm

Re: Undocumented Resolve v16.2.1 API functions

PostSat May 23, 2020 11:48 am

This is awesome, thank you! Is there any chance you could explain how you found these functions? Or is it too complex to get into
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve v16.2.1 API functions

PostSat May 23, 2020 3:09 pm

Not complex at all, I just looked at the executable in a hex viewer. I searched for existing functions and next to them I found some that weren't documented.
Offline

dduffy

  • Posts: 5
  • Joined: Wed Aug 26, 2020 10:04 am
  • Real Name: Darragh Duffy

Re: Undocumented Resolve v16.2.1 API functions

PostWed Aug 26, 2020 3:23 pm

roger.magnusson wrote:Not complex at all, I just looked at the executable in a hex viewer. I searched for existing functions and next to them I found some that weren't documented.



Great post - Thanks!

Have you found the function to set a track that clips will be added to? The equivalent to selecting V1/V2 etc.

Can you explain what executable you looked at here to search for functions?
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve v16.2.1 API functions

PostWed Aug 26, 2020 6:26 pm

I don't think they've added that yet.

On Windows the executable is %ProgramW6432%\Blackmagic Design\DaVinci Resolve\Resolve.exe.
On macOS it's /Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/MacOS/Resolve.
Offline
User avatar

Igor Riđanović

  • Posts: 1431
  • Joined: Thu Jul 02, 2015 5:11 am
  • Location: Los Angeles, Calif.

Re: Undocumented Resolve v16.2.1 API functions

PostWed Aug 26, 2020 7:14 pm

Excellent. Thank you.
www.metafide.com - DaVinci Resolve™ Apps
Offline

dduffy

  • Posts: 5
  • Joined: Wed Aug 26, 2020 10:04 am
  • Real Name: Darragh Duffy

Re: Undocumented Resolve v16.2.1 API functions

PostThu Aug 27, 2020 9:28 am

roger.magnusson wrote:I don't think they've added that yet.


That's a pity - but I'll keep digging.

I was hoping that because there is a SetTrackName() function to change the track name, that there may be a sister GetTrack() or SetTrack() function - but nothing!
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve v16.2.1 API functions

PostThu Aug 12, 2021 10:03 pm

It seems I flew too close to the sun. :lol:
In the Resolve 17 executable on Windows it's no longer possible to easily "spy" on which API functions are available by simply looking at the file.
On Windows...
Offline

Terry000

  • Posts: 5
  • Joined: Tue Sep 14, 2021 9:00 am
  • Real Name: Terry Born

Re: Undocumented Resolve v16.2.1 API functions

PostWed Sep 15, 2021 2:36 pm

You are a hero!
BTW, do you know the way to move a clip to the given start position in the timeline?
Offline

Terry000

  • Posts: 5
  • Joined: Tue Sep 14, 2021 9:00 am
  • Real Name: Terry Born

Re: Undocumented Resolve v16.2.1 API functions

PostWed Sep 15, 2021 3:17 pm

are the functions still available in v17?
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve v16.2.1 API functions

PostThu Sep 16, 2021 1:40 am

Terry000 wrote:You are a hero!
BTW, do you know the way to move a clip to the given start position in the timeline?

Timeline editing/navigation through scripting isn't implemented yet. You can however create a new timeline from an EDL using MediaPool.ImportTimelineFromFile(filePath, {importOptions}). See details in the BMD documentation.

Terry000 wrote:are the functions still available in v17?

Yes, they worked in v17 the last time I checked, I think it was 17.2 or 17.3.
Offline

SeldomSeenKid

  • Posts: 182
  • Joined: Mon May 31, 2021 1:16 pm
  • Location: Germany
  • Real Name: Michael Adrian

Re: Undocumented Resolve v16.2.1 API functions

PostThu Dec 02, 2021 1:27 pm

Mr. Magnusson you made my day!
Now I can start to script some procedure to synchronize the audio track selection between DVR and my midi controller.
The only thing that is still missing is a way to output the sound level of the selected track so I can fire up my level meter :twisted:
Good discrimination comes from experience. Experience comes from bad discrimination.
# i7 12 core / 64GB / RTX5000 16GB / WIN10 #
# DVR17.4.6 Studio / Speed Editor / Tangent Ripple / X-Touch One / X-Touch mini / 3DConnexion Space Explorer / 5.1 Nearfield#
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve API functions

PostThu Dec 08, 2022 2:56 pm

In Resolve 18 I've found that you can no longer use "adaptive" for audioChannelSubType when adding an audio track.
bool AddTrack(string trackType, string audioChannelSubType)

You have to specify "adaptive1" up to "adaptive24" (or "mono", "stereo", "5.1film", "7.1film" like before).
Offline
User avatar

roger.magnusson

  • Posts: 2824
  • Joined: Wed Sep 23, 2015 4:58 pm

Re: Undocumented Resolve API functions

PostThu Dec 08, 2022 8:41 pm

I just added this to the first post.
table TimelineItem AppendToTimeline(table clipInfo)

In addition to the documented clipInfo properties; mediaPoolItem, startFrame, endFrame and mediaType, it also accepts trackIndex and recordFrame. This means we can finally place clips anywhere on the timeline!
Offline
User avatar

iddos-l

  • Posts: 704
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Undocumented Resolve API functions

PostThu Dec 08, 2022 9:03 pm

Wow! Really?
Gonna have to try it…
Offline
User avatar

iddos-l

  • Posts: 704
  • Joined: Sat Mar 30, 2019 7:55 pm
  • Real Name: iddo lahman

Re: Undocumented Resolve API functions

PostFri Dec 09, 2022 8:57 am

Yes, it works!
This is awesome, good work Roger!
I found that it won’t add to a track that is occupied by a clip but you can add it to a track above it.

This opens so many possibilities.
First thing for me to do is to update my mixdown script.

Thanks again

Return to DaVinci Resolve

Who is online

Users browsing this forum: BigTall81, Bing [Bot], faimer, marcoos, panos_mts, Umberto Uderzo and 73 guests