有没有什么PHP函数可以给我MP3的持续时间。我查看了id3函数,但我没有看到任何关于持续时间的东西,除此之外,id3是一种标记,它不会出现在所有的MP3中,所以使用它没有任何意义。
发布于 2012-08-21 18:44:11
这应该适用于您,请注意getduration函数:http://www.zedwood.com/article/127/php-calculate-duration-of-mp3
发布于 2012-08-21 18:42:55
安装getid3,但如果您只需要持续时间,则可以删除除以下模块之外的所有模块:
使用如下代码访问持续时间:
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($pathName);
$len= @$ThisFileInfo['playtime_string']; // playtime in minutes:seconds, formatted string在Sourceforge上获得它
发布于 2017-05-13 13:57:59
我已经过了这么多时间,但是没有getID3 (http://getid3.sourceforge.net/)来获取音频文件的持续时间是不可能的。
1)首先使用下面的链接下载getID3库:
https://github.com/JamesHeinrich/getID3/archive/master.zip2)尝试下面的代码:
<?php
include("getid3/getid3.php");
$filename = 'bcd4ecc6bf521da9b9a2d8b9616d1505.wav';
$getID3 = new getID3;
$file = $getID3->analyze($filename);
$playtime_seconds = $file['playtime_seconds'];
echo gmdate("H:i:s", $playtime_seconds);
?>https://stackoverflow.com/questions/12053125
复制相似问题