fmpeg convert video format

by Prakash 2013-06-28 16:44:34

Use the following function to convert a video to a given format :

/**
* convert a video to the given format
* @param string format name
* @return true on success else false
*/
function convertToFormat($type){
$savingname = "output.{$type}";
$command = "ffmpeg -y -i 'input.flv' -sameq '{$savingname}'";
if(is_writable($saving_name)){
$error_msg = "folder is not writable";
return false;
}
ob_start();
passthru($command);
$content_grabbed = ob_get_contents();
ob_end_clean();
if(!file_exists($savingname)){
$error_msg = "Cannot convert video to {$type}";
return false;
}
return true;
}


And use it as follows :

convertToFormat('mp4');

Dependencies :
FFmpeg software should be installed in the server
924
like
0
dislike
0
mail
flag

You must LOGIN to add comments