Copy link to clipboard
Copied
I'm trying to get the correctly formatted start and end times (hh:mm:ss:ff) of clips within a sequence using the Premiere Pro scripting API. I have the seconds and ticks values for the inPoint and outPoint (or end) properties of the clips, but I'm having trouble converting them to the correct timecode format.
Here's what I'm doing:
formatTime function (simplified example) function formatTime(ticks, fps) { // ... calculations to convert ticks and fps to hh:mm:ss:ff ... } var sequence = app.project.activeSequence; var fps = sequence.frameRate; // ... (loop through clips) ... var startTime = formatTime(clip.inPoint.ticks, fps); var endTime = formatTime(clip.outPoint ? clip.outPoint.ticks : clip.end.ticks, fps); $.writeln("Clip " + clip.name + " Start Time:", startTime); $.writeln("Clip " + clip.name + " End Time:", endTime);
I'm using the sequence's frame rate (sequence.frameRate) as the fps value in the formatTime function. However, the resulting timecodes are not matching what's displayed in the Premiere Pro timeline. [Provide specific examples of the discrepancies, e.g., "The timeline shows 10:00:06:18, but the script returns 00:00:05:10".]
I've also tried using the Time.getFormatted() method, but I'm getting an "illegal parameter" error. [If you've tried getFormatted(), include the code you used and the exact error message.]
Could someone please advise on the correct way to convert seconds and ticks to hh:mm:ss:ff format that matches the Premiere Pro timeline display? I'm particularly interested in ensuring the frame values are accurate. Any help would be greatly appreciated.
Additional Information to Include:
The more detail you provide, the better others can understand the problem and offer solutions.
> I've also tried using the Time.getFormatted() method, but I'm getting an "illegal parameter" error.
Failing code snippet, please?
Time objects are 100% the right approach.
Copy link to clipboard
Copied
Hi @sekar_saravanaa,
Thanks for the message and welcome to our forum. I have edited the label for your post as "SDK" so it will draw the appropriate attention to those that might be able to reply more readily. I hope that's OK. In the future, you may want to do the same, should you have more scripting related questions. I hope we can help you shortly. Sorry for the hassle.
Thanks,
Kevin
Copy link to clipboard
Copied
> I've also tried using the Time.getFormatted() method, but I'm getting an "illegal parameter" error.
Failing code snippet, please?
Time objects are 100% the right approach.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now