我正在尝试使用Lame和php包装器phplame将.wav转换为.mp3。当我运行下面的脚本时,我收到以下内容:
string(151) "LAME execution error! command: `/usr/bin/lame --preset standard 'lametest.wav' 'lametest.mp3'`, error: `Can't init outfile 'lametest.mp3' `, code: 255"
lametest.php:
<?php
require 'vendor/autoload.php';
use Lame\Lame;
use Lame\Settings;
// encoding type
$encoding = new Settings\Encoding\Preset();
$encoding->setType(Settings\Encoding\Preset::TYPE_STANDARD);
// lame settings
$settings = new Settings\Settings($encoding);
// lame wrapper
$lame = new Lame('/usr/bin/lame', $settings);
try {
$lame->encode("lametest.wav",
"lametest.mp3");
} catch(\RuntimeException $e) {
var_dump($e->getMessage());
}
?>
答案 0 :(得分:0)
这是一个权限问题我必须将输出文件夹的权限授予用户www-data。这个链接对我有帮助 http://ycsoftware.net/cant-init-outfile-ycsoftware-mp3/