function convert($input, $outputdir = "files/File/", $output, $width = 320, $height = 240, $samplerate = 22050, $bitrate = 32) { vendor('ffmpeg'); define('OS_WINDOWS', false); $ffmpeg = new ffmpeg(); $ffmpeg->on_error_die = FALSE; $ok = $ffmpeg->setInputFile($input); if (!$ok) { // if there was an error then get it echo $ffmpeg->getLastError() . "<br />\r\n"; $ffmpeg->reset(); continue; } $ffmpeg->setVideoOutputDimensions($width, $height); $ffmpeg->setFormatToFLV($samplerate, $bitrate); $ok = $ffmpeg->setOutput($outputdir, $output . '.flv', TRUE); // check the return value in-case of error if (!$ok) { // if there was an error then get it echo $ffmpeg->getLastError() . "<br />\r\n"; $ffmpeg->reset(); continue; } $result = $ffmpeg->execute(TRUE); if (!$result) { // if there was an error then get it echo $ffmpeg->getLastError() . "<br />\r\n"; $ffmpeg->reset(); continue; } // reset $ffmpeg->reset(); }