PDA

Просмотр полной версии : Создание php видео конвертера под win


Vinsik
20.01.2009, 21:04
Скачал я в ообщем http://sourceforge.net/project/downloading.php?group_id=122353&use_mirror=internap&filename=ffmpeg_common_dll.rar&97908700 ниче там не понятно.
Как настроить конвертацию flv to avi на веб странице?
Вот код шары.
<?


include("include/common.php");

if($loggedin){
include("include/accmenu.php");
}
if( $_POST['submit'] && $_FILES['attached']['name'] ){
$ok_filetypes = explode("|",$att_filetypes);
if (!$_FILES['attached']['error'] && $_FILES['attached']['size'] > $att_max_size*1024){
errform('<CENTER>Извините, слишком большой размер файла!</CENTER><BR><BR>'); // #err
$step = 1;
}
$filename = (!$_FILES['attached']['error'] ? substr( basename($_FILES['attached']['name']), -30 ) : '');
$x = strtolower( substr($_FILES['attached']['name'], -3));
if($filename && !in_array($x, $ok_filetypes) ){
errform('<CENTER>Не поддерживаемый тип файла!!!</CENTER><BR><BR>');
$step = 1;
}
if(!$posterr){
if(!isset($_GET["ipaddress"]) || ($_GET["ipaddress"] == "")) {
$ipaddress = $_SERVER['REMOTE_ADDR'];
$local = 1;
} else {
$ipaddress = $_GET["ipaddress"];
$local = 0;
}


$ru=array("&","а","б","в"," ","г","д","е","ё","ж","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","ъ","ы","ь","э","ю","я");
$tr=array("_","a","b","v","_","g","d","e","oh","zh","z","i","j","k","l","m","n","o","p","r","s","t","u","f","x","c","ch","sh","w","qh","y","q","eh","ju","ja");

$attach_name = substr($_FILES['attached']['name'], 0, strrpos($_FILES['attached']['name'], '.'));
$uniq = strtolower(str_replace($ru,$tr,$attach_name));
$ext = substr($_FILES['attached']['name'], strrpos($_FILES['attached']['name'], '.') + 1);

if (file_exists($att_path."/".$uniq.".".$ext)) $uniq = $uniq . '(copy)';

move_uploaded_file($_FILES['attached']['tmp_name'], $att_path."/".$uniq.".".$ext );
$strQuery = "INSERT INTO images25 SET ";
$strQuery .= "filename='($uniq.$ext)',";
$strQuery .= "ipaddress='{$ipaddress}',";
$strQuery .= "date='".time()."',";
if($myuid){
$strQuery .= "user='{$myuid}',";
}
$strQuery .= "status='1'";

$result = mysql_query($strQuery) or die( mysql_error() );
$aid = mysql_insert_id();
if($aid){
$filen = $siteurl."/".str_replace('./', '', $att_path)."/".$uniq.".$ext";
$filen = str_replace('http://','%%',$filen);
$filen = str_replace('//','/',$filen);
$filen = str_replace('%%','http://',$filen);


//ITS AN IMAGE
if($x=="jpg" or $x=="jpeg" or $x=="gif" or $x=="png" or $x=="jif" or $x=="jfif")
{
$filenx=$filen;
}
else
{
include("include/const.inc.php");
$filenx = $siteurl."/icons/".$Icons[$ext];
}


$step = 2;
}else{
$step = 1;
}
}
}else{
$step = 1;
}
if($step == 1){



?>

Vinsik
20.01.2009, 21:11
сори, avi to flv

nerezus
20.01.2009, 21:30
function video_convert_to_flv($input, $output="output.flv", $custom=false) {
if (!$custom) {
$custom = array(56, 300, 320, 240);
}
$command = sprintf('mencoder "%s" -o "%s" -of lavf -oac mp3lame -lameopts ' .
'abr:br=%d -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=%d:mbd=2:' .
'mv0:trell:v4mv:cbp:last_pred=3 scale=%d:%d',
$input, $output, $custom[0], $custom[1], $custom[2], $custom[3]);
run($command);
run("flvtool2 -UP \"$output\""); // update metadata
}

Vinsik
20.01.2009, 21:52
function video_convert_to_flv($input, $output="output.flv", $custom=false) {
if (!$custom) {
$custom = array(56, 300, 320, 240);
}
$command = sprintf('mencoder "%s" -o "%s" -of lavf -oac mp3lame -lameopts ' .
'abr:br=%d -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=%d:mbd=2:' .
'mv0:trell:v4mv:cbp:last_pred=3 scale=%d:%d',
$input, $output, $custom[0], $custom[1], $custom[2], $custom[3]);
run($command);
run("flvtool2 -UP \"$output\""); // update metadata
}
А по подробнее можно? Там куча файлов и хз че куда пихать....

Vinsik
21.01.2009, 07:59
в интернете нет ни одного подробного мануала установки под (win)