Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Getting Embedded timecode from Clip by script

Community Beginner ,
Feb 21, 2021 Feb 21, 2021

Hi folks
I'm hitting a wall here and I was hoping someone could help.
I'm trying to export a simple text-file of the in- and out-point of a clip used in a composition. BUT I need that in- and out-point to be using the sources embedded timecode, which starts and something like frame 22000.

So while the in-and-out of the layer/clip in the composition is 200-500, what I need saved out is 22200-22500. I can see that AfterEffects can read the meta-data since it shows the embedded timecode in the project-item view and in the footage view.

But I can't figure out how to get the info by scripting in extendscript.
I've gotten this far that I got the in-out of the selected layer in the active composition, and I can find the source of the footage, so all I really need is the start frame of the embedded timecode from the source. Writing and saving out a file is not a problem either, even though its not in the current script.

 

Heres an example of the script, run from Extend Script ToolKit:
function Run(){
var cur_comp = app.project.activeItem;
var cur_layer = cur_comp.selectedLayers[0];
$.write(cur_layer.name + "\n");
cur_in = cur_layer.inPoint;
cur_out = cur_layer.outPoint;
$.write("IN: " + cur_in + "-OUT: " + cur_out + "\n");
var cur_source = cur_layer.source;
full_duration = cur_source.duration;
$.write(cur_source);
return cur_source
}

 

So if anyone can help me here it would be much appriciated 🙂

TOPICS
How to , Scripting
794
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 21, 2021 Feb 21, 2021

Hey, what you most likely have to do, is to use not only inPoint of a layer, but also take into account startTime (assuming, that layer is trimmed).

 

Thus, try accessing [layer].starTime and calculating the IN's based on both - startTime and layer's inPoint. That way, you should get actual and INs and OUTs. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 21, 2021 Feb 21, 2021

You have to calculate it yourself or cheat it by using effects like the Timecode effect. AFAIK metadata can only be accessed via the C++ API and unless it generates an accessible property is not available for scripts.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 23, 2021 Feb 23, 2021

Hi guys! Thanks for your suggestions 🙂

I ended up using ffmpeg/ffprobe, which is a seperate program, to get the timecode of the metadata. I call it from AfterEffects with system.callSystem().
It looks something like this:

for_mxf = system.callSystem("ffprobe -v error -show_entries format_tags=timecode -of default=\"noprint_wrappers=1:nokey=1\" -i \""+file_path+"\"");
for_mp4 = system.callSystem("ffprobe -v error -show_entries stream_tags=timecode -of default=\"noprint_wrappers=1:nokey=1\" -i \""+file_path+"\"");

 

That gives me a 00:00:00:00 timecode. If it can find it of course.
I hope this helps anyone else running into the same issue 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 22, 2023 Jun 22, 2023
LATEST

Hi, I know time has passed and you probably doesn't need this no more, but it seems I found a workaround to recover the embedded timecode of a footage.
I duplicate the layer, then I precompose it without moving the attributes. This way I can access the TC of the comp that is generated automatically from the source footage. After that I delete the precomp I created both from timeline and project.
Here's a sample code:

// duplicate the layer
selectedLayer.duplicate();

// precompose the new layer leaving attributes
activeComp.layers.precompose(selectedLayer.index], "TempTCPrecomp", false);

// obtains the footage in timecode
sourceTC = selectedLayer.source.displayStartTime;

// gets selected layer source (comp object in project)
var tempCompSource = selectedLayer.source;

// deletes the layer in timeline
selectedLayer.remove();

// deletes the comp from project
tempCompSource.remove();

Have a nice scripting.
Matteo

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines