1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

I need help please

Discussion in 'Content Management' 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