Page 1 of 1

Importing Image Sequences with AddClipMattesToMediaPool()

PostPosted: Wed Apr 30, 2025 2:47 am
by pennyslugger
Hello, I'm working on developing a script for our online editors that can import DPX sequences as clip mattes via the AddClipMattesToMediaPool([]) function.

Our vendors usually deliver mattes as DPX sequences. These sequences can be manually imported as a Clip Matte through Media Storage. I've found other commands (i.e. ImportMedia([{}])) that can import media as image sequences, but they take whole dictionaries and cannot import media as Mattes attached to other clips.

The AddClipMattesToMediaPool([]) function is built for what I'm trying to achieve but it appears that it can only take a file path as it's input with no area to define it as an image sequence.

Am I missing something? How can I make sure it recognizes this file path as an Image Sequence so that DPX sequences import as one Matte?

Re: Importing Image Sequences with AddClipMattesToMediaPool(

PostPosted: Fri Aug 08, 2025 10:20 pm
by not_named_dan
Hi Christien,

I'm working on a similar script and ran into this issue. After some troubleshooting, I found that you have to edit the file path so that it points to the parent directory of the image sequence, not the image sequence itself.

The problem now is that I have to add a function to my script that truncates the file path returned by GetClipProperty('File Path') from '<some path>/matte/matte.[1001-1099].dpx' to just '<some path>/matte'. It would be helpful if AddClipMattesToMediaPool() understood image sequence syntax without requiring this workaround though...

Hope this helps!

Re: Importing Image Sequences with AddClipMattesToMediaPool(

PostPosted: Wed Aug 27, 2025 1:53 am
by sushi ninja
Hi.

I encountered the same issue and tried Nathan's approach, but whilst it returned true in my environment, it did not actually function.

Upon enquiring with BMD regarding this, it appears necessary to store the file paths for each frame within the image sequence in an array (List) and use that as the argument for AddClipMattesToMediaPool().

For example, if the path of the sequence you wish to add is displayed as ‘<some path>/matte/matte.[1001-1099].dpx’ in Resolve, the following Lua code should achieve the intended behaviour:
( I'm no expert on code, so this might be a bit off )

Code: Select all
resolve = Resolve()
local fusion = resolve:Fusion()
local project = resolve:GetProjectManager():GetCurrentProject()
local media_pool = project:GetMediaPool()
local media_storage = resolve:GetMediaStorage()

local selected_item_list = media_pool:GetSelectedClips()
local media_pool_item = selected_item_list[1]

local some_sequence_matte_path = '<some path>/matte/matte.%04d.dpx'

local matte_paths = {}
for i = 1001, 1099 do
   local image_path = string.format(some_sequence_matte_path, i)
   table.insert(matte_paths, image_path)
end
media_storage:AddClipMattesToMediaPool(media_pool_item, matte_paths)