621

4
Q:

## Calculate Video Duration

I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds.

+2  A:

Looks like the numbers are in milliseconds. So to convert to seconds, divide by 1000, then divide by 60 to find minutes etc.

A:

I'm not sure if I completely understand this, but:

`````` 70966 / 70 seconds = 1013.8
``````

So dividing the "value" by 1013.8 should get the duration, approximately...

Edit: Yes, Ben is right, you should divide by 1000. I got 1013.8 because the 70 seconds was rounded down from 70.966 seconds to 70.

A:

To expand on what Ben said, it looks like they are milliseconds, and the display value is rounded slightly, possibly to the nearest 100 milliseconds and then 'cropped' to seconds. This would explain why 30533 is 30s and 70966 is 70s.

A:

It's a simple matter of division:

• 70966 / 70 seconds (1:10 minutes) = 1013.8
• 30533 / 30 = 1017.76
• 7007 / 7 = 1001

Looks like the numbers are nothing but milliseconds. 70966 displays as 1:10 minutes because it shaves of the millisecond part (last 3 digits).