We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › After Effects keyframe data in Processing
Pages: 1 2 
After Effects keyframe data in Processing (Read 4568 times)
After Effects keyframe data in Processing
Jan 31st, 2010, 12:25pm
 
Hi everybody,

I have been experimenting with real-time motion graphics. And at the moment I am trying to build a very basic VJ application in Processing. I have read in this forum that it is nearly impossible to get real-time Beat Detection right in Processing.

I just did some research and I found that it is possible to export keyframe data from After Effects. I created this square in AE, and then I made it move/shake for 5 seconds. Then I copied the data into a text file.

I was wondering how I can use this data in Processing.

Here is what the data in the text file basically looks like:

Adobe After Effects 8.0 Keyframe Data

     Units Per Second      29.97
     Source Width      1
     Source Height      1
     Source Pixel Aspect Ratio      1
     Comp Pixel Aspect Ratio      1

Transform      Position
     Frame      X pixels      Y pixels      Z pixels      
     0      356.006      270.637      0      
     1      357.534      269.087      0      
     2      358.118      264.868      0      
     3      363.94      263.778      0      
     4      364.682      263.464      0      
     5      353.781      268.166      0      
     6      361.781      273.339      0      
     7      354.7      264.606      0      
     8      358.354      263.514      0      
     9      359.743      264.946      0      
     10      358.644      272.881      0      
     11      359.628      267.893      0      


If somebody could help me understand how to use this data in processing to make a simple object move, it would be great.

Thanks,
Sumit
Re: After Effects keyframe data in Processing
Reply #1 - Jan 31st, 2010, 1:03pm
 
hmm, this sounds like an interesting idea.
I never tried AE but seeing that data i can imagine the possibilities.

is it also possible to know anything about the shapes or objects used in AE along with the animation ?

what about the music data. any chance to get access to it ?

PM me, i'm interested in giving this a go.
Re: After Effects keyframe data in Processing
Reply #2 - Jan 31st, 2010, 1:05pm
 
alright, first thing i did was edit your file by deleting all the unneeded stuff at the beginning.

you then got this :
    0      356.006      270.637      0      
    1      357.534      269.087      0      
    2      358.118      264.868      0  

first  there are 5 spaces, then the seperator is 6 spaces.
so we use the 6 spaces as seperator when creating our substring.

when loading the txt file we create an array of strings, everyline is a new string. we then divide this string into an array of substrings called pieces. [0] are the 5 spaces + frame, we dont need that. the [1],[2],[3] is the x,y,z, coordinates we use to draw our rect.

everyframe a new line/frame is loaded. using modulo i loop through the frames, so it starts again when reaching the end of your recorded frames.

hope that makes sense:


Code:
String[] lines;
void setup() {
size(500, 500);
background(0);
noStroke();
fill(255);
rectMode(CENTER);
frameRate(12);
lines = loadStrings("pos.txt");
}

void draw() {
background(0);

String[] pieces = split(lines[frameCount%lines.length], " ");

int x = int(pieces[1]) ;
int y = int(pieces[2]) ;
rect(x, y,10,10);

}







Re: After Effects keyframe data in Processing
Reply #3 - Feb 1st, 2010, 12:17am
 
@Cedric,

Thanks for replying back. That makes perfect sense to me. I'll try it out and let you know how it goes.

@V

I'm excited about this as well! Had my eureka moment last night, although I'm sure other people must've been using this technique. I have been using After Effects for 8 months now, and there's a plugin called Trapcode Soundkeys (not included with AE), which lets you analyze the music. There are ways to do this using the in-built AE plugins too ... but its not as accurate at times.

1. This Soundkey plugin lets you set up a a spectrum for the music in your composition (the AE stage) ... takes about 5 seconds.

2. Lets say you want to produce an animation which is reactive to the drum sound in your music file. Now, all you have to do is graphically select the region of the sound spectrum where the drum beats are formed (usually the left side).

3. Everytime there is activity on the left side of the spectrum, it records keyframes, which are nothing but numbers (and hence exportable to text files). These keyframes are then used to affect the motion, rotation, alpha ... infact any property of any object that is created!

I did a motion graphics piece a few months back using this technique and the in-built AE plugins. Google "Electronic Music is here to stay" ... a vimeo video will show up as the first result.

Pretty accurate. Compared to the beat reactive thing I've been trying with processing. The videos are all on my Vimeo page.
Re: After Effects keyframe data in Processing
Reply #4 - Feb 1st, 2010, 1:27am
 
Just curious, coult you load such a txt file the other way and load it into after effects? Just thinking about the ways to create some nice animations with processing generated coordinates...
Re: After Effects keyframe data in Processing
Reply #5 - Feb 1st, 2010, 6:05am
 
really intresting.

I just tested and it is possible to load back to after effects!

If you copy keyframes and paste them into a texteditor then you get something like show in first post

Quote:
Adobe After Effects 8.0 Keyframe Data

     Units Per Second      25
     Source Width      1
     Source Height      1
     Source Pixel Aspect Ratio      1
     Comp Pixel Aspect Ratio      1

Transform      Position
     Frame      X pixels      Y pixels      Z pixels      
     0      500      350      0      
     40      727.853      259.593      0      
     66      795.524      431.142      0      
     126      438      608      0      

Transform      Scale
     Frame      X percent      Y percent      Z percent      
     0      100      100      100      
     51      174.381      174.381      100.577      
     400      158      158      100.637      


End of Keyframe Data


if made some changes in textedit and pasted all back and it worked.

So for Sumit, it would be really nice if you take things like scale also in acount Smiley
Re: After Effects keyframe data in Processing
Reply #6 - Feb 1st, 2010, 6:49am
 
can anyone get a text file with all the features we can have from AE?
or atleast the ones needed for keyframe animation. taking into account keys, transformation(rot,scale,trans), size, color, object type ,etc

i don't have AE so i would appreciate an example file.

cheers,
Re: After Effects keyframe data in Processing
Reply #7 - Feb 1st, 2010, 9:42am
 
even every filter possible?

Here are all the Transform options:

Quote:
Adobe After Effects 8.0 Keyframe Data

     Units Per Second      25
     Source Width      1
     Source Height      1
     Source Pixel Aspect Ratio      1
     Comp Pixel Aspect Ratio      1

Transform      Anchor Point
     Frame      X pixels      Y pixels      Z pixels      
     0      0      0      0      
     126      0      0      0      

Transform      Position
     Frame      X pixels      Y pixels      Z pixels      
     0      500      350      0      
     126      500      350      0      

Transform      Scale
     Frame      X percent      Y percent      Z percent      
     0      100      100      100      
     126      100      100      100      

Transform      Rotation
     Frame      degrees      
     0      0      
     126      0      

Transform      Opacity
     Frame      percent      
     0      100      
     126      100      


End of Keyframe Data


I don't know if you guys ever worked with expressions?
There really awsome and it would be nice if they get included aswell.
With expresions you can control the rotation based on the scale values for example. So if you scale something bigger it will also rotate clockwise.

This is the code where is use the rotation for opacity, so if i rotate something it will get more or less transparent in after effects:

Quote:
Adobe After Effects 8.0 Keyframe Data

     Units Per Second      25
     Source Width      1
     Source Height      1
     Source Pixel Aspect Ratio      1
     Comp Pixel Aspect Ratio      1

Transform      Rotation
     Frame      degrees      
     0      0      
     126      0      

Transform      Opacity
     Frame      percent      
     0      100      
     126      100      

Expression Data
transform.opacity
End of Expression Data


End of Keyframe Data


From now on i won't past the begin info end the End of Expression Data line anymore cause it's prety clear.

For the position, if you press right mouse on it then you can choose to "seperate values" this can be very easy sometimes when using expressions.

Instand of:

Quote:
Transform      Position
     Frame      X pixels      Y pixels      Z pixels      
     0      500      350      0      
     126      500      350      0


it will change to:

Quote:
Transform      X Position
     Frame            
     0      500      
     126      500      

Transform      Y Position
     Frame            
     0      350      
     126      350      


rest in next post



Re: After Effects keyframe data in Processing
Reply #8 - Feb 1st, 2010, 10:59am
 
If you turn on the option 3d Layer then there comes a new option 'Orientation' and the option rotation changes in 3 options, 'X Rotation', 'Y Rotation', 'Z Rotation'. For the rest 'Anchor Point', 'Position', 'Scale' gets a third option for the z-property.

Here all the options for a 3d object (opacity is same as for 2d).
Quote:
Transform      Anchor Point
     Frame      X pixels      Y pixels      Z pixels      
     0      0      0      0      
     127      0      0      0      

Transform      Position
     Frame      X pixels      Y pixels      Z pixels      
     0      500      350      0      
     127      500      350      0      

Transform      Scale
     Frame      X percent      Y percent      Z percent      
     0      100      100      100      
     127      100      100      100      

Transform      Orientation
     Frame      X degrees      
     0      0      0      0      
     127      0      0      0      

Transform      Rotation
     Frame      degrees      
     0      0      
     127      0      

Transform      X Rotation
     Frame      degrees      
     0      0      
     127      0      

Transform      Y Rotation
     Frame      degrees      
     0      0      
     127      0      

Transform      Opacity
     Frame      percent      
     0      100      
     127      100      


I think it will be better to focus on effects later

I also tested keyframe interpelation like 'ease ease' but that info doesnt seem to be copied so this has to be set in after effects.

For the rest there are the following thigs that can be created with 'layer > new':

Quote:
text
solid
light
camera
null object
shape layer
adjustment layer
adobe photoshop file


The following have "Anchor Point, Position, Scale, Rotation, Opacity".

text
solid
null object
shape layer
adjustment layer
adobe photoshop file

only 'light' and 'camera' have the orientation and the x y z rotation by default + Point of Interest!!!

Quote:
Transform      Point of Interest
     Frame      X pixels      Y pixels      Z pixels      
     0      500      350      0      
     127      500      350      0      


If you need more ask me of what you want to know.
There are a lot more options but i think everything you have now is a good point to start.

p.s. the order doesn't matter, also this part isn't needed to paste back:

Quote:
     Units Per Second      25
     Source Width      1000
     Source Height      700
     Source Pixel Aspect Ratio      1
     Comp Pixel Aspect Ratio      1


I'm really intrested in what it will become, a easy to use library would be the best Cheesy
If would like to help, i'm quite good in after effects and i think the combination with processing can be awsome. I can show you work i made in AE if you want.  

Re: After Effects keyframe data in Processing
Reply #9 - Feb 1st, 2010, 12:29pm
 
ok here goes some thoughts.

i think its clearer to keep transformations together like:

Transform position
frame  X Y Z

Transform Scale
frame X Y Z




Now, as for the different type of objects:

How does the text file seperates the information per object ? Or is it a different text file per object in a scene/project ?


I'm more interested in a file format at this stage, rather than the actual information..

About cameras and lights:
orientation that might be 4 values that define a quaternion right? Can you confirm that? As for the point of interest i take it as a target point for target cameras and spot lights.

Any other properties for the cameras and lights?


OK, now that i've installed AE, i found how to get this information. copy an object and then paste over on a text file.

this brings me to a new world.
when generating data with an application it has to save a different text file for each object and then the user will paste that over the object in AE.
is there any other way to load all the data for N number of objects into AE ??


cheers,
Re: After Effects keyframe data in Processing
Reply #10 - Feb 1st, 2010, 1:44pm
 
Quote:
ok here goes some thoughts.

i think its clearer to keep transformations together like:

Transform position
frame  X Y Z

Transform Scale
frame X Y Z


For processing yes. For AE not always but it's quite easy to seperate in AE so no big deal.
Maybe there could be an export option so it does seperate once you export to txt but i would drop that on the bottem of future request. A case where it would be easy will be where you often make changes in processing and want them to test in AE, if seperate values are needed in AE for a expression then you will have to seperate everytime you trie the new code from processing.

Quote:
How does the text file seperates the information per object ? Or is it a different text file per object in a scene/project ?


It is a different textfile per layer. So if you have 20 images in processing for example and you want them to use all a different processing behaviour then you have to copy paste 20 times.

Quote:
About cameras and lights:
orientation that might be 4 values that define a quaternion right? Can you confirm that? As for the point of interest i take it as a target point for target cameras and spot lights.


orientation is 3 values and they are in degrees.
like:      0      22      33      301      
wher 0 is the frame.

for point of intrest, it's like translate in processing i belive

     Frame      X pixels      Y pixels      Z pixels      
     0      183      422      -596      


For the rest,

Camera Options:

Zoom
Focus Distance
Aperture
Blur Level

For the light there are different kinds of light so some have a few options and some more
Spot has all possible options which are:

Intensity
Color
Cone Angle
Cone Feather
Casts Shadows
Shadow Darkness
Shadow Diffusion


To get the information in a textfile, select the keyframes and then just copy paste.

If you look by effects then you have like 100 effects which can have keyframes aswell so doing them will give 1000 more things i guess.

(this is a good site for AE tuts:
www.creativecow.net)


Re: After Effects keyframe data in Processing
Reply #11 - Feb 1st, 2010, 5:04pm
 
ok. i think i get the picture. i will write a first prototype able to export some animations for different object types.

creating multiple text files is not a problem, the problem as i see it is the need to copy&paste all the text files to AE. If you find a better way to make it user friendly that would be nice.
Re: After Effects keyframe data in Processing
Reply #12 - Feb 1st, 2010, 11:56pm
 
Sumit wrote on Jan 31st, 2010, 12:25pm:
[...]I have read in this forum that it is nearly impossible to get real-time Beat Detection right in Processing.[...]

This was a bit surprising to me. Is it really Can you explain more about what that means I am also curious to know what you think you can do with Processing that is not possible in AE I am not familiar with AE, so it would be nice to know how it relates to an open source program like Processing, and what you think about it.

Cheers Smiley
Re: After Effects keyframe data in Processing
Reply #13 - Feb 2nd, 2010, 4:55am
 
Quote:
creating multiple text files is not a problem, the problem as i see it is the need to copy&paste all the text files to AE. If you find a better way to make it user friendly that would be nice.


I know nothing about AE scripting but it meight be possible to write a plugin or something.

maybe this helps:
http://help.adobe.com/en_US/AfterEffects/9.0/WSD2616887-A41E-4a39-85FE-957B9D2D3843.html#WS725e431141e7ba651172e0811eb8e35012-7ffe

maybe you can get some help from people that worked with AE scripts.
Re: After Effects keyframe data in Processing
Reply #14 - Feb 2nd, 2010, 10:31am
 
V wrote on Feb 1st, 2010, 5:04pm:
creating multiple text files is not a problem, the problem as i see it is the need to copy&paste all the text files to AE. If you find a better way to make it user friendly that would be nice.


A bit hacky, but I've written several AutoHotKey scripts to do variations on that. They can be built into executables (just scripts as resources on the autohotkey executable) but then you could probably launch it with processing's open command, however the solution would be Windows only.
Pages: 1 2