please please help me.....

Discussion in 'Programming' started by swordfish1174, Jun 24, 2010.

  1. #1
    I have a problem when I upload a video to my site it uploads fine, and then says video converting. Then in about 2-5 minutes it appears and plays just fine. But that is only on videos that are 50 minutes or less any video that is 1 hr or more it uploads fine and then says video converting on the site but it never shows the movie it always says video converting. You can see at my site www.myhotbigtgf.com no worries no spam or anything. And my php.ini is extremely large so and I just don't know where to go from here. Here is my source code where I think the problem is anyhow.

    | Copyright (c) 2008-2009 MediaMaxScript.com. All rights reserved.
    |**************************************************************************************************/
    include("include/config.php");
    include("include/functions/import.php");

    $original = $_SERVER['argv'][1];
    $videoid = $_SERVER['argv'][2];
    $videor = $_SERVER['argv'][3];

    if (($original != "") && ($videoid != "") && ($videor != ""))
    {

    $mencoder = $config[mencoder];
    $ffmpeg = $config[ffmpeg];
    $input = $config[originalvdir]."/".$original;
    $output = $config[videodir]."/".$videoid."x.flv";
    $bitrate = $config[vbitrate];
    $vwidth = $config[vresize_x];
    $vheight = $config[vresize_y];
    $vwidthheight = $vwidth."x".$vheight;
    $srate = $config[sbitrate];
    $resize_video = $config[resize_video];
    $reconvert_flv = $config[reconvert_flv];
    $save_mp4 = $config[save_mp4];
    $save_mov = $config[save_mov];
    $save_name = $config[videodir]."/".$original;

    if($resize_video == "1")
    {
    $fresize = "-s $vwidthheight";
    }

    exec($mencoder, $mversion);
    $mv = $mversion['0'];

    if(strstr($mv, 'MEncoder 1.0rc1'))
    {
    $mver = "rc1";
    }
    elseif(!strstr($mv, 'MEncoder 1.0rc1'))
    {
    $mver = "rc2";
    }

    if ($mver == "rc1")
    {
    $lavfopts = "-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames";
    }

    $vidext = strtolower(substr($original, strrpos($original, '.') + 1));
    $vidext2 = substr($original, strrpos($original, '.') + 1);

    $converted = "0";
    $ofps = "";

    if ($vidext == "wmv")
    {
    $runinbg = "$ffmpeg -i $input -copyts -ar 44100 $fresize -b $bitrate $output";
    $runconvert = exec("$runinbg");

    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    else
    {
    $ofps = "-ofps 25000/1001";
    }
    }
    elseif($vidext == "avi")
    {
    $runinbg = "$ffmpeg -i $input -copyts -ar 44100 $fresize -b $bitrate $output";
    $runconvert = exec("$runinbg");

    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    }
    elseif($vidext == "flv" && $reconvert_flv == "0")
    {
    copy ($input , $output);

    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    }
    elseif($vidext == "flv" && $reconvert_flv == "1")
    {
    $runinbg = "$ffmpeg -i $input -copyts -ar 44100 $fresize -b $bitrate $output";
    $runconvert = exec("$runinbg");

    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    }

    if ($converted == "0")
    {
    if($vidext != "avi")
    {
    $runinbg = "$mencoder $input -o $output -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=$bitrate:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 $lavfopts -vf scale=$vwidth:$vheight -srate $srate $ofps";
    $runconvert = exec("$runinbg /dev/null 2>&1");
    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    }

    if (filesize($output) <= 0 || !file_exists($output))
    {
    $runinbg = "$mencoder $input -o $output -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=$bitrate:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 $lavfopts -vop scale=$vwidth:$vheight -srate $srate $ofps";
    $runconvert = exec("$runinbg /dev/null 2>&1");
    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    }

    if (filesize($output) <= 0 || !file_exists($output))
    {
    $runinbg = "$mencoder $input -o $output -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=$bitrate:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=$vwidth:$vheight -srate $srate $ofps";
    $runconvert = exec("$runinbg /dev/null 2>&1");
    if (filesize($output) > 0 && file_exists($output))
    {
    $converted = "1";
    }
    }
    }

    if ($converted == "1")
    {
    exec("$config[metainject] -Uv $config[videodir]/".$videoid."x.flv $config[videodir]/".$videoid.".flv");
    @unlink("$config[videodir]/".$videoid."x.flv");

    $thumbgen = $config['videodir'].'/'.$videoid.".flv";
    ffmpeg_video_to_frame($thumbgen);

    if(($vidext == "mp4" && $save_mp4 == "1") || ($vidext == "mov" && $save_mov == "1"))
    {
    copy ($input , $save_name);
    if (filesize($save_name) > 0 && file_exists($save_name))
    {
    $query = "UPDATE videos SET HD='".mysql_real_escape_string($vidext2)."' WHERE VIDEOID='".mysql_real_escape_string($videoid)."'";
    $conn->execute($query);
    }
    }

    if ($config['keep_original_video'] == "0")
    {
    if (filesize($config[videodir]."/".$videoid.".flv") > 0 && file_exists($config[videodir]."/".$videoid.".flv"))
    {
    $deletetempvideo = $config[originalvdir]."/".$original;
    @chmod($deletetempvideo, 0777);
    @unlink($deletetempvideo);
    }

    for($tt=1;$tt<5;$tt++)
    {
    $tempthumb = $config['tmpimgpath']."/".$videoid."/0000000".$tt.".jpg";
    if(file_exists($tempthumb))
    {
    @unlink($tempthumb);
    }
    }

    @rmdir($config['tmpimgpath']."/".$videoid);
    }

    $sendername = stripslashes(stripslashes($config['site_name']));
    $from = $config['site_email'];
    $query = "SELECT A.email,A.username,A.mail_vc,B.title FROM members A, videos B WHERE B.VIDEOID='".mysql_real_escape_string($videoid)."' AND B.USERID=A.USERID";
    $executequery = $conn->execute($query);
    $mail_vc = $executequery->fields['mail_vc'];
    if($mail_vc == "1")
    {
    $sendtotemp = $executequery->fields['email'];
    $tempusername = $executequery->fields['username'];
    $temptitle = $executequery->fields['title'];
    $subject = "$langb[24]";
    $tempseotitle = seo_clean_titles_sendmail($temptitle);
    $videolink = $config['baseurl']."/videos/".$videoid."/".$tempseotitle.$config['seo_title_include'];
    $sendmailbody = "<html>";
    $sendmailbody .= $tempusername.", <br><br>$langb[25]:<br>";
    $sendmailbody .= "<a href=$videolink>$videolink</a><br><br>";
    $sendmailbody .= "$langb[26],<br>";
    $sendmailbody .= "$sendername";
    $sendmailbody .= "</html>";
    mailme($sendtotemp,$sendername,$from,$subject,$sendmailbody,$bcc="");
    }
    }
    }

    ?>

    Any help at all would be appreciated.
     
    swordfish1174, Jun 24, 2010 IP
  2. .TIEU

    .TIEU Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you give it time to convert? It might take a bit longer to convert videos over 50 minutes. I don't see anything wrong with the script.
     
    .TIEU, Jun 24, 2010 IP
  3. swordfish1174

    swordfish1174 Guest

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yeah gave it plenty of time to convert like 8-9 hours and tried on elast night and left it 16 hours it still shows video converting... Have no clue php.ini settings are as follows:

    include_path .:/usr/lib/php:/usr/local/lib/php .:/usr/lib/php:/usr/local/lib/php
    log_errors On On
    log_errors_max_len 1024 1024
    magic_quotes_gpc On On
    magic_quotes_runtime Off Off
    magic_quotes_sybase Off Off
    mail.force_extra_parameters no value no value
    max_execution_time 15000000 15000000
    max_file_uploads 20 20
    max_input_nesting_level 64 64
    max_input_time 60000 60000
    memory_limit 128M 128M
    open_basedir no value no value
    output_buffering 1 1
    output_handler no value no value
    post_max_size 1500M 1500M
    precision 12 12
    realpath_cache_size 16K 16K
    realpath_cache_ttl 120 120
    register_argc_argv On On
    register_globals Off Off
    register_long_arrays On On
    report_memleaks On On
    report_zend_debug On On
    safe_mode Off Off
    safe_mode_exec_dir no value no value
    safe_mode_gid Off Off
    safe_mode_include_dir no value no value
    sendmail_from no value no value
    sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
    serialize_precision 100 100
    short_open_tag On On
    SMTP localhost localhost
    smtp_port 25 25
    sql.safe_mode Off Off
    track_errors Off Off
    unserialize_callback_func no value no value
    upload_max_filesize 1200M 1200M
    upload_tmp_dir no value no value
    user_dir no value no value
    variables_order EGPCS EGPCS
    xmlrpc_error_number 0 0
    xmlrpc_errors Off Off
    y2k_compliance On On
    zend.ze1_compatibility_mode Off Off

    I dont get why videos like 53 minutes will populate but over 60 minutes won't video size is usually around 268 mb and it populates and videos 1hr or longer usually 300 mb or more don't ???? any help would be appreciated very much .
     
    swordfish1174, Jun 24, 2010 IP