Skip to main content
Known Participant
February 28, 2024
Answered

Extract the content and its respective time from the video

  • February 28, 2024
  • 1 reply
  • 282 views

Hi team,
We are requesting the script for extract the content and its respective time from the video (see below screenshot highlighted portion), for that we are developing the scripts (placed here). We got the output in seconds, but we are required the format (0:00:01:02) as same in the screenshot.

As our understanding we have the problem in the line 

"textInfoArray.push(copy + "\t" + currentLayer.inPoint + "\t" + currentLayer.outPoint);"
 

Can you please help us to get content and its respective time in required format (0:00:01:02) as in the after effects.

 

var comp = app.project.activeItem;
var layers = comp.layers;

var textInfoArray = [];

for (var i = 1; i <= layers.length; i++) {
    var currentLayer = layers[i];

    if (currentLayer instanceof TextLayer) {
        if(currentLayer.enabled == true) {

            var textProperties = currentLayer.property("Text");

            for (var j = 1; j <= textProperties.numProperties; j++) {
                var textProperty = textProperties.property(j);

                if (textProperty.matchName === "ADBE Text Document") {
                    var textDocument = textProperty.value;
                    var copy = textDocument.text.replace("\r", " ", "gi");

                    textInfoArray.push(copy + "\t" + currentLayer.inPoint + "\t" + currentLayer.outPoint);
                }
            }
        }
    }
}
$.writeln(textInfoArray);


Thanks

 

This topic has been closed for replies.
Correct answer Airweb_AE

You need to use timeToCurrentFormat()

 

textInfoArray.push(copy + "\t" +
timeToCurrentFormat(currentLayer.inPoint, comp.frameRate) + "\t" +
timeToCurrentFormat(currentLayer.outPoint, comp.frameRate));

  

1 reply

Airweb_AECorrect answer
Legend
February 28, 2024

You need to use timeToCurrentFormat()

 

textInfoArray.push(copy + "\t" +
timeToCurrentFormat(currentLayer.inPoint, comp.frameRate) + "\t" +
timeToCurrentFormat(currentLayer.outPoint, comp.frameRate));

  

AsuvathAuthor
Known Participant
February 28, 2024

Hi @Airweb_AE ,

Thank you so much. It is working. 

Can you please advise any guide to refer this kind of issue.

Thanks
Asuvath