Search code examples
phpmathtimeintegeritunes

Trouble with iTunes XML duration column


I'm having trouble with the iTunes XML duration column. I'm trying to figure out exactly what this integer is so I can accurately determine the minutes and seconds duration of an mp3.

The integer for a specific MP3 in a field labeled "Total Time" is 2005812. The MP3 is actually 33:26 according to iTunes. Any ideas on what format this is? How should I go about figuring this out?

I found some documentation online to say to do something like this:

    $minutes = bcmod(($sermon['duration'] / 60), 60);
    $seconds = bcmod($sermon['duration'], 60);

The problem is that it comes out being about 10 minutes long, which isn't accurate.


Solution

  • If I count (33*60+26)*1000 = 2006000 it leads me to think that your value is a length in miliseconds :).