Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE script for Premiere subtitles

  • AE script for Premiere subtitles

    Posted by Sean Jahnig on September 2, 2014 at 4:28 am

    Hi,

    I found a script online that reads the metadata of an audio file (which was previously analysed by Premiere) and extracts the text from it, placing it into an empty text holder in After Effects at the exact time that the text should be appearing. It displays line-by-line with a maximum of 10 words at a time. It’s a very smart little script and works well.

    I’ve contacted the author to ask for help from him, but thought i’d post here too.

    I’m looking for a way to modify the script slightly so that when extracting text from the metadata and displaying it on-screen, it detects when there is a full stop (ie. end of the sentence) and then saves it for a new line, when it is time for that to be shown. If no full stop is found, then it continues to display a max. of 10 words to fill the line.

    Thanks in advance,
    Sean.

    L = thisComp.layer("posetivity_voice_1.aac");
    max = 10; // number of words to display
    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

    Sean Jahnig replied 11 years, 8 months ago 2 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    September 2, 2014 at 5:40 am

    How would it recognize a full stop?

    Dan

  • Sean Jahnig

    September 2, 2014 at 5:48 am

    Thanks for the reply… Forgive my ignorance, but surely when searching through the text metadata in-which the full stops reside the specific character could be identified? Unfortunately i’m not a code pro so can’t do more than just think of such an argument logically, like an if then else type statement.

  • Dan Ebberts

    September 2, 2014 at 5:52 am

    What gets passed from Premiere to AE comes in as markers, with each transcribed word in a separate marker comment. That’s really all the information there is, except the marker timing info.

    Dan

  • Sean Jahnig

    September 2, 2014 at 6:31 am

    Ah ok. Thanks Dan.

    Is there anyway of editing that metadata directly? Because working with the text in Premiere is limiting.

    Appreciate the help – thanks.

  • Dan Ebberts

    September 2, 2014 at 6:55 am

    I would say it’s likely. AE scripting has access to the XMP JavaScript library, so I would think you’d be able to access the audio file’s metadata, edit it, and save it. I haven’t tried that specifically, but it seems like it should work.

    Dan

  • Sean Jahnig

    September 2, 2014 at 7:30 am

    Thanks Dan,

    I’ll have to bookmark this project until i have time to fiddle with it. For the moment it seems easier to just inset subtitles manually, where i’ll have full control.

    Appreciate the help.

    Sean.

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