Resolve 15 python scripting

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

Jan Rogowski

  • Posts: 9
  • Joined: Thu Apr 16, 2015 10:41 am

Resolve 15 python scripting

PostSun Jan 13, 2019 10:31 pm

Hi all,

We've recently adopted Resolve for finishing/conform. I'd love to recreate some handy workflow scripts but am struggling a bit with the api. I appreciate it's all new and there's little documentation beyond the dev stuff but I hope someone can enlighten me as to whether what I want to do is possible currently before I spend time trying. Stuff like...

Create bin and import media.
Step through selected or all timeline clips and set attributes, eg set opacity, zoom, etc.
Queue renders - multiple timelines at different resolutions and formats.

Yes/nos would be very useful. Any links for scripting resource would be gold dust.

Thanks!
Jan.
Offline
User avatar

Igor Riđanović

  • Posts: 369
  • Joined: Thu Jul 02, 2015 5:11 am

Re: Resolve 15 python scripting

PostMon Jan 14, 2019 7:59 pm

Create bin and import media.
Yes. See the video below.

Step through selected or all timeline clips and set attributes, eg set opacity, zoom, etc.
I don't think so, but double check the documented methods in the readme.

Queue renders - multiple timelines at different resolutions and formats.
Yes, although I haven't personally tried any of the rendering stuff yet.

Some threads on this forum:
viewtopic.php?f=21&t=72497&hilit=+scripting#p404122
viewtopic.php?f=21&t=73904&hilit=+scripting#p410686
viewtopic.php?f=21&t=73904&hilit=+scripting#p410686

Steak Under Water:
https://www.steakunderwater.com/wesuckl ... 4cd9c436ff

Some projects on my GitHub:
https://github.com/IgorRidanovic/DaVinv ... e_API_Test
https://github.com/IgorRidanovic/DaVinc ... ClipLister
https://github.com/IgorRidanovic/DaVinc ... geSwitcher
https://github.com/IgorRidanovic/DaVinc ... ageFlipper

YouTube:

www.metafide.com
Offline

Jan Rogowski

  • Posts: 9
  • Joined: Thu Apr 16, 2015 10:41 am

Re: Resolve 15 python scripting

PostTue Jan 15, 2019 1:51 pm

That's really useful, thanks Igor!
Offline

Jan Rogowski

  • Posts: 9
  • Joined: Thu Apr 16, 2015 10:41 am

Re: Resolve 15 python scripting

PostTue Jan 22, 2019 3:44 pm

One quick question...

The 'clip' object has methods GetClipProperty and SetClipProperty. I've been trying to use them to set basic stuff on clips like specifying a stereo clip, and setting data level. But failing.

clip.GetClipProperty() reveals a whole plethora of attributes.
clip.GetClipProperty()['Type'] will tell you whether your clip is 'Video + Audio' or 'Stereo'.
clip.SetClipProperty({'Type', 'Stereo}) I think should set the clip to stereo.

But...
Code: Select all
print(clip.GetClipProperty()['Type'])
>>>Video + Audio
clip.SetClipProperty({'Type', 'Stereo'})
print(clip.GetClipProperty()['Type'])
>>>Video + Audio

Manually go and change the clip to stereo...
Code: Select all
print(clip.GetClipProperty()['Type'])
>>>Stereo

I don't get an error, just nothing changes. Has anyone managed to use this method to set attribute values on clips?
Offline

Shrinivas Ramani

Blackmagic Design

  • Posts: 253
  • Joined: Wed Sep 20, 2017 10:19 am

Re: Resolve 15 python scripting

PostWed Jan 23, 2019 2:58 am

Please note that not all queryable properties can be set.

The SetClipProperty returns a boolean indicator of success that can be used to check whether the property has been modified correctly - a false value may indicate either a property that cannot be modified or a requested value that does not make sense (or is not supported).

Code: Select all
>>> is_success = clip.SetClipProperty('Type', 'Stereo')
>>> print(is_success)
False
Offline

Jan Rogowski

  • Posts: 9
  • Joined: Thu Apr 16, 2015 10:41 am

Re: Resolve 15 python scripting

PostWed Jan 23, 2019 7:33 pm

Ok, thanks for the response. Is there any plans to expand the api? It's really handy to be able to control attributes like this, saving time and reducing human error...

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Fabian Frank, Google [Bot], Google Feedfetcher, roger.magnusson and 31 guests