DEV Community

Francesco
Francesco

Posted on

Use pip packages in DaVinci Resolve scripts

As a content creator and a automation enthusiast, I've spent some time studying how to script my video editing workflow in DaVinci Resolve. I'm happy to share my findings because I've found that there isn't much documentation on this topic.

As with regular programming, it's always beneficial to reuse modules written by others when creating scripts for DaVinci Resolve. These modules can be easily installed using pip, just like with any other Python project.

However, it's important to note that the process for using custom modules in DaVinci Resolve is slightly different than it is for regular Python programming.

In particular, you need to manually locate the Python folder used by DaVinci Resolve and install the module in the "site-packages" folder within that folder. Once installed, the module can be used just like any other module in your DaVinci Resolve scripts.

To locate DaVinci Resolve's Python folder, I created script that logs os.file:

import logging
logger = logging.getLogger()
logging.basicConfig(filename='/absolutePath/forYourLogFile/log.log', level=logging.DEBUG)
logger.debug(str(os.__file__))
Enter fullscreen mode Exit fullscreen mode

After executing the script from DaVinci Resolve, you will see in the log file a line like DEBUG:root:/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/os.py

Open up a terminal and navigate to the bin directory, some levels up the path that was logged. In my case was /Library/Frameworks/Python.framework/Versions/3.10/bin.

From there you can install a custom Python module in DaVinci Resolve with the command ./pip3 install <module name>

In your DaVinci Resolve script you will be able to import it with import <module name>

In conclusion, using Python modules in DaVinci Resolve can offer many opportunities for customizing and automating your workflow.

I hope this article has been helpful to you and has provided you with the necessary information to use custom Python modules in DaVinci Resolve.

This was tested with Resolve 18 on MacOs

Top comments (0)