download MochaImport+
https://aescripts.com/mochaimport/

In this tutorial you learn how you can move masks in After Effects with a track created with the mocha plugin that is bundled with After Effects CC 2019 (or also with any Mocha version). Since we use the “move point(s) or path(s)” function of MochaImport+ for that, the masks are not just moving with the track, but can also still be keyframed on top of the track to fix any inaccuracies.
Learn this powerful rotoscoping workflow in just three minutes!

used stock footage:
https://stock.adobe.com/video/aerial-car-driving-up-the-mountain-pass-above-the-ocean/115809300

Transcript

Hello, this is Eric D. Kirk for mamoworld.com and in this tutorial I want to show you how to create keyframeable tracked masks in After Effects with MochaImport+.

I already tracked the side of this car here with the mocha plugin that is bundled with After Effects and imported the tracking data to MochaImport+. If you don’t know how to do this, please watch our tutorial about using stabilized precomps, where I show this step in full detail.

I also prepared already a solid layer on which I created an accurate mask around the side of the car – but currently it is not yet moving with the track. So we select the mask, choose the MochaImport+ function “move points or path” and click apply.

Now we can choose to either generate keyframes or an expression. Let’s first generate keyframes.
As you can see, the mask now moves with the car and the mask shape has lots of keyframes. The keyframes have the advantage that they calculate faster than an expression, but they have one limitation: It is almost impossible to adjust the mask shape now. Here, for example, the mask is not 100% accurate, but if we change it, it is only changed at the current frame, and we would need to change all the other keyframes now manually, too.

So let’s undo everything and apply MochaImport+ again – this time with the expressions option. As you can see, the mask now has only a single keyframe, which is at the current frame, but it still moves with the track using expressions.

Now we can go again to the frame where the mask was not accurate and with the mask path selected, we click on the keyframe icon of MochaImport+ to create an additional keyframe. Make sure to always use this icon to add new keyframes, since if you add keyframes with the usual methods, the new keyframe is not aware of the expression and the shape will end up in the wrong location.

Now if you try to adjust the mask shape, you will notice that you are unable to change it as long as the expression is enabled. Therefore, we need to reveal the expression here and disable it by clicking on this equality symbol here.

Now we can adjust the shape as needed. Since the expression is now disabled, After Effects does the usual interpolation between the two shape keyframes we have – and as you can see, it is way off.

Now we enable the expression again and the result is much more accurate.
This is because the expression uses the tracking data to move from one keyframe to the next one.
In other words, the mask is moving with the track but you are still able to refine the result by adding as many keyframes as you want.

So let’s quickly summarize how you move masks with MochaImport+:
If you don’t plan to modify the mask, best generate keyframes, because this will calculate faster. If you want to change your mask, use the expressions option instead – and when adding new keyframes just make sure to use the keyframe icon of MochaImport+ for that and don’t forget to disable the expression temporarily whenever you make changes.

Again, this is Eric D. Kirk for mamoworld.com – see you next time!