Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 12-30-2007, 01:14 PM
Khalid-B's Avatar
Khalid-B Khalid-B is offline
 
Join Date: Apr 2007
Location: NL
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Need some help with converter.php

Hello.

I some problem with file converting .
when i upload a small file up to 100MB its work fine but when i upload large files up to 200,300,400,500,700MB these files not converting in flv , than i checked in MySQL and stauts is stll "converting"
Can some one help me to slove this issue ?

Please
Thanx
Reply With Quote
  #2  
Old 12-30-2007, 02:38 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What is converter.php?
Reply With Quote
  #3  
Old 12-30-2007, 02:42 PM
Khalid-B's Avatar
Khalid-B Khalid-B is offline
 
Join Date: Apr 2007
Location: NL
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi.

Here is a copy of converter.php.

PHP Code:
//CHECK POINT 1\\
//mail("lubna35@yahoo.com", "PHPmotion - Check Point 1", "Loaded OK", "From: Server <lubna35@yahoo.com>");

include_once ("classes/config.php");
@
error_reporting(0);

//LOG THAT THIS PAGE WAS LOADED (debugging for CLI)
if ($log_encoder == "yes") {
    
//check if file exists
    
$file_contents "\n\n\n\n" 'PHPmotion Convertor.php debug' "\n" .
        
'CLI for convertor OK' "\n" $config["date_format"] . "\n" .
        
'================================================================================' .
        
"\n";
    
$log_file "logs/logfile.rtf";
    if (@
file_exists($log_file)) {//append to log file
        
$fo = @fopen($log_file'a');
        @
fwrite($fo$file_contents);
        @
fclose($fo);
    }
    else {
        
$fo = @fopen($log_file'w');//else create new log
        
@fwrite($fo$file_contents);
        @
fclose($fo);
    }
}

/////////////////////////////
//get all file paths for file
/////////////////////////////
$ffmpeg_debug $_GET['debug'];//incase we are loading this as a url dor debugging
$base_path installation_paths();
$ffmpeg_path $config["path_to_ffmpeg"];
//////////////////////////////
//PROCESS OR VIDEOS ONE BY ONE
//////////////////////////////
$sql "SELECT * FROM videos where approved ='pending_conversion'";
$query = @mysql_query($sql);
while (
$result = @mysql_fetch_array($query)) {
    
$raw_video $result['video_id'];

    
//set current video to "converting"
    
$sql1 "UPDATE videos SET approved = 'converting' WHERE video_id = '$raw_video'";
    @
mysql_query($sql1);

    
$raw_video_path $base_path '/uploads/avi/' $raw_video;//full path of raw video file
    
list($file_name_no_extension$extension) = @split('\.'$raw_video);//spliting the raw video file name to get just the unique name
    
$avi_file $base_path '/uploads/avi/' $file_name_no_extension '.avi';
    
$new_flv $base_path "/uploads/" $file_name_no_extension ".flv";

    
/////////////////////////////////////////////////////////////
    //                        STEP 1                           //
    //                  encode video to flv                    //
    /////////////////////////////////////////////////////////////

if ($extension != 'flv'){

    
//the following can be changed (vbitrate, vop scale, SRATE)
    
$path_to_mencoder $config["path_to_mencoder"];
    
$mencoder_cmd "$path_to_mencoder $raw_video_path -o $new_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vf scale=450:400 -srate 22050";
    @
exec("$mencoder_cmd 2>&1"$output);

   
    
//If no flv was created. Attempt to convert with -vop swicth and not -vf
    
if(!file_exists($new_flv)){
        
$mencoder_cmd "$path_to_mencoder $raw_video_path -o $new_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -vop scale=450:400 -srate 22050";
    @
exec("$mencoder_cmd 2>&1"$output);
    }

    
//If no flv was created. Attempt to convert with no -lavcopts i_certify_etc_etc
    
if(!file_exists($new_flv)){
    
$mencoder_cmd "$path_to_mencoder $raw_video_path -o $new_flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=450:400 -srate 22050";
    @
exec("$mencoder_cmd 2>&1"$output);
    }
    

    
//debugging
    
$debug_1 $mencoder_cmd "\n";//file line of debug
    
foreach ($output as $outputline) {
        
$debug_1 $debug_1 $outputline "\n";

        if (
$debugmodex == 1) {//no debug mode
            
echo ("$outputline<br>");
        }
    }    
    
    
//LOG THAT STEP 1 was ok
    
if ($log_encoder == "yes") {
        
//check if file exists
        
$file_contents 'PHPmotion debug' "\n" $mencoder_cmd "\n" .
            
'Command was executed.See rest of log for output details' "\n" .
            
'================================================================================' .
            
"\n";
        
$log_file "logs/logfile.rtf";
        if (@
file_exists($log_file)) {//append to log file
            
$fo = @fopen($log_file'a');
            @
fwrite($fo$file_contents);
            @
fclose($fo);
        }
        else {
            
$fo = @fopen($log_file'w');//else create new log
            
@fwrite($fo$file_contents);
            @
fclose($fo);
        }
    }
}else{
//just move the flv file    
@copy($raw_video_path$new_flv);
}

    
//CHECK POINT 2\\
    //mail("you@yourdomain.com", "PHPmotion - Check Point 2", "Video - Flash : $mencoder_cmd", "From: Server <name@email.com>");

    /////////////////////////////////////////////////////////////
    //                        STEP 2                           //
    //                  FLVTOOL2 INJECTION                     //
    /////////////////////////////////////////////////////////////

    
$path_to_flv $config["path_to_flvtool2"];
    
$flv_cmd "$path_to_flv -U $new_flv";
    @
exec("$flv_cmd 2>&1"$output);

    
//debugging
    
$debug_2 $flv_cmd "\n";//file line of debug
    
foreach ($output as $outputline) {
        
$debug_2 $debug_2 $outputline "\n";

        if (
$debugmodex == 1) {//no debug mode
            
echo ("$outputline<br>");
        }
    }
    
//LOG THAT STEP 2 was ok
    
if ($log_encoder == "yes") {
        
//check if file exists
        
$file_contents 'PHPmotion debug' "\n" $flv_cmd "\n" .
            
'Command was executed.See rest of log for output details' "\n" .
            
'================================================================================' .
            
"\n";
        
$log_file "logs/logfile.rtf";
        if (@
file_exists($log_file)) {//append to log file
            
$fo = @fopen($log_file'a');
            @
fwrite($fo$file_contents);
            @
fclose($fo);
        }
        else {
            
$fo = @fopen($log_file'w');//else create new log
            
@fwrite($fo$file_contents);
            @
fclose($fo);
        }
    }

    
//CHECK POINT 3\\
    //mail("you@yourdomain.com", "PHPmotion - Check Point 3", "FLVTOOL2 : $flv_cmd", "From: Server <name@email.com>");

    /////////////////////////////////////////////////////////////
    //                        STEP 3                           //
    //                  ffmpeg-php get video duration          //
    /////////////////////////////////////////////////////////////



    //Original FFMPEG-PHP option for getting video length
    ///////////////////////////////////////////////////////////////////

    /*
    $video_info = @new ffmpeg_movie($new_flv);//duration of new flv file.

    $sec = @$video_info->getDuration();// Gets the duration in secs.
    */
    //-------------------------------------------------------------------------------end of original ffmpeg-php



    //Alternative to flvtool2 if getting errors or if no flvtool exists (comment out if failing or to use ffpmeg-php)
    ///////////////////////////////////////////////////////////////////

    //Try and read the time from the output files
    
$shell_output $debug_1 $debug_2;//get as much sheel out put as possible to run search for duration
    
if (@preg_match('/Video stream:.*bytes..(.*?).sec/'$shell_output$regs)) {
        
$sec $regs[1];
        
$duration sec2hms($sec);//covert to 00:00:00 i.e. hrs:min:sec
    
}
    else {
        
$sec "";
    }

    
//check if duration has been picked up...if not try second method  (ffmpeg -i video.flv)
    
if ($sec == "" || !is_numeric($sec)) {
        
$check_duration $ffmpeg_path ' -i ' $new_flv;
        
$durationfile "";
        @
exec("$check_duration 2>&1"$durationoutput);

        foreach (
$durationoutput as $outputline) {
            
$durationfile $durationfile $outputline "\n";

        }

        if (
preg_match('/uration:.(.*?)\./'$durationfile$regs)) {
            
$duration $regs[1];//duration already in 00:00:00 format
            
$sec date("s"strtotime($duration));//change back to seconds for use in getting middle of video
        
}
        else {
            
$sec 2;
            
$duration sec2hms($sec);//covert to 00:00:00 i.e. hrs:min:sec
        
}

    }

    
//get the middle of the movie (time; 00:00:00 format) for thumbnail
    
$sec2 $sec 2;
    
$sec2 = @round($sec2);
    
$thumb_position sec2hms($sec2);

    
//LOG THAT STEP 3 was ok
    
if ($log_encoder == "yes") {
        
//check if file exists
        
$file_contents 'PHPmotion debug' "\n" .
            
'FFMPEG-PHP - check - Video Duration = ' $duration "\n" .
            
'================================================================================' .
            
"\n";
        
$log_file "logs/logfile.rtf";
        if (@
file_exists($log_file)) {//append to log file
            
$fo = @fopen($log_file'a');
            @
fwrite($fo$file_contents);
            @
fclose($fo);
        }
        else {
            
$fo = @fopen($log_file'w');//else create new log
            
@fwrite($fo$file_contents);
            @
fclose($fo);
        }
    }

    
//CHECK POINT 4\\
    //mail("you@yourdomain.com", "PHPmotion - Check Point 4", "FFMPEG-PHP : $duration", "From: Server <name@email.com>");

    /////////////////////////////////////////////////////////////
    //                        STEP 4                           //
    //                  Create thumnail image                  //
    /////////////////////////////////////////////////////////////

    
$output_file $base_path '/uploads/thumbs/' $file_name_no_extension .
        
'.jpg';

    
//IMPORTANT: if your thumbs ar enot being created, try change "mjpeg" below to "image2"
    
$ffmpeg_cmd2 "$config[path_to_ffmpeg] -i $new_flv -ss $thumb_position -t 00:00:01 -s 120x90 -r 1 -f mjpeg $output_file";
    
//execute and record output to variable
    
@exec("$ffmpeg_cmd2 2>&1"$output);

    
//debugging
    
$debug_3 $ffmpeg_cmd2 "\n";//file line of debug
    
foreach ($output as $outputline) {
        
$debug_3 $debug_3 $outputline "\n";

        if (
$debugmodex == 1) {//no debug mode
            
echo ("$outputline<br>");
        }
    }
    
//LOG THAT STEP 4 was ok
    
if ($log_encoder == "yes") {
        
//check if file exists
        
$file_contents 'PHPmotion debug' "\n" $ffmpeg_cmd2 "\n" .
            
'Command was executed.See rest of log for output details' "\n" .
            
'================================================================================' .
            
"\n\n\n";
        
$log_file "logs/logfile.rtf";
        if (@
file_exists($log_file)) {//append to log file
            
$fo = @fopen($log_file'a');
            @
fwrite($fo$file_contents);
            @
fclose($fo);
        }
        else {
            
$fo = @fopen($log_file'w');//else create new log
            
@fwrite($fo$file_contents);
            @
fclose($fo);
        }
    }

    
//////////////////////////////////////////////////////////////
    //check if image thumb has been made
    //This tries to create thumb using different format "image2"
    //////////////////////////////////////////////////////////////

    
if (@!file_exists($output_file)) {
        
$ffmpeg_cmd2 "$config[path_to_ffmpeg] -i $new_flv -ss $thumb_position -t 00:00:01 -s 120x90 -r 1 -f image2 $output_file";
        
//execute and record output to variable
        
@exec("$ffmpeg_cmd2 2>&1"$output);

        
//debugging
        
$debug_3 $ffmpeg_cmd2 "\n";//file line of debug
        
foreach ($output as $outputline) {
            
$debug_3 $debug_3 $outputline "\n";

            if (
$debugmodex == 1) {//no debug mode
                
echo ("$outputline<br>");
            }
        }
        
//LOG THAT STEP 4 was ok
        
if ($log_encoder == "yes") {
            
//check if file exists
            
$file_contents 'PHPmotion debug - Image type 2' "\n" $ffmpeg_cmd2 "\n" .
                
'Command was executed.See rest of log for output details' "\n" .
                
'================================================================================' .
                
"\n\n\n";
            
$log_file "logs/logfile.rtf";
            if (@
file_exists($log_file)) {//append to log file
                
$fo = @fopen($log_file'a');
                @
fwrite($fo$file_contents);
                @
fclose($fo);
            }
            else {
                
$fo = @fopen($log_file'w');//else create new log
                
@fwrite($fo$file_contents);
                @
fclose($fo);
            }
        }
    }

    
//CHECK POINT 5\\
    //mail("you@yourdomain.com", "PHPmotion - Check Point 5", "THUMBNAIL : $ffmpeg_cmd2", "From: Server <name@email.com>");

    /////////////////////////////////////////////////////////////
    //                        STEP 6                           //
    //                  UDATE DATABASE DETAILS                 //
    /////////////////////////////////////////////////////////////
    
   
   //--------------new code 28 october 2007 --------reconnect mysql ---------
    
$sql_test 'SELECT * FROM admin';
    if (!
mysql_query($sql_test)) {
        @
mysql_close();
        @include_once (
"classes/config.inc.php");
        @include_once (
"classes/config.php");
        @
mysql_connect($hostname,$dbusername,$dbpassword,true);
        @
mysql_select_db($dbname);
    }
    
//--------------new code 28 october 2007 --------reconnect mysql end -----
    
    
    

    //RESET THE VIDEO FROM "pending_conversion" to just "pending" (for admin approval etc)
    
$sql "UPDATE videos SET approved='pending' WHERE video_id = '$raw_video'";
    @
mysql_query($sql);

    
//RESET THE VIDEO ID TO REMOVE file extenstion
    
$sql "UPDATE videos SET video_id='$file_name_no_extension' WHERE video_id = '$raw_video'";
    @
mysql_query($sql);

    
//Update dabase with new duration information
    /////////////////////////////////////////////
    
$file_name_no_extension $file_name_no_extension;
    
$sql "UPDATE videos SET video_length='$duration' WHERE video_id = '$file_name_no_extension'";
    @
mysql_query($sql);
    
//Check if video need pre approval by admin, if not update from pending to "yes"
    ////////////////////////////////////////////////////////////////////////////////
    
if ($config["auto_approve_videos"] == "yes") {
        
$sql "UPDATE videos SET approved='yes' WHERE video_id = '$file_name_no_extension'";
        @
mysql_query($sql);
    }
    
//@mysql_close();
    //////////////////////////////////////////////////////////////////
    //WRITE OUTPUT TO LOGFILE - HELP WITH DEBUGGING (logs/logfile.rtf)
    //////////////////////////////////////////////////////////////////
    
if ($log_encoder == "yes") {
        
$file_contents 'Date: ' $config["date_format"] . "\n" 'STEP 1 - OUTPUT' .
            
"\n" $debug_1 "\n" 'STEP 2 - OUTPUT' "\n" $debug_2 "\n" .
            
'STEP 4 - OUTPUT' "\n" $debug_3;//adding all output
        //check if file exists

        
$log_file "logs/logfile.rtf";
        if (@
file_exists($log_file)) {//append to log file
            
$fo = @fopen($log_file'a');
            @
fwrite($fo$file_contents);
            @
fclose($fo);
        }
        else {
            
$fo = @fopen($log_file'w');//else create new log
            
@fwrite($fo$file_contents);
            @
fclose($fo);
        }
    }
    
//delete original file and converted temp avi file
    ///////////////////////////////////////////////////
    
$original_file $raw_video_path;
    if (
$config["delete_original"] == 'yes') {
        if (@
file_exists("$new_flv") && @file_exists("$raw_video_path")) {

            if (
$new_flv != $raw_video_path) {
                @
unlink($raw_video_path);
            }
        }
    }

    if (
$config["delete_avi"] == 'yes') {
        if (@
file_exists("$new_flv") && @file_exists("$avi_file")) {
            @
unlink($avi_file);
        }
    }

    
//CHECK POINT 6\\
    //mail("you@yourdomain.com", "PHPmotion - Check Point 6", "SCRIPT LOADED TO THE END", "From: Server <you@yourdomain.com>");

    
@mysql_close();
}
//end while
?> 
Reply With Quote
  #4  
Old 12-30-2007, 02:53 PM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This seems to be some kind of PHP Motion script. Why don't you ask at their support site?
Reply With Quote
  #5  
Old 12-30-2007, 02:59 PM
Khalid-B's Avatar
Khalid-B Khalid-B is offline
 
Join Date: Apr 2007
Location: NL
Posts: 450
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well i asked there a few days ago but still no response even i requested for paid service so i requested here for help .
So please help me if possible (Even paid)

Thanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:50 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04349 seconds
  • Memory Usage 2,368KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete