getId3以秒为单位获取视频持续时间



如何获得getId3的playtime_string持续时间(以秒为单位(?有没有直接在几秒钟内到达?不使用其他php函数查看字符串并将其从值中提取?

<?php require_once('getid3/getid3.php');
$filename='uploads/4thofJuly_184.mp4';
$getID3 = new getID3;
$file = $getID3->analyze($filename);
echo("Duration: ".$file['playtime_string'].
" / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall".
" / Filesize: ".$file['filesize']." bytes<br />");
$getID3 = new getID3;
$filename='uploads/25PercentOff_710.wmv';
$file = $getID3->analyze($filename);
echo("Duration: ".$file['playtime_string'].
" / Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall".
" / Filesize: ".$file['filesize']." bytes<br />");
// Calling getimagesize() function 
$filename="uploads/25PercentOff_960.jpg";
list($width, $height) = getimagesize($filename); 
// Displaying dimensions of the image 
echo "Width of image : " . $width . "<br>"; 
echo "Height of image : " . $height . "<br>"; 

在这种情况下,使用$file['playtime_seconds'],它将直接给您带小数点的秒数。您可以使用php的round()floor()函数对其进行格式化,具体取决于您希望其显示的方式。

对此有一个非常简单的答案:不使用$file['playtime_string']仅使用:$file['playtime_seconds']

相关内容

  • 没有找到相关文章

最新更新