Hacking iMovie
Jul 30, 2009
Video editing software can be complicated, and in 2007 Apple's iMovie application was completely rewritten in an attempt to make video editing much simpler. The barrier that this version of iMovie attempts to break down is the barrier between merrily shooting hours of footage of your cat, getting it off the camera, turning that footage into something watchable, and getting it onto a medium that allows you to present your movie to others. Simplicity comes at the cost of flexibility and the latest version of iMovie came with a range of fancy pre-packaged themes providing titles and transitions. These themes rely on Quartz Composer animations. This article looks at how to customise these Quartz Composer files to tweak them to do more and give you more control over them; using your own graphics, using the font of your choice, changing the placement of elements on the screen, or digging into the programming of the animations to change their behaviour.
First of all you need the Quartz Composer application, which comes free with the Developer Tools provided with your Mac OS X install disks. If you haven't already installed Developer Tools on your Mac, grab your install disks and you can install them from there. Once the Developer Tools are installed, there will be a directory at the root level of your hard drive called 'Developer'. Quartz Composer can be located at /Developer/Applications/Quartz Composer.
Quartz Composer files are appended with the suffix '.qtz'. The .qtz files that iMovie uses are hidden in the iMovie application package. To access them you need to select the iMovie application in the Applications folder in the Finder. Then right click or control click on iMovie; a contextual menu will be displayed. Select 'Show Package Contents' and a new Finder window will open displaying the hidden contents of the iMovie application package. Then select the directory 'Contents/Resources'. Right click or control click on this directory and select 'Copy "Resources"' (don't drag this directory to a new location!). Navigate to another location of your choice, such as the Desktop, right click or control click and select 'Paste Item'. You should now have a copy of the iMovie Resources folder.
Please note the word 'hacking' in the title; before altering any of these files, you should make a copy of it in a new location. That way you can revert to to the original file if anything goes wrong.
The Resources folder contains the .qtz files which iMovie refererences to generate these animated effects. When you open one of these files in Quartz Composer usually you will not see anything playing in the Viewer. This is because iMovie controls the animation playback via a 'Published Input' in the .qtz file. That is, the parameter which tells the .qtz file to play is sent from the iMovie application. In order to make the animations play in Quartz Composer you need to temporarily bypass this parameter by adding a patch.
As an example, locate the file 'Ticker.qtz' and open it in Quartz Composer. In the editor window you will see a patch labelled "Number Splitter" which has a published input labelled "percentDone". Any animated .qtz file which iMovie uses will have one of these inputs - it receives a value between 0.00 and 1.00 from iMovie as a project plays across the transition or title. To bypass this value and make the animation play, locate the Interpolation patch in the Patch Creator window and drag it into the Editor. Now simply drag the output port of the Interpolator to the input port "percentDone". By default the Interpolator will cycle through the same values between 0 and 1 which are sent from iMovie to "percentDone" - you should now see the default 'Title Text Here' title scrolling across the bottom of the screen in the Viewer.
You might notice that in this case there is already an Interpolation patch (re-labelled 'Percent Looper (for debugging)') which has been left there by the iMovie programmers, but this is not always the case and it is handy to see how to create this patch on your own.
To alter the scrolling rate, change the Duration input parameter on the Interpolator patch from 1 to a higher value to slow it down, or a lower value to speed it up.
Now that you have the ticker playing, you can start customising. For starters, although most of iMovie's titles allow you to customise fonts, Ticker does not and limits you to using Lucida Grand against a gray background band. Now you can customise your font in Quartz Composer. In this case, double click on the 'Ticker' macro patch. This takes you down through the heirarchy of patches; go down one layer further by double clicking on the 'Scroll from 0 to 1' macro patch. This contains an 'Image With String' patch which is used to generate the text. You should see along the top of the editor window the path to the macro you are currently editing; in this case 'Root Macro Patch > Ticker > Scroll from 0 to 1'.
Select 'Show Patch Parameters' from the Editor menu which will display the parameters in a sidebar. Select the 'Image From String' patch and you will see its parameters in the sidebar. Here you will see 'LucidaGrand' set as the Font Name. Click in the field and type 'Helvetica' (no, there is no font selector). Hit Enter and the viewer will now display the ticker with the customised font.
You can also change the grey translucent background as desired. Click 'Edit Parent' in the Editor to return back up the through the patch heirarchy to the 'Ticker' patch. Here you will see a patch labelled 'Color Band'. This is a standard patch called a 'Sprite' which the iMovie programmers have renamed. Let's replace the grey background with a graphic. For illustration purposes I have used the 'Extra-red_curtain.png' from the iMovie Resources folder we made a copy of earlier.
To add an image as a patch in Quartz Composer, all you need to do is drag the image from the Finder directly into the Editor window.
Note also that I have disconnected the 'Color' patch output from the 'Color' input of the 'Color Band' patch and set the color value here to white. Here's how the ticker looks now;
We can alter the timing of the ticker quite simply as well. From within the same macro patch, select the patch labelled 'Timelines'. Open the Patch Inspector and select 'Settings'. The inspector will display a linear timeline which is governing the progression of the title across the screen. By altering this timeline we can make the the ticker scroll across and stop in the middle of the screen before continuing.
Option-click on the timeline to create new keyframes.
Once you are happy with your customised title, you need to change it back to it's original state with the 'percentDone' input published. To do this, right-click on the 'Number Splitter' input patch port and select 'Published Inputs > Input' from the contextual menu. A text entry field will appear allowing you to rename the input. Rename it 'percentDone' and the input will now appear as it did when the animation was first opened in the image above.
Now you can save your customised title, and copy it back to the iMovie Resources folder, replacing the original. Make sure you are working from a copy of the original first! Otherwise you won't be able to revert to the original file if something goes wrong :- you'll have to re-install the iMovie app!
Here is the customised Ticker title running in iMovie 09;
For more information about using Quartz Composer, start here.
Comments
I looked inside iMovie because of titles localization issue. Found a couple of .qtz . Then installed Developer Tools, and then found your article very useful for quick start. Thank you very much for this! One addendum: Permissions of the copied source files and folders has change. It is necessary to restore it (to owner: root [system], group: wheel, drwxr-xr-x) with BatChmod after replacing it into original iMovie. Thumbs Up! lvl
Mike 11 Jan 2011, 03:20:22
Comment On This Post
Comments are moderated by the site admin. It's nothing personal - just trying to keep out the spam. Any reasonably relevant comment will probably be published.