How do I convert time in the format '00:04:13.67' to seconds?

raijazz

New Member
basically i have a variable that holds a time value, in this format '00:04:13.67'. I need a short and simple php function to convert that to seconds. What i'm ultimately tring to do is get the duration of videos i have stored on a amazon cloud front using ffmpeg, but ffmpeg returns duration in unwanted format "hours:minutes:seconds.decimals" i need time in seconds.here's my code if any has a simpler or cleaner solution i'd appreciate it very much\[code\]$videofile="http://123abc.cloudfront.net/test.flv";ob_start();passthru("/usr/bin/ffmpeg -i \"{$videofile}\" 2>&1");$duration = ob_get_contents();ob_end_clean();$duration=preg_match('/Duration: (.*?),/', $duration, $matches, PREG_OFFSET_CAPTURE, 3);//TEST ECHOecho $matches[1][0];\[/code\]
 
Back
Top