Convert “Mocha for AE” tracking data to Shake / Nuke nodes via PHP

February 19, 2012

***UPDATE***

This import script has now been rebuilt in Python so that it will run natively within Nuke. Unless you need to create the Shake node, check out the new version here

***ORIGINAL POST BELOW***

A while ago I worked at a facility where I needed to do a Mocha planar track, then use the tracking data in Shake. They only had the “Mocha for AE” version of the software, so it would only create an After Effects corner pin node (AE was not the ideal environment to comp the shot as its corner pin does not support motion blur).

So I wrote a quick and dirty PHP script that takes the generated tracking data (a .txt file) and spits out a Shake “Stabilize” node. Once I had that, it was only a small tweak to have it to also create a Nuke “Tracker” node (credit to Mat Power for doing a lot of this side of the coding).

This has proved an invaluable tool for me, as Im often working at places that don’t have the full licence for Mocha. So I thought I’d share it here, as Im sure others will find it useful.

Just copy and paste the contents of the .txt file created by Mocha into the text area below, then hit “convert”.

I’ll link to the source code here so that people can run it locally, or if they feel that it could be improved. Its pretty ugly under the bonnet – I crashed the script out in a few hours so feel free to clean it up / extend its functionality. There is a function that parses the incoming text file and strips out the point / frame data, putting it into a master array. There are then 2 different functions to format / output the contents of the array into both Shake and Nuke nodes.

 
Paste tracking data here:
(Use the
"After Effects Corner Pin [corner pin only, supports RG Warp and mochaImport] (*.txt) "
export method from Mocha)



Frame offset:


8 Responses to "Convert “Mocha for AE” tracking data to Shake / Nuke nodes via PHP"

Tim Christensen says: May 19, 2012 at 7:28 pm

Fantastic tool, thank you for this!

Great tool I was introduced to the original php scripts on your old site a long time ago. Thanks for sharing the source code, these things are always useful to someone like mysef learning a lttle more about coding (even if you feel its a bit rough around the edges)

I totally agree it’s a great tool. In my company, most of the newer licenses of mocha are always in used. And because of this, I can use mocha 1 and copy paste it to nuke. Thanks Richard!

Wow.. Amazing help. I will be using this. You are the man. Tracking info came from AE 6 and went right into Nuke with no issues.

This is awesome! Nice work!

Hello, is the source code on this project still available?

Link has now been updated to be live again.
PHP source code can be downloaded at http://www.richardfrazer.com/convert_tracking_data07.php.zip
Regards

Leave a comment

required