Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random jump cuts with fade/dissolve~ time remapping

  • Random jump cuts with fade/dissolve~ time remapping

    Posted by Anna Hahn on December 17, 2018 at 2:57 am

    Hello

    I am currently using the expression below with time remapping to jump cut to a new position within a clip every .44 seconds

    How can I alter this expression code such that rather than making jump cuts, it randomly fades/cross dissolves into a different position within the clip? Is there a way to do this such that I have control over the duration of the dissolve?

    Thank you so much!!

    segDur = .44;// duration of each "segment" of random time
    minVal = inPoint;
    maxVal = outPoint - segDur;

    seed = Math.floor(time/segDur);
    segStart = seed*segDur;
    seedRandom(seed,true);
    startVal = random(minVal,maxVal);
    endVal = startVal + segDur;
    linear(time,segStart,segStart + segDur, startVal, endVal);

    Dan Ebberts replied 7 years, 4 months ago 3 Members · 9 Replies
  • 9 Replies
  • Kalleheikki Kannisto

    December 17, 2018 at 12:51 pm

    It requires two layers to cross fade the video, so you would need a setup where both videos changed randomly every .88 seconds, with one of them offset by .44 seconds (or minimally by the duration of the fade). Then you need an expression for the fade (transparency) of the top layer that happens every .44 seconds, alternating between fading from 0 to 100 and 100 to 0. The alternating fade is a bit of a challenge. I’m thinking it might be along these lines:
    linear(Math.abs(time-Math.round(time/.88)*.88), .44-fadetime/2, .44+fadetime/2,0,100)
    You’d have to define the variable “fadetime” and it can’t be more than .44 sec.
    That formula has a good chance of being wrong. Also, it needs to use the time value without time remapping, so you may have to source it from a different layer that doesn’t have time remapping applied to it.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Anna Hahn

    December 17, 2018 at 3:38 pm

    Hi Kalleheikki!

    Thank you so much for this!! Sorry to be so useless but I am a little confused how to go about implementing what you describe in a new expression. Would you mind showing me what the new expression codes would look like and how I would go about applying them in the dual layer setup you describe?

    Again thank you so so much!!

    Cheers!
    Anna

  • Dan Ebberts

    December 17, 2018 at 5:16 pm

    You might want to add a little time to segment duration in the original expression to account for the fade:

    segDur = .69;// duration of each “segment” of random time
    minVal = inPoint;
    maxVal = outPoint – segDur;
    seed = Math.floor(time/segDur);
    segStart = seed*segDur;
    seedRandom(seed,true);
    startVal = random(minVal,maxVal);
    endVal = startVal + segDur;
    linear(time,segStart,segStart + segDur, startVal, endVal);

    Then you need an opacity expression for that layer:

    segDur = .69;
    fadeDur = .25;
    t = time%segDur;
    linear(t,0,fadeDur,0,100);

    Finally, you need to add another copy of the original clip below the first one, with this time remapping expression:

    fadeDur = .25;
    thisComp.layer(index-1).timeRemap.valueAtTime(time – fadeDur) + fadeDur

    If you adjust the values, just make sure that the segDur and fadeDur values are consistent across the three expressions (or time them to sliders) and that fadeDur is less than segDur.

    Dan

  • Anna Hahn

    December 22, 2018 at 6:28 pm

    Thank you so so much for this thorough walk through this works beautifully!

    One question~ when I am rendering clips of this out with the above scripts the renders take crazzzzzzy long~ just to do a single minute of footage I am getting 59 minute render times. Is there anything I can do to rework the script or the way it renders to make it faster? With the same render settings other clips render very quickly so there must be something particularly taxing about what this script requires?

    Thank you so much!

  • Dan Ebberts

    December 22, 2018 at 7:10 pm

    You could try converting the expressions to keyframes before rendering (Animation > Keyframe Assistant > Convert Expression to Keyframes).

    Dan

  • Anna Hahn

    December 23, 2018 at 6:30 pm

    Hmmmm thank you but that didn’t seem to help

    Any other ideas for speeding up the render? I’m confused why this would take a long time to process… it seems like skipping around the timeline/shifting the opacity wouldn’t be particularly taxing computations?

  • Dan Ebberts

    December 23, 2018 at 6:36 pm

    Do you mean is doesn’t render faster with the expressions converted to keyframes, or that it takes a long time to do the conversion?

    Dan

  • Anna Hahn

    December 23, 2018 at 6:46 pm

    The conversion happens relatively quickly about 30 seconds per expression, I meant that converting the expressions to keyframes does not help anything to render any faster

  • Dan Ebberts

    December 23, 2018 at 7:09 pm

    That really surprises me, but I’m no expert on rendering. Maybe somebody will jump in with a better idea.

    Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy