ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to loop but trim last couple of frames?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Xavier Paredes
Expression to loop but trim last couple of frames?
on Oct 25, 2018 at 4:03:45 pm

I have about 200+ videos. Each needs to be looped X amount of times. I have an expression (see below) that allows me to do this and it works just fine for [most] videos. Unfortunately, some videos have a couple of frames of black at the tail end so when I loop them using the expression, those black frames get included therefore they flash every time the loop happens.

The only way I know to prevent this is to trim the black from the videos in FCPX and re-export them.

I'm wondering if there's a better expression so I don't have to trim and re-export in FCP.

I'm on a tight deadline :/

Thanks for any help!

nLoops = 100;
if (numKeys > 1){
loopDur = key(numKeys).time - key(1).time;
n = Math.floor((time - key(1).time)/loopDur);
if (n &lt; nLoops){
t = (time - key(1).time)%loopDur;
valueAtTime(key(1).time + t);
}else{
valueAtTime(key(numKeys).time);
}
}else
value;


Xavier


Return to posts index

Dan Ebberts
Re: Expression to loop but trim last couple of frames?
on Oct 25, 2018 at 4:18:26 pm

This is a time remapping expression, yes? One thing you could do would be to move the Current Time Indicator to the last good frame, and set a keyframe there, and then delete the last keyframe. Give that a try.

Dan



Return to posts index

Xavier Paredes
Re: Expression to loop but trim last couple of frames?
on Oct 25, 2018 at 5:55:37 pm

Hi Dan,

Your solution works! Interesting though, It's basically the same thing I was doing. The only difference is that I have to move the keyframe [before] I extend the layer. If I extend the layer first and then I move the keyframe, the black frames will show. I don't understand why but Oh well! ¯\_(ツ)_/¯.

Thanks!.

Xavier


Return to posts index


Dan Ebberts
Re: Expression to loop but trim last couple of frames?
on Oct 25, 2018 at 5:58:54 pm

You're not actually moving the keyframe, right? You should be creating a new one a couple frames earlier than the last one then deleting the last one.

Dan



Return to posts index

Xavier Paredes
Re: Expression to loop but trim last couple of frames?
on Oct 26, 2018 at 2:59:46 pm

Uhhhh... I actually was just moving the last keyframe and it works (so long as I do this first before I extend the layer)...

But I also tried (as you suggested) creating a new keyframe on the last good picture frame of the videos and this works as well.

I'm going to stick to your most recent advice.

Thanks so much!

Xavier


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]