Yesterday saw the launch of the quite wonderful 15cBOOKTRADE project at the Weston library, Oxford. As the researcher and developer behind its visualisation and analysis tool, 15cV, I decided to put together, with only six weeks to ago, a short video introducing the project and the tool.
It took around a week to edit the script, which would tell the story of the project through narration, screen recordings, interviews, and recorded camera footage of Oxford.
There was just one problem – I had no idea how to use After Effects and I had never filmed footage to be viewed by someone other than myself before. Well, that’s two problems.
I installed After Effects with my Adobe CC subscription, and stared at the overwhelming number of tools and panels. I knew what the software was capable of, but I had no idea what the workflow was or what terminology to familiarise myself with. Where was I going to start?
I remembered that Oxford has a subscription to Lynda.com, and started to watch After Effects CC Essential Training by Ian Robinson.
After around an hour, I had enough knowledge of the basics to begin.
For the opening sequence of the video, I wanted to show an incunabula originating in Venice, and then splitting into copies that would distribute around Europe. The narrator would introduce the project over the top of this. You can watch the first minute of the video above to see the final result.
I knew that probably the best (free) way to achieve this was by using Google Earth to record a gradual zoom of satellite imagery, and then import this into After Effects. I could then create a virtual camera and map the movement of the Earth imagery to this camera so that the overlaid elements behaved as if they were within my scene.
For the impatient, the actual steps are:
- Record a demo from Google Earth, outputting as a series of JPEGs
- Use FFMPEG to create a video from the JPEGs
- Import into After Effects
- Use Mocha AE to compute the camera transform
- Import transform data back into AE as a null object
- Attach objects to null object
Let’s go through these, starting with getting a decent result from Google Earth Pro.
Recording a Google Earth long zoom
Google Earth (Pro, which is now free) was surprisingly limited in terms of recording demonstrations, but I managed to find a combination of settings that worked. The first task was to slow down Earth’s fly-to speed that dictates how quickly it pans and zooms between places. For this, open preferences and adjust the fly-to speed to be much, much lower. I used a value of 0.15. I also switched off the tilting option as I found it to produce quite unappealing results with extreme zooms.
Now create a small sequence of bookmarks in the Places dock, and practice clicking between them to achieve the result that you want. In my case, I created one for Venice, on for Italy, and one for Europe.
Right, it’s time to make a movie. Go to Movie Maker in the Tools menu.
Select the options shown above. You’ll want to be recording from a live keyboard and mouse navigation, in a nice high resolution. Crucially, you don’t want to encode video as you go along. The burden of encoding video whilst rendering the map imagery will reduce in a stuttering output. You want a nice smooth movie. So, select “Record as image stream”, and change the filename configuration to fixed-length. This last option will ensure that the numbers featured in the output filenames are padded with a number of zeroes such that they are all the same length. It’ll make importing into FFMPEG easier later on, and allow easy sorting within your file explorer.
Hit ‘create movie’. You’ll probably need to do a couple before you’re completely happy. Once you’re finished, you’ll end up with a directory with hundreds or thousands or images in it.
Encoding a video from the Images
You’ll need the almost flawless piece of engineering that is FFMPEG for this task, and be reasonably comfortable with the command line. The instructions here will vary depending on which version you use, and which operating system you use.
Drop into a terminal, and change into the directory with all of your Earth images. Presuming your output filenames look as in the image above, the command would be the following:
ffmpeg -framerate 24 -i 'movie-%5d.png' -c:v libx264 earthmovie.mp4
The expression movie-%5d.png specifies that FFMPEG should look for filenames starting with ‘movie-‘, ending with ‘.png’, and in the middle, five digits representing the sequence order.
Have a look at earthmovie.mp4. If you’re unsatisfied, then you can either re-record using Earth, or perhaps adjust the frame rate setting accordingly. Note that you can of course time-remap this in After Effects later if absolutely necessary.
We now have a movie to import into After Effects. Great!
Tracking the shot with Mocha AE
If we were to just insert an object onto the scene now and play, it’d just remain in the same place at the same size. What we want is for it to appear to be embedded in our Earth scenery as it plays out. To do this, we’ll use Mocha AE to figure out how Earth’s virtual camera has transformed throughout the footage, and then link our object(s) to this transformation.
Once you’ve imported your new movie into a composition, select it and choose Track with mocha AE from the Animation menu. Mocha AE will open and import the footage.
Make sure the play head is at the beginning. Select the Create x-spline layer tool (it looks like a pen with an X) from the toolbar. Draw a rough rectangle onto your map scene that captures the bulk of the imagery. This rectangle defines which portion of the image Mocha should be using to compare the changes in imagery between frames.
You’ll end up with something like the above, although perhaps without the checkerboard pattern inside it yet. In Layer properties, make sure that Link to track is disabled. By default, Mocha will track a scene by transforming the layer along with the footage, such that the object(s) captured remain roughly within the layer through the shot.
However, in the special case of an ultra long zoom shot, this will not work because the pixel information representing geographical areas varies massively depending on zoom level. There will simply not be enough information available to Mocha once the zoom has progressed so far in which to continue tracking. So, we want to tell Mocha to leave the rectangle where it is, and judge the transformation simply using (almost) all pixel information available per-frame.
Add the checkerboard pattern too in
Once tracking is completed, save your Mocha project. The easiest way to import this tracking information into After Effects is to click the Export Tracking Data button in the bottom panel, ensure After Effects Transform Data [position, scale and rotation] (*.txt) is selected in the dropdown, and then click Copy to clipboard.
Import Tracking Information into After Effects
Your clipboard now contains the translation, scaling and rotation transformations needed to represent your long zoom shot. Go back into After Effects, and add a new null object using the Layer > New menu. Select the null object in the timeline, and perform a paste (cmd-v on Mac, ctrl-v on Windows). This null object now acts as a container for our transformation. Any layers that choose it as a parent will act as though they are in the scene. Expand the null object’s transform properties.
Each frame (apart from the first) now has a keyframe set for the translation, scaling and rotation values that represents the virtual camera’s transformation through time.
Attach Objects to the Null Object
Now the fun part. Create a new shape layer to begin with, but don’t add anything yet. First, change its parent to the null object created in the previous step. Now this layer will follow all transformations representing your Earth scene. Now you can drop something simple like a circle object onto the scene. Preview the composition, or scrub the playhead back and forth, and you should see the circle embedded into the scene.
Isn’t that neat? You can now apply this null object transformation to all of the objects that you want in the scene. Setting them up is occasionally fiddly if you have to re-parent to the null object after defining the objects, since After Effects will immediately apply whatever transformations happen to exist at that point in time and your objects may disappear from the scene until later. This takes some trial and error, and, let’s face it, someone who is much better at After Effects than me.
If you have an easier solution to positioning things within the transformed space, please do leave a comment below!