How to subtitle in After Effects

Posted by on May 5, 2011 in After Effects, code, how to | One Comment

To subtitle in After effects, use the script linked below.

	//	Subtitle generator by !Rocky
	//	modified by Colin Harman ( ) to work on a Mac
	//     modified by Oliver to work with CS5
	//	Save this code as
	//	"subtitles.jsx"
	//	Create a text file with your subtitles.
	//	Each line of text is one on-screen line.
	//	To have several lines on-screen at the same time,
	//	simply separate them with a pipe ( | ) character.
	//	eg "Character 1 talks|Character 2 interrupts"
	//	Create a new text layer in your comp, adjust its position,
	//	make sure the text's centered, so it looks nice
	//	Add markers (Numpad *) where each subtitle line must be shown/hidden.
	//	With the text layer selected, run the script, and select the subtitles file.
	//	Enjoy!

	function makeSubs() {
		var layer = app.project.activeItem.selectedLayers[0];

		if ("sourceText") != null) {
			var textFile = File.openDialog("Select a text file to open.", "");
			if (textFile != null) {
				var textLines = new Array();"r", "TEXT", "????");

				while (!textFile.eof)
					textLines[textLines.length] = textFile.readln();


				var sourceText ="sourceText");
				var markers ="marker");

				for (var i = sourceText.numKeys; i >= 1; i--)

				var line = 0;
				var subTime, subText;
				for (var i = 1; i <= markers.numKeys; i++) {
					subTime = markers.keyTime(i);
					sourceText.setValueAtTime(0, " ");

					if ((i % 2) == 0) {
						subText = " ";
					else {
						subText = textLines[line].replace("|", "\x0d\x0a");
					sourceText.setValueAtTime(subTime, new TextDocument(subText));


Posted by on Apr 6, 2011 in After Effects, Maya, photography, Video | No Comments

Experimental mixture of 3D and still / time-lapse photography.

Approximately 9 minutes.

I used a technique similar to this to get the audio driven 3D accomplished.

Music By DJ Krush, with DJ Shadow.

Outputting a depth map from Maya and creating depth of field in After Effects

Posted by on May 16, 2010 in After Effects, how to, Maya | No Comments

Create a render layer that contais the objects that will be blurred. Use “Luminance Depth” preset.

The depth map render will look something like this. A gradient, which describes depth. Objects further from the camera are shaded increasingly darker.

Bring your color render and the depth map into a composition in After Effects. You can switch off the visibility of the depth map layer. It will only be used by the Lens Blur Effect to guide hich areas will receive blur.

Apply the Lens Blur effect to the color render layer. Select the depth map layer as the “Depth Map Layer”.

Adjust attributes to get the result needed. Here only the “Blur Focal Distance” (focus region distance from camera) and the ” Iris Radius”(blur amount) were adjusted.

Extracting raw keyframe data from After Effects keyframe data

Posted by on May 16, 2010 in After Effects, code, how to, Mac | 4 Comments

You can easily “export” keyframe data from After Effects by copying the key frames in the timeline, then pasting them to a text file.

We want to extract raw key frame data, from After Effects formatted key fame data, via shell script, so that it can be used by Maya or other animation apps.

After Effects keyframe data looks like this:

Adobe After Effects 8.0 Keyframe Data Units Per Second 29.97 Source Width 900 Source Height 506 Source Pixel Aspect Ratio 1 Comp Pixel Aspect Ratio 1 Effects Sound Keys #1 Output 1 #22 Frame 1 0.000261479 2 0.00608461 3 0.0153011 4 0.0274689 5 0.0395869 6 0.0493024 7 0.0562797 8 0.0557284

We need something more like this:

0.000261479 0.00608461 0.0153011 0.0274689 0.0395869 0.0493024 0.0562797 0.0557284

Use this shell script to extract the keys:
Read this for a detailed explanation of the script.
Usage (in the terminal): path/to/ path/to/keyFrameData.txt

Use this shell script to batch process several files:
Usage (in the terminal): path/to/ path/to/directory

Also see:

Here is a primer on shell scripting. You can run a shell script on a Mac or in Linux, through the Terminal, or on a PC with a app like Cygwin.

UPDATE! The NEW! The python script, linked here, will do the same, import After Effects Sound Keys keyframes, from .txt files, to Maya, but it will also take care of the formatting, so there is no need to run the shell script on your After Effects keyframes before importing. Look for the NEW! script.

Getting audio key frames out of After Effects using Trapcode Sound Keys

Posted by on May 16, 2010 in After Effects, how to, motion graphics | One Comment

You can use Trapcode Sound Keys to create audio driven animation in After Effects. You can also save the key frames to a text file, and use them in other animation applications.


1. Create a solid layer.
2. Apply the Sound Keys Effect to the solid.
3. Add an audio layer to the timeline, then assign that layer to drive Sound Keys from the “Audio Layer” drop-down.

4. Select the frequency range that you want to capture from the spectrum.
5. Adjust the work area in the time line to reflect the range of keys that you would like to capture.
6. Click the “Apply Button”. Sound Keys will create keys in the timeline.

7. Select and copy the keys. Paste the keys to a text file.

Should look something like this:

Adobe After Effects 8.0 Keyframe Data Units Per Second 29.97 Source Width 900 Source Height 506 Source Pixel Aspect Ratio 1 Comp Pixel Aspect Ratio 1 Effects Sound Keys #1 Output 1 #22 Frame 0 0 1 0 2 0 3 0 4 0.000261479 5 0.00608461 6 0.0153011 7 0.0274689 8 0.0395869 9 0.0493024 10 0.0562797 11 0.0557284

Extra information about copying and pasting data.

Slider Control in After Effects

Posted by on Nov 24, 2009 in After Effects, code, motion graphics, tips | One Comment

You can link the Slider Control expression control to properties in After Effects to create a gui slider interface with a key-able value. An easy way to do this is to do the following.

  1. Make a null layer. Apply the Slider Control expression control effect to the null layer.
  2. Create an expression by option/alt clicking on the “stopwatch” of the property.
  3. Use the pick whip to connect the property to the Slider Control.

You can also link individual values of properties, the x position for example, to the slider if you highlight that value and then connect via the pick whip. You must be able to access the individual arrayed values of the property, so write your expression as below, for example:


Highlight the value “position[1]” then use the pick whip to connect to the Slide Control. You will get this new expression as a result (if your null is named controllerNull):

[position[0],thisComp.layer("controllerNull"). effect("Slider Control")("Slider")]

Download example scene

The following expression is used to link a series layers to the slider. The “index” value is used to echo the layer number, here the z position of a 3d layer. The slider control is used as a multiplier on that value. The result is an accordion like effect.

[position[0],position[1], index*thisComp.layer("controllerNull").effect("Slider Control")("Slider")]

After Effects tips

Posted by on Nov 3, 2009 in After Effects, motion graphics, tips | No Comments

Command + forward slash (apple), or control + forward slash will bring selected footage items into an open composition.

Command + option + forward slash (apple), or control + alt + forward slash will replace selected footage in the timeline with selected footage from the project panel.

Hit the asterisk key on the numeric keypad to add a layer marker to a selected layer at the current point in time.

Command/control + Y creates a new solid. Command/control + shift + Y opens solid settings.

Press the u key to reveal all key frames. Press uu to reveal all modified parameters.

To match the work area to a layer’s duration: select the layer, then type “ibon“. i sends the time indicator to the in point of the layer, b sends the in point of the work area to match the time indicator. o sends the time indicator to the outpoint of the layer, n sends the out point of the work area to the outpoint of the time indicator. Better yet use command+option+b to match the work area to the duration of all selected layers.

Use the bracket [] keys to move layers in/out to the time indicator. Option+bracket will crop the in/out points to the time indicator.

To go to the first or last frame of the work area, press Shift+Home or Shift+End.

Show only properties with keyframes or expressions: Press U

After Effects Keyboard Shortcuts