Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Setting the In and Out points of a text layer to align with markers via a script

  • Setting the In and Out points of a text layer to align with markers via a script

    Posted by Adam Walker on October 20, 2019 at 10:59 pm

    Hey all,

    I’m looking into automating subtitle placement using text layers and markers.

    My process is to RAM preview the video, and apply markers to a null layer as i play through the video at each point where a subtitle should be displayed.

    At the moment I have been manually placing the text layer’s in-point on the designated marker and then dragging the out-point of said text layer to the following marker, then placing the next text layer’s in point to this marker and dragging the outpoint to the next layer and repeating for each text layer and marker going along.

    This process is not too time consuming at the moment but when the text layers/subs start stacking up it becomes a little tedious and if this could be automated then it would be a dream!

    I have uploaded a screen shot to better represent what I mean.
    https://f1.creativecow.net/file.php?id=13832&folder=text-layer-alignment-to-markers

    My Javascript xp is basically non existent (but i’m working on it) so I am really struggling to put something together from things I have seen in the forum.

    I have seen a script to find the “timecode” of a marker, but I’m not sure how to make it work for what I want.

    Hope this is doable, thanks in advanced!

    Adam

    Adam Walker replied 6 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    October 20, 2019 at 11:31 pm

    This is a very basic example, tailored to your screen shot. It needs additional error checking etc. (e.g. to make sure a comp is selected, there are enough markers, etc.) but it should give you the idea:


    var myComp = app.project.activeItem;
    var markerLayer = myComp.layer(1);
    var t;
    for (var i = 2; i <= myComp.numLayers; i++){
    t = markerLayer.property("Marker").keyTime(i-1);
    myComp.layer(i).inPoint = t;
    if (i != 2){
    myComp.layer(i-1).outPoint = t;
    }
    }

    Dan

  • Adam Walker

    October 21, 2019 at 9:11 pm

    As always Dan, this is brilliant and works perfectly for what I need.

    Thank you once again!

    Adam

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