Quantcast
Channel: Adobe Community : Popular Discussions - Premiere Pro SDK
Viewing all articles
Browse latest Browse all 53010

Convert timecodes to seconds

$
0
0

Is there a method to convert timecode(hh:mm:ss:ff) to seconds ?

 

I'm trying to create a marker using markers.CreateMarker() method but for some reasons the supplied value in seconds doesn't match input timecodes.

For e.g. I have a timecode 00:03:00:00 on a 29.97fps(Non-drop frame). In order to convert it into seconds,

 

var a = time.split(':');

var seconds = ((Number(a[0])* 3600) + (Number(a[1]) * 60) + Number(a[2]));

var milliseconds = (Number(a[3])/ fps);   // fps is 29.97

var result = seconds + parseFloat(milliseconds,5); 

 

Result here is 180 seconds. Premiere shows this timecode as :

 

Non-Drop frame

In: 00:02:59:24 , which is 5 frames behind.

 

Drop frames gives me slightly better results

In: 00:02:59:28, which is 2 frames behind.


Please suggest.



Viewing all articles
Browse latest Browse all 53010

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>