admin_login_check(); if(isset($_POST['experiment'])) { $mode = $_POST['mode']; $victim = $_POST['victim']; switch($mode) { default: echo json_encode(array("err"=>"DUDE!!Why The Hell You Are Playing With The Code :/")); break; case "getPreDetails": { $err = array(); $msg = array(); if(!function_exists("exec")) { $err[] = "
C'mon man! there shuld be some 'exec' functions :("; $err[] = "
Exec function does not exist
"; theEnd(); }else $msg[] = "
Exec function exists
"; //testing php compatiblity $phpTest = shell_output(php_path()." -q ".ADMINBASEDIR.'/lab_resources/echo.php'); if(!$phpTest) { $err[] = "
OMG! Your host is so chipless that it doesn't even allow you to use PHP CLI , very bad!"; $err[] = "
PHP CLI is not enabled
"; theEnd(); }else $msg[] = "
PHP CLI is enabled
"; //now get ffmpeg details $ffmpegDetails = shell_output($Cbucket->configs['ffmpegpath']." -version "); if(!$ffmpegDetails) { $err[] = '
How can human work without brain? same situation is with video conversion, no ffmpeg, no conversion.'; $err[] = "
FFMPEG does not exist
"; theEnd(); }else{ $msg[] = "
".nl2br($ffmpegDetails); $msg[] = "
FFMPEG Exists
"; } $flvtool2Details = shell_output($Cbucket->configs['flvtool2path']." -version "); if(!$flvtool2Details) { $err[] = '
Ah, no flvtool2 :O, its like a "Salt" for video files..food without salt is tasteless, so video is streamless without flvtool2'; $err[] = "
flvtool2 does not exist
"; theEnd(); }else{ $msg[] = "
".nl2br($flvtool2Details); $msg[] = "
Flvtool2 Exists
"; } $victimFile = $testVidsDir.'/'.$victim; //getting video details.. $ffmpegObj = new ffmpeg($victimFile); $vidDetails = $ffmpegObj->get_file_info(); if(!$vidDetails) { $err[] = "
".nl2br(shell_output($Cbucket->configs['ffmpegpath'].' -i '.$victimFile)); if(!file_exists($victimFile) && $victim) $err[] = "
File does not exist
"; else $err[] = "
What the...post the above ffmpeg log and let scientist do their job
"; theEnd(); }else { $msg[] = "
".nl2br(shell_output($Cbucket->configs['ffmpegpath'].' -i '.$victimFile)); $msg[] = "
Video file is convertable..
"; } theEnd('convertVideo1'); } break; case "convertVideo1": { $victimFile = $testVidsDir.'/'.$victim; $victimOutput = $testVidsDir.'/output.flv'; $victimOutputHQ = $testVidsDir.'/output.mp4'; if(file_exists($victimOutput)) unlink($victimOutput); if(file_exists($testVidsDir.'/output.log')) unlink($testVidsDir.'/output.log'); $res169 = array(); $res169['240'] = array('427','240'); $res169['360'] = array('640','360'); $res169['480'] = array('853','480'); $res169['720'] = array('1280','1280'); $res169['1080'] = array('1920','1080'); $res43 = array(); $res43['240'] = array('320','240'); $res43['360'] = array('480','360'); $res43['480'] = array('640','480'); $res43['720'] = array('960','1280'); $res43['1080'] = array('1440','1080'); $configs = array ( 'use_video_rate' => true, 'use_video_bit_rate' => true, 'use_audio_rate' => true, 'use_audio_bit_rate' => true, 'use_audio_codec' => true, 'format' => 'flv', 'video_codec'=> config('video_codec'), 'audio_codec'=> config('audio_codec'), 'audio_rate'=> config("srate"), 'audio_bitrate'=> config("sbrate"), 'video_rate'=> config("vrate"), 'video_bitrate'=> config("vbrate"), 'normal_res' => config('normal_resolution'), 'high_res' => config('high_resolution'), 'max_video_duration' => config('max_video_duration'), 'res169' => $res169, 'res43' => $res43, 'resize'=>'max' ); $ffmpeg = new ffmpeg($victimFile); $ffmpeg->configs = $configs; $ffmpeg->gen_thumbs = false; $ffmpeg->gen_big_thumb = false; $ffmpeg->num_of_thumbs = config('num_thumbs'); $ffmpeg->thumb_dim = config('thumb_width')."x".config('thumb_height'); $ffmpeg->big_thumb_dim = config('big_thumb_width')."x".config('big_thumb_height'); $ffmpeg->tmp_dir = TEMP_DIR; $ffmpeg->input_ext = $ext; $ffmpeg->output_file = $victimOutput; $ffmpeg->hq_output_file = $victimOutputHQ; $ffmpeg->log_file = $testVidsDir.'/output.log'; //$ffmpeg->remove_input = TRUE; $ffmpeg->keep_original = config('keep_original'); $ffmpeg->original_output_path = ORIGINAL_DIR.'/'.$tmp_file.'.'.$ext; $ffmpeg->set_conv_lock = false; $ffmpeg->showpre=true; $ffmpeg->ClipBucket(); $ffmpegpath = $Cbucket->configs['ffmpegpath']; $ffmpegCommand = $ffmpeg->raw_command; $msg[] = "FFMPEG Command So far
"; //Lets start conversing videos $converDetails = shell_output($ffmpegCommand); $msg[] = "
".nl2br($ffmpeg->log); $victimDetails = $ffmpeg->input_details; $vidDetails = $ffmpeg->output_details; if(!$vidDetails) { if($victimDetails['audio_codec']=='aac' || $victimDetails['audio_codec']=='ac3') $err[] = "
A possible reason is beacuse videos with AAC Audio does not encode without 'libfaac', set audio codec as libfaac and then try again
"; if(!file_exists($victimFile) && $victim) $err[] = "
No output file...your ffmpeg is not compatible
"; else $err[] = "
No output file...hmm post the log to dev team
"; if(@filesize($victimOutput)>0 && file_exists($victimFile)) $err[] = "
".nl2br(shell_output($Cbucket->configs['ffmpegpath'].' -i '.$victimOutput)); theEnd(); }else { $msg[] = "
".nl2br(shell_output($Cbucket->configs['ffmpegpath'].' -i '.$victimOutput)); $msg[] = "
Video file is converted =D..
"; } theEnd(); } } } function theEnd($status=false) { global $msg, $err; if($err) $errors = implode('',$err); if($msg) $messgs = implode('',$msg); echo json_encode(array('err'=>$errors,'msg'=>$messgs,'status'=>$status)); exit(); } ?>