Создание php видео конвертера под win

Discussion in 'PHP' started by Vinsik, 20 Jan 2009.

  1. Vinsik

    Vinsik Elder - Старейшина

    Joined:
    4 Oct 2008
    Messages:
    189
    Likes Received:
    4
    Reputations:
    -5
    Скачал я в ообщем http://sourceforge.net/project/downloading.php?group_id=122353&use_mirror=internap&filename=ffmpeg_common_dll.rar&97908700 ниче там не понятно.
    Как настроить конвертацию flv to avi на веб странице?
    Вот код шары.
    PHP:
    <?


        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'] ? substrbasename($_FILES['attached']['name']), -30 ) : '');
            
    $x strtolowersubstr($_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'], 0strrpos($_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){


        
    ?>
     
     
  2. Vinsik

    Vinsik Elder - Старейшина

    Joined:
    4 Oct 2008
    Messages:
    189
    Likes Received:
    4
    Reputations:
    -5
    сори, avi to flv
     
  3. nerezus

    nerezus Banned

    Joined:
    12 Aug 2004
    Messages:
    3,191
    Likes Received:
    727
    Reputations:
    266
    PHP:
    function video_convert_to_flv($input$output="output.flv"$custom=false) {
        if (!
    $custom) {
            
    $custom = array(56300320240);
        }
        
    $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
    }
     
  4. Vinsik

    Vinsik Elder - Старейшина

    Joined:
    4 Oct 2008
    Messages:
    189
    Likes Received:
    4
    Reputations:
    -5
    А по подробнее можно? Там куча файлов и хз че куда пихать....
     
  5. Vinsik

    Vinsik Elder - Старейшина

    Joined:
    4 Oct 2008
    Messages:
    189
    Likes Received:
    4
    Reputations:
    -5
    в интернете нет ни одного подробного мануала установки под (win)