I am attempting to convert a .wav to .mp3 using Lame and the php wrapper phplame. When I run the script below I recieve the following:
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());
}
?>
It was a permissions issue I had to give permission of output folder to user www-data. This link helped me http://ycsoftware.net/cant-init-outfile-ycsoftware-mp3/