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

convert time to timecode in extendscript?

Community Beginner ,
Jul 02, 2021 Jul 02, 2021

how convert time to timecode in extendscript?

for example:

1.5 sec convert to 01:15 in composition 30 framerate

TOPICS
How to , Scripting
871
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
Enthusiast ,
Jul 02, 2021 Jul 02, 2021
LATEST

You can find 'timeToCurrentFormat' here:

https://ae-scripting.docsforadobe.dev/general/globals/

 

You would need to make sure the project is set to display timecode not frames (Project.timeDisplayType), like here:

https://ae-scripting.docsforadobe.dev/general/project/#project-timedisplaytype

 

Make sure you read up on the docs about whether it calculates it as a duration or based on the project start frame.

 

This example will convert display type to timecode if necessary, make the conversion, then convert display type back if necessary.

 

var displayFrames = false;
if (app.project.timeDisplayType!= TimeDisplayType.TIMECODE) {
	app.project.timeDisplayType = TimeDisplayType.TIMECODE;
	displayFrames = true;
}
var theTime = 1.5;
var theFPS = 30; // obviously you could grab this from an active comp instead, assuming one was active

var theTimecode = timeToCurrentFormat(theTime, theFPS, true);

alert(theTimecode);

if (displayFrames) app.project.timeDisplayType = TimeDisplayType.FRAMES;
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