我想在php中使用声音库进行项目。 像
这样的neeed功能是最好的PECL套装吗? 任何github或sourceforge项目?
答案 0 :(得分:2)
单独使用PHP无法正确进行音频处理,您应该看看以下内容:
您可以使用shell_exec();
更好的选择是运行cron
作业进行批处理。
答案 1 :(得分:0)
您可以使用此库从音乐文件getID3()
中获取idv3信息这样的事情:
<?
require_once('../getid3/getid3.php');
// Initialize getID3 engine
$getID3 = new getID3;
// Analyze file and store returned data in $ThisFileInfo
$ThisFileInfo = $getID3->analyze($filename);
/*
Optional: copies data from all subarrays of [tags] into [comments] so
metadata is all available in one location for all tag formats
metainformation is always available under [tags] even if this is not called
*/
getid3_lib::CopyTagsToComments($ThisFileInfo);
echo $ThisFileInfo['comments_html']['artist'][0]; // artist from any/all available tag formats
echo $ThisFileInfo['tags']['id3v2']['title'][0]; // title from ID3v2
echo $ThisFileInfo['audio']['bitrate']; // audio bitrate
echo $ThisFileInfo['playtime_string']; // playtime in minutes:seconds, formatted string
/*
if you want to see ALL the output, uncomment this line:
*/
echo '<pre>'.htmlentities(print_r($ThisFileInfo, true)).'</pre>';
?>
如果您要重新取样/重新编码音乐文件,可以使用LAME执行此操作。
Fixed bit rate 128kbps encoding:
lame sample.wav sample.mp3
Fixed bit rate jstereo 128kbps encoding, high quality (recommended):
lame -h sample.wav sample.mp3
Average bit rate 112kbps encoding:
lame --abr 112 sample.wav sample.mp3
Fast encode, low quality (no psycho-acoustics):
lame -f sample.wav sample.mp3
Variable bitrate (use -V n to adjust quality/filesize):
lame -h -V 6 sample.wav sample.mp3