Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE Expressions and Subtitles

  • AE Expressions and Subtitles

    Posted by Jennifer Arani on March 15, 2013 at 7:28 pm

    Hello,
    I found a tutorial on how to bring in the speech/text metadata from premier to AE and then assign an expression to display the text 5 words at a time.
    The good news is that I got the script to work and work very well. The bad news is that the script will look for and display 5 words at a time. But there are pauses and music in between some scenes. I need to either add or adjust the script so that I can either have it look for some kind of end cap or notation so that it will, for example, show only 3 words. Stop displaying any text until it sees a second notation that tells it to start displaying it again.

    Any help would be appreciated! If not I will have to copy and paste the script for like 20 videos!

    Here is a link to the tutorial – https://www.realeyes.com/blog/2010/03/05/caption/

    And a copy of the script (adjusted for CS6 and per the instructions in the tutorial)
    L = thisComp.layer(“Module1.mov”);
    max = 9;
    n = 0;
    if (L.marker.numKeys > 0) {
    n = L.marker.nearestKey(time).index;
    if (L.marker.key(n).time > time) {
    n–;
    }
    }
    s = ” “;
    if (n> 0){
    base = Math.floor((n-1)/max)*max + 1;
    for (i = base; i < base + max; i++){
    if (i <= L.marker.numKeys){
    s += L.marker.key(i).comment + ” “;
    }
    }
    }
    s

    Thank you!

    Jennifer Arani

    Yousaf Bashir replied 13 years, 4 months ago 3 Members · 5 Replies
  • 5 Replies
  • Dan Ebberts

    March 15, 2013 at 10:48 pm

    That makes it a much more complicated expression. The one in the tutorial is fairly simple-minded in its five-words-at-time approach. This variation looks for gaps in the markers (set to two seconds in this example). If the gap has been exceeded without a marker, the output is blank. The expression won’t cross a gap (in either direction) to add words to the current phrase.


    L = thisComp.layer("Module1.mov");
    max = 9;
    gap = 2;
    n = 0;
    if (L.marker.numKeys > 0) {
    n = L.marker.nearestKey(time).index;
    if (L.marker.key(n).time > time) n--;
    }
    s = " ";
    if (n> 0){
    if (time - L.marker.key(n).time < gap){
    curT = L.marker.key(n).time;
    i = n-1;
    while(i > 0){
    newT = L.marker.key(i).time;
    if (curT - newT > gap) break;
    curT = newT;
    i--;
    }
    i++;
    base = n - (n-i)%max;
    curT = L.marker.key(base).time;
    for (j = base; j < base+max; j++){
    if (j <= L.marker.numKeys){
    if (L.marker.key(j).time - curT > gap)break;
    s += L.marker.key(j).comment + " ";
    curT = L.marker.key(j).time;
    }
    }
    }
    }
    s

    Dan

  • Jennifer Arani

    March 15, 2013 at 10:52 pm

    Dan EBBERTS IS AWESOME!!!!!!

    Dude you made my day, my week, you don’t know!

    Thank you!!!!!

    Jennifer Arani

  • Jennifer Arani

    March 19, 2013 at 5:11 pm

    DAN! I hope you see this message!

    The script works but I am having major issues with it dropping words. If the highlighter skips the text in Premier it skips the marker in AE as well. I made some items work using the merge with previous word but it doesn’t always work. I’ve verified that the markers are not on top of each other and adjusted the length to both shorten and lengthen. I have tried adding markers and also going back to Premier and trying to fix there.

    Either way I am wonder if there is a way for the script to see markers that I added myself? I’m so frustrated!

    Jennifer Arani

  • Dan Ebberts

    March 19, 2013 at 7:23 pm

    Are you talking about the gap-skipping expression I posted previously? When I was testing it I only used markers that I had added by hand. I don’t see how the expression could be skipping markers, although I didn’t test it very thoroughly.

    Dan

  • Yousaf Bashir

    April 8, 2013 at 9:49 pm

    hi how would i make the text fade in and out after each section or could you direct me to other useful articles on this subject.
    thanks for your time

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