Времетраене на видео?

PHP:
$file= "127808825101 Track 1.wma";
ob_start();

passthru("ffmpeg.exe -i \"{$file}\" 2>&1");  //path to your ffmpeg.exe
$duration = ob_get_contents();
ob_end_clean();

//the full output:
//echo $duration."<br/>";

$search='/Duration: (.*?)[.]/';
$duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE);
$duration = $matches[1][0];

//i suppose that our <strong class="highlight">video</strong> hasn't duration of a day+ :
list($hours, $mins, $secs) = split('[:]', $duration);

echo "Hours: ".$hours." Minutes: ".$mins." Seconds: ".$secs;
http://www.daniweb.com/web-development/php/threads/66420
 
ето ако го направиш така .. ще ти изкарва 00:43 и така .. :) а не 00:55:40 :D
Код:
ob_start();	
				passthru(\"ffmpeg -i $file 2>&1\");
				$duration = ob_get_contents();
				ob_end_clean();

				$search=\'/Duration: (.*?),/\';
				$duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 2);
				$time = $matches[1][0];
				$time = explode(\'.\',$time);
				$time =  $time[0];
				$VideoDuration =  sprintf(\"%0\".\"$time\",\"\"); 
echo $VideoDuration;
 

Back
Горе