Saving Magic Masks to Projects and Related Topics

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

PeterBrown

  • Posts: 26
  • Joined: Tue Aug 01, 2017 11:49 pm

Saving Magic Masks to Projects and Related Topics

PostSun Apr 28, 2024 4:29 am

Hi Folks... I just bought Davinci Resolve Studio 18 and am delighted by it. I've been using the free version since v12.

Using Magic Mask allows me to refactor some old videos without green screens and knock out and replace the backgrounds as if I had a green screen. (I was using solid color cloths, like black, etc.)

I read some comments about Magic Mask losing its render, and how to save the masks. From the comments, it seemed that DR was using a temporary cache to save the tracked clips.

*** As a hoped for successful backup of the masks, I saved my video with all of the tracked and rendered masks to an exported project.

I then changed the name of my current project and re-imported the exported project. I noted that the mask tracking and rendering was indeed lost: however, the strokes were not, so I clicked on Regenerate Object Mask / All Clips. It worked perfectly and all was well. My questions are:

1. Is it also correct that the strokes are saved to the current project securely?

2. If the rendering is saved to a temporary cache file, how and how often does that file get deleted? If I exit from a project and re-open it, with the cache still be active?

3. Is there anything we can do to keep the cache permanently saved for one particular project, or is there a way to isolate the saving of just the Magic Mask cache?

However, I think it would be MUCH better if the rendered magic mask results were saved with the project and the exported project, just as so much else is saved.

That is: don't save the rendered mask in a cache: save the results in the project file.

4. My first query in an old Magic Mask post was not answered, so here it is again:

--- I copied the mask from one clip to all the clips, in the color page, but after doing so I was not able to click on Regenerate All Clips. The other clips showed my *stroke* in the stroke LIST for each clip, but not in the video clip (i.e. the blue stroke lines).

So, I had to edit each clip (50 in all) to add the strokes and generate the mask. I hope there's a quicker way to do it.

Thanks for any feedback!

Peter Brown
Windows 10-64-Pro
Dell Precision 7780 laptop, 64 Gigs of Ram
Offline

bentheanimator

  • Posts: 471
  • Joined: Mon May 13, 2019 10:38 pm
  • Location: Minneapolis, MN
  • Real Name: Ben Hall

Re: Saving Magic Masks to Projects and Related Topics

PostSun Apr 28, 2024 7:19 am

Your best bet is to use the magic mask in Fusion. Then you can use a Saver to save out an image sequence that you can load in anywhere you'd like.
Resolve & Fusion Studio 19b1
Windows 11
Intel 6850K @ 3.4GHz | 32GB RAM | 2xGTX1080

MacOS 12.7.2
MacBook Pro 13,3 | 16GB | Radeon 460 4GB | 256GB System | 256GB Scratch
Offline
User avatar

PeterBrown

  • Posts: 26
  • Joined: Tue Aug 01, 2017 11:49 pm

Re: Saving Magic Masks to Projects and Related Topics

PostSun Apr 28, 2024 1:25 pm

bentheanimator wrote:Your best bet is to use the magic mask in Fusion. Then you can use a Saver to save out an image sequence that you can load in anywhere you'd like.


Thanks, Ben... I tried doing it in Fusion and found it harder to accomplish what I needed... probably because of my lack of knowledge about Fusion. So that's an advanced step up for me.

Doing it in the Color page was much easier for me.

But one day, I'll dig back into Fusion. Probably. :-)

Peter
Windows 10-64-Pro
Dell Precision 7780 laptop, 64 Gigs of Ram
Offline

Steve Alexander

  • Posts: 4631
  • Joined: Mon Mar 23, 2015 2:15 am

Re: Saving Magic Masks to Projects and Related Topics

PostSun Apr 28, 2024 5:38 pm

You can render out a black and white image to act as a separate matte that you import back in (as a matte - it's an import option from media storage). There are a few ways to do this but one way is to generate the magic mask in the color page and then connect the blue square of the magic mask node to the color output node and then render the clip to DNxHR HQX or ProRes HQ 422 or better on the deliver page. If you don't use the whole clip for the mask then you will also need to sync the mask to the clip. You could basically setup a separate timeline just for the purposes of generating the mask for a clip.

Then you find the clip in media storage. Make sure the original clip is selected in the media pool. Then you right click on this new matte file in media storage and select 'Add to media pool as a matte' and it will bind to the selected clip in the media pool.

To use this easily - let's say you are working on a node in the color page where you want to blur the background - you would right-click on the blur node and select 'Add matte' and a list will pop up with the new matte file you added above). Select it and then use the key property panel to invert the input matte or do whatever else. If you are running the new beta you can use this technique to 'Defocus Background' with the new studio effect.

I just gave this a try and it works very well. I can discard my original magic mask node or just set it aside in case I want to refine it and regenerate but essentially this upfront work means I don't have to worry about invalidating the mask in the future by making upstream changes to the image. Plus it runs much faster.

Cheers
Time Traveller
Resolve Studio 19.0b1 | Fusion Studio 19.0b1 | Win 11 Pro (22H2) | i9-7940x, P4000 (536.96, 8GB VRAM), 64GB RAM, M.2 boot, SSD scratch, RAID10 data | (laptop) 16" MacBook Pro M1 MAX, 32 GPU cores, 64 GB RAM, 2 TB SSD, Sonoma 14.4.1
Offline
User avatar

Uli Plank

  • Posts: 21989
  • Joined: Fri Feb 08, 2013 2:48 am
  • Location: Germany and Indonesia

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 2:03 am

That works, but syncing can be a bit tricky.
Alternatively, you can connect the alpha output and save in a format that supports an integrated alpha channel, like DNxHR 444.
Now that the cat #19 is out of the bag, test it as much as you can and use the subforum.

Studio 18.6.6, MacOS 13.6.6, 2017 iMac, 32 GB, Radeon Pro 580
MacBook M1 Pro, 16 GPU cores, 32 GB RAM and iPhone 15 Pro
Speed Editor, UltraStudio Monitor 3G
Offline
User avatar

PeterBrown

  • Posts: 26
  • Joined: Tue Aug 01, 2017 11:49 pm

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 3:03 am

Thanks for the suggestions....

My level of skill is far below all of yours, so your methods suggested would send me deep into study-land.

However :-) I did find success with simply saving the project to an exported project file and then regenerating the masks.

And, or perhaps but... related to all of that, I had four specific questions in my post above. Would it be possible for someone to review my four questions and take a stab at answering them?

Thanks!

Peter
Windows 10-64-Pro
Dell Precision 7780 laptop, 64 Gigs of Ram
Offline
User avatar

Uli Plank

  • Posts: 21989
  • Joined: Fri Feb 08, 2013 2:48 am
  • Location: Germany and Indonesia

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 3:17 am

Some of your questions can only be answered by BM, and they may not want to. I found Magic Mask as impressive as annoying at the same time (typical for AI). So, I quickly started to save my masks for reuse, being used to alpha channels and alpha clips from more than 20 years of workarounds in compositing software, and didn't care to fix the issues.
But Magic Mask has been improved in 19, so you may want to give it a try. But remember, it's still an early beta, and other things may be broken. So save your database first!
Now that the cat #19 is out of the bag, test it as much as you can and use the subforum.

Studio 18.6.6, MacOS 13.6.6, 2017 iMac, 32 GB, Radeon Pro 580
MacBook M1 Pro, 16 GPU cores, 32 GB RAM and iPhone 15 Pro
Speed Editor, UltraStudio Monitor 3G
Offline
User avatar

PeterBrown

  • Posts: 26
  • Joined: Tue Aug 01, 2017 11:49 pm

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 3:27 am

Uli Plank wrote:Some of your questions can only be answered by BM, and they may not want to. I found Magic Mask as impressive as annoying at the same time (typical for AI). So, I quickly started to save my masks for reuse, being used to alpha channels and alpha clips from more than 20 years of workarounds in compositing software, and didn't care to fix the issues.
But Magic Mask has been improved in 19, so you may want to give it a try. But remember, it's still an early beta, and other things may be broken. So save your database first!


Thanks, Uli... the magic masking I did for the video in question was quite simple. I was knocking out the background behind me and replacing it with a new background image. So the masking was just running the strokes around my image, much like the method one does with the new green screen function on the edit page. (Which is fantastic, by the way.)

I found it particularly arduous that I had to do that with all 50 clips; i.e. the copy mask to other clips didn't work.

I'll wait on v19 beta. I got things to work, albeit with the hiccups I mentioned.

Peter
Windows 10-64-Pro
Dell Precision 7780 laptop, 64 Gigs of Ram
Offline

Andy Mees

  • Posts: 3289
  • Joined: Wed Aug 22, 2012 7:48 am

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 7:19 am

PeterBrown wrote:I had four specific questions in my post above. Would it be possible for someone to review my four questions and take a stab at answering them
PeterBrown wrote:1. Is it also correct that the strokes are saved to the current project securely?
Correct.

PeterBrown wrote:2. If the rendering is saved to a temporary cache file, how and how often does that file get deleted? If I exit from a project and re-open it, with the cache still be active?
It only gets deleted when invalidated ie you change something that renders the generated mask invalid. Yes, you should be able to close and reopen the app / projects indefinitely and the cache will still be active (unless invalidated).

PeterBrown wrote:3. Is there anything we can do to keep the cache permanently saved for one particular project, or is there a way to isolate the saving of just the Magic Mask cache?
Per methods already described, a generated mask can be exported as a standalone media clip that can then be used as such.

PeterBrown wrote:However, I think it would be MUCH better if the rendered magic mask results were saved with the project and the exported project, just as so much else is saved. That is: don't save the rendered mask in a cache: save the results in the project file.
Thats not how project files work. They don't embed media files, only references to them.

PeterBrown wrote:4. My first query in an old Magic Mask post was not answered, so here it is again:

--- I copied the mask from one clip to all the clips, in the color page, but after doing so I was not able to click on Regenerate All Clips. The other clips showed my *stroke* in the stroke LIST for each clip, but not in the video clip (i.e. the blue stroke lines).

So, I had to edit each clip (50 in all) to add the strokes and generate the mask. I hope there's a quicker way to do it.
Strokes are attached to the specific frame against which they were created and resulting mask caches are generated sequentially from that stating frame. If you paste an existing magic mask instance to a new / separate clip instance where the target frame for the mask's stroke doesn't exist then no cache can be generated as the starting point for generating the necessary mask cache does not exist within the bounds of that clip instance.
Offline

Sam Steti

  • Posts: 2527
  • Joined: Tue Jun 17, 2014 7:29 am
  • Location: France

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 8:23 am

Andy Mees wrote: PeterBrown wrote:
2. If the rendering is saved to a temporary cache file, how and how often does that file get deleted? If I exit from a project and re-open it, with the cache still be active?

It only gets deleted when invalidated ie you change something that renders the generated mask invalid. Yes, you should be able to close and reopen the app / projects indefinitely and the cache will still be active (unless invalidated).

That's not what's experienced by most of MM users unfortunately. Maybe it "should", but it doesn't so far...
Usually what indeed invalidates the MM cache are changes made prior to its node (any node before), but if you use the MM without invalidating anything this way or another actually > then only save the project and close : when you re-open it the cache is lost...

BTW
My level of skill is far below all of yours, so your methods suggested would send me deep into study-land.
Honestly, I don't think so (which is kind of a good piece of news right ?)
Just do what Steve wrote :
1/ make your MMask
2/ when done, "connect the blue square of the magic mask node to the color output node and then render the clip to DNxHR", meaning the blue output of the MM node to the green output (the end of the node flow see ?) and render : this way you do as those - like me - who add a saver node in Fusion.
3/ you result is a matte that you import in the media pool a "special" way : right click > "Import as a matte"

PS : find a codec which supports alpha, I don't know for DNx... (but if you used ProRes I'd suggest PR4444)
*MacMini M1 16 Go - Ext nvme SSDs on TB3 - 14 To HD in 2 x 4 disks USB3 towers
*Legacy MacPro 8core Xeons, 32 Go ram, 2 x gtx 980 ti, 3SSDs including RAID
*Resolve Studio everywhere, Fusion Studio too
*https://www.buymeacoffee.com/videorhin
Offline
User avatar

Uli Plank

  • Posts: 21989
  • Joined: Fri Feb 08, 2013 2:48 am
  • Location: Germany and Indonesia

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 8:38 am

Both DNxHR HQX 12 bit (and higher) and CineForm in RGB 16 bit support alpha, as do many image sequence formats.
Now that the cat #19 is out of the bag, test it as much as you can and use the subforum.

Studio 18.6.6, MacOS 13.6.6, 2017 iMac, 32 GB, Radeon Pro 580
MacBook M1 Pro, 16 GPU cores, 32 GB RAM and iPhone 15 Pro
Speed Editor, UltraStudio Monitor 3G
Offline
User avatar

Marc Wielage

  • Posts: 11136
  • Joined: Fri Oct 18, 2013 2:46 am
  • Location: Hollywood, USA

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 8:45 am

Uli Plank wrote:That works, but syncing can be a bit tricky.

I think this could be made to work if the user exported the External Matte file with (say) 1-second handles and identical timecode. This will give you some adjustment room if necessary when attaching it to the original clip. Note you can actually adjust the size of the matte using the input sizing controls, and that might help blend the mask edge a little bit.

There are a few YouTube videos about this and it's an interesting idea. I think it might be a good Feature Request to have a button on the Magic Mask pallet that says "Generate External Matte" for people who want to try to do it that way.
Certified DaVinci Resolve Color Trainer • AdvancedColorTraining.com
Offline

Sam Steti

  • Posts: 2527
  • Joined: Tue Jun 17, 2014 7:29 am
  • Location: France

Re: Saving Magic Masks to Projects and Related Topics

PostMon Apr 29, 2024 9:07 am

Uli Plank wrote:Both DNxHR HQX 12 bit (and higher) and CineForm in RGB 16 bit support alpha, as do many image sequence formats.
Yep, thx for him ;)
Marc Wielage wrote: I think it might be a good Feature Request to have a button on the Magic Mask pallet that says "Generate External Matte" for people who want to try to do it that way.
Hell yeah !...
So far the Fusion way remains a way handier solution imho, because a saver node is kind of this ExtMatte generator button, but you can also rely on a wider panel of tools to finesse the MM node (even just a MatteControl for ex.). Because I don't tweak a lot the parameters of the MM in Color when i make some, but what if you want to change even just a little thing in the parameters of the MM in Color ? You must regenerate the mask with the new adjustments ? No way...
*MacMini M1 16 Go - Ext nvme SSDs on TB3 - 14 To HD in 2 x 4 disks USB3 towers
*Legacy MacPro 8core Xeons, 32 Go ram, 2 x gtx 980 ti, 3SSDs including RAID
*Resolve Studio everywhere, Fusion Studio too
*https://www.buymeacoffee.com/videorhin
Offline
User avatar

PeterBrown

  • Posts: 26
  • Joined: Tue Aug 01, 2017 11:49 pm

Re: Saving Magic Masks to Projects and Related Topics

PostFri May 03, 2024 5:29 am

Thanks for everyone's responses---I really appreciate them.

I'm going to dig into the guidance as I can, since I'm juggling things right now.

I am grateful for Davinci Resolve AND such a fine community.

Thanks again!

Peter
Windows 10-64-Pro
Dell Precision 7780 laptop, 64 Gigs of Ram

Return to DaVinci Resolve

Who is online

Users browsing this forum: Bing [Bot], Cary Knoop, Charles Bennett, Google [Bot], Peter Cave and 90 guests