/** * CONVERT VIDEOS TO FLV FORMAT * @param database A database connector object */ function generateOutput($result) { $c = hwd_vs_Config::get_instance(); $output = ''; $output.= "<div class=\"box\"><div><h2>Moving Moov Atom</h2></div>"; if ($result[0] == 1) { $output.= "<div class=\"success\">SUCCESS: GT-QUICKSTART moved the Moov Atom</div>"; } else if ($result[0] == 0) { $output.= "<div class=\"error\">ERROR: GT-QUICKSTART did not move the Moov Atom</div>"; } $output.= "<div><b>GT-QUICKSTART INPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".$result[1]."</textarea></div> <div><b>GT-QUICKSTART OUTPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".hwd_vs_ConverterTools::processOutput($result[2])."</textarea></div>"; $output.= "</textarea></div></div>"; $result[3] = $output; return $result; }
/** * CONVERT VIDEOS TO FLV FORMAT * @param database A database connector object */ function generateOutput($result) { $c = hwd_vs_Config::get_instance(); $output = ''; $output.= "<div class=\"box\"><div><h2>Injecting Meta Data</h2></div>"; if ($result[0] == 1) { $output.= "<div class=\"success\">SUCCESS: Executed FLVTOOL2</div>"; } else if ($result[0] == 0) { $output.= "<div class=\"error\">ERROR: Could Not Execute FLVTOOL2</div>"; } $output.= "<div><b>FLVTOOL2 INPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".$result[2]."</textarea></div> <div><b>FLVTOOL2 OUTPUT (Empty output generally indicates success)</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".hwd_vs_ConverterTools::processOutput($result[3])."</textarea></div>"; $output.= "</textarea></div></div>"; $result[4] = $output; return $result; }
/** * CONVERT VIDEOS TO FLV FORMAT * @param database A database connector object */ function generateOutput($result) { $c = hwd_vs_Config::get_instance(); $output = ''; $output.= "<div class=\"box\"><div><h2>Generating Static Thumbnail</h2></div>"; if ($result[0] == 0) { $output.= "<div class=\"error\">ERROR: Thumbnail image could not be generated.</div>"; } else if ($result[0] == 1) { $output.= "<div class=\"success\">SUCCESS: Thumbnail image successfully generated.</div>"; } $output.= "<div><b>FFMPEG INPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".$result[2]."</textarea></div> <div><b>FFMPEG OUTPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".hwd_vs_ConverterTools::processOutput($result[3])."</textarea></div>"; $output.= "</textarea></div></div>"; $output.= "<div class=\"box\"><div><h2>Generating Dynamic Thumbnail</h2></div>"; if ($result[1] == 0) { $output.= "<div class=\"error\">ERROR: Thumbnail image could not be generated.</div>"; } else if ($result[1] == 1) { $output.= "<div class=\"success\">SUCCESS: Thumbnail image successfully generated.</div>"; } $output.= "<div><b>FFMPEG INPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".$result[4]."</textarea></div> <div><b>FFMPEG OUTPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".hwd_vs_ConverterTools::processOutput($result[5])."</textarea></div>"; $output.= "</textarea></div></div>"; $result[9] = $output; return $result; }
/** * CONVERT VIDEOS TO FLV FORMAT * @param database A database connector object */ function generateOutput($result, $gen_flv, $gen_mp4) { $c = hwd_vs_Config::get_instance(); $output = ''; if ($gen_flv == 1) { $output.= "<div class=\"box\"><div><h2>Converting FLV Video</h2></div>"; if ($result[0] == 0) { $output.= "<div class=\"error\">ERROR: Problem with ".$c->encoder." - No Videos converted.</div>"; } else if ($result[0] == 1) { $output.= "<div class=\"error\">ERROR: Problem with ".$c->encoder." - Output video has zero filesize.</div>"; } else if ($result[0] == 2) { $output.= "<div class=\"success\">SUCCESS: FLV File Created</div>"; } $output.= "<div><b>".$c->encoder." INPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".$result[2]."</textarea></div> <div><b>".$c->encoder." OUTPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".hwd_vs_ConverterTools::processOutput($result[3])."</textarea></div>"; $output.= "</textarea></div></div>"; } if ($gen_mp4 == 1) { $output.= "<div class=\"box\"><div><h2>Converting MP4 Video</h2></div>"; if ($result[1] == 0) { $output.= "<div class=\"error\">ERROR: Problem with ".$c->encoder." - No Videos converted.</div>"; } else if ($result[1] == 1) { $output.= "<div class=\"error\">ERROR: Problem with ".$c->encoder." - Output video has zero filesize.</div>"; } else if ($result[1] == 2) { $output.= "<div class=\"success\">SUCCESS: MP4 File Created</div>"; } $output.= "<div><b>".$c->encoder." INPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".$result[4]."</textarea></div> <div><b>".$c->encoder." OUTPUT</b></div> <div><textarea rows=\"3\" cols=\"50\" style=\"width:90%\">".hwd_vs_ConverterTools::processOutput($result[5])."</textarea></div>"; $output.= "</textarea></div></div>"; } $output.= @$result[7][3]; $result[6] = $output; return $result; }
/** * Finish conversion **/ function finish($n, $count, $row, $filename_original, $filename_noext, $duration, $thumb_position, $path_new_flv, $path_original) { $output = ""; $output.= "<div class=\"box\"><div><h2>Finishing Conversion (File ".$n." of ".$count.")</h2></div>"; $output.= "<div><b>UPDATING STATUS TO PENDING</b></div>"; hwd_vs_ConverterTools::setPending($row, $filename_original); $output.= "<div><b>UPDATING VIDEO ID</b></div>"; hwd_vs_ConverterTools::updateVideoId($row, $filename_original, $filename_noext); $output.= "<div><b>UPDATING VIDEO DURATION</b></div>"; hwd_vs_ConverterTools::addDuration($row, $filename_noext, $duration); $output.= "<div><b>UPDATING VIDEO DURATION</b></div>"; hwd_vs_ConverterTools::addThumbPosition($row, $filename_noext, $thumb_position); $output.= "<div><b>CHECKING AUTOAPPROVAL SETTINGS</b></div>"; hwd_vs_ConverterTools::autoApprove($row, $filename_noext); $output.= "<div><b>DELETING ORIGINAL</b></div>"; hwd_vs_ConverterTools::deleteOriginal($path_new_flv, $path_original); $output.= "<div class=\"success\"><b>SUCCESS: All processes complete for file ".$n." of ".$count."</b></div>"; $output.= "</div>"; return $output; }
} $output.= "<div><b>RE-APPROVING</b></div>"; $sql = "UPDATE ".$row->dbprefix."hwdvidsvideos SET approved='yes' WHERE id = ".$result['id']; $db = @mysql_query($sqlpending); if (!$db) { @mysql_close($dbconnect); $connectServer = hwd_vs_ConverterTools::connectServer($row); $connectDatabase = hwd_vs_ConverterTools::connectDatabase($row, $connectServer); @mysql_query($sql) or die('error: ' . mysql_error()); } $output.= "</div>"; /** * Finish **/ $n = $n + 1; $output.= "</div>"; } } /** * END WHILE **/ $output.= "</body></html>"; $closeServer = hwd_vs_ConverterTools::closeServer($connectServer); $internal = intval(@$_REQUEST['internal']); if ($internal == 1) { print $output; } ?>
/** * CONVERT VIDEOS TO FLV FORMAT * @param database A database connector object */ function extract($path_new, $output) { defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); defined('CONVERTPATH') ? null : define('CONVERTPATH', dirname(__FILE__)); if(substr(PHP_OS, 0, 3) == "WIN") { defined('JPATH_SITE') ? null : define('JPATH_SITE', str_replace("\components\com_hwdvideoshare\converters", "", CONVERTPATH) ); } else { defined('JPATH_SITE') ? null : define('JPATH_SITE', str_replace("/components/com_hwdvideoshare/converters", "", CONVERTPATH) ); } // get hwdVideoShare general settings include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'config.hwdvideoshare.php'); $c = hwd_vs_Config::get_instance(); // get hwdVideoShare server settings include_once(JPATH_SITE.DS.'administrator'.DS.'components'.DS.'com_hwdvideoshare'.DS.'serverconfig.hwdvideoshare.php'); $s = hwd_vs_SConfig::get_instance(); $result = array(); $full_sec = ''; $half_sec = ''; $extension = "ffmpeg"; $extension_soname = $extension . "." . PHP_SHLIB_SUFFIX; $extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname; // Try to load extension // If extension is not loaded, don't try! Instead, grep for duration from shell output. if(extension_loaded($extension)) { $video_info = @new ffmpeg_movie($path_new); //duration of new flv file. if ($video_info) { $full_sec = $video_info->getDuration(); // Gets the duration in secs. } } if(empty($full_sec) && $c->encoder == "MENCODER" && !empty($output)) { if (preg_match('/Video stream:.*bytes..(.*?).sec/', $output, $regs)) { $full_sec = $regs[1]; } } if(empty($full_sec)) { $cmd_input_ffmpeg = "$s->ffmpegpath -i $path_new"; @exec("$sharedlib $cmd_input_ffmpeg 2>&1", $cmd_output_ffmpeg); $cmd_output_ffmpeg = implode($cmd_output_ffmpeg); if (@preg_match('/Duration:.(.*?),.start/', $cmd_output_ffmpeg, $regs)) { $full_sec = hwd_vs_ConverterTools::hms2sec($regs[1]); } } if ($full_sec == "" || !is_numeric($full_sec)) { $full_sec = 2; } //get the middle of the movie (time; 00:00:00 format) for thumbnail $half_sec = $full_sec / 2; $half_sec = @round($half_sec); $result = array(); $result[0] = hwd_vs_ConverterTools::sec2hms($full_sec); // result of full duration $result[1] = hwd_vs_ConverterTools::sec2hms($half_sec); // result of mid-point duration $result[2] = 0; // status of ffmpeg-php extension $result[3] = ''; // holder for output text if(extension_loaded($extension)) { $result[2] = 1; } $result = hwd_vs_ExtractDuration::generateOutput($result); return $result; }