aboutsummaryrefslogtreecommitdiff
path: root/libraries/phpvideotoolkit/examples/php4
diff options
context:
space:
mode:
authorDalyn Cessac <dalyn.cessac@1214036.no-reply.drupal.org>2011-03-16 11:06:40 -0500
committerDalyn Cessac <dalyn.cessac@1214036.no-reply.drupal.org>2011-03-16 11:06:40 -0500
commita435de089da4dd37c3c183f633a49107c720dd95 (patch)
tree5f92decbf2d4bb27f85c49bfc5b4fcaf938b58b4 /libraries/phpvideotoolkit/examples/php4
parenta31b9883849b0a04420ee1d476fbe08c87bc5d53 (diff)
downloadvideo-a435de089da4dd37c3c183f633a49107c720dd95.tar.gz
video-a435de089da4dd37c3c183f633a49107c720dd95.tar.bz2
Added phpvideotoolkit transcoder and updates to the preset ui
Diffstat (limited to 'libraries/phpvideotoolkit/examples/php4')
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example01.php151
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example02.php139
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example03.php114
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example04.php171
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example05.php84
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example06.php146
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example07.php120
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example08.php32
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example09.php78
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example10.php128
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example11.php33
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example12.php236
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example13.php111
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example14.php71
-rw-r--r--libraries/phpvideotoolkit/examples/php4/example15.php42
15 files changed, 1656 insertions, 0 deletions
diff --git a/libraries/phpvideotoolkit/examples/php4/example01.php b/libraries/phpvideotoolkit/examples/php4/example01.php
new file mode 100644
index 0000000..8bdd52f
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example01.php
@@ -0,0 +1,151 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><script type="text/javascript" charset="utf-8" src="../common/pluginobject/pluginobject.js"></script><script>PO.Options.auto_load_prefix="../common/pluginobject/plugins/";</script><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to convert video to flash video (flv).</strong><br />';
+ echo '<span class="small">&bull; The media player used below is Jeroen Wijering\'s excellent <a href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">Flash Media Player</a>. Although bundled with this package the Flash Media Player has a <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic</a> license.</span><br />';
+ echo '<span class="small">&bull; The media player is embedded using <a href="http://sourceforge.net/projects/pluginobject/">PluginObject</a> to embed the examples. It is distributed under a BSD License.</span><br /><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV00007.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'Video000.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'cat.mpeg'
+ );
+
+// output files dirname has to exist
+ $video_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'videos'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// bit rate of audio (valid vaues are 16,32,64)
+ $bitrate = 64;
+
+// sampling rate (valid values are 11025, 22050, 44100)
+ $samprate = 44100;
+
+// start PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// set PHPVideoToolkit class to run silently
+ $toolkit->on_error_die = FALSE;
+
+// start the timer collection
+ $total_process_time = 0;
+
+// loop through the files to process
+ foreach($files_to_process as $key=>$file)
+ {
+// get the filename parts
+ $filename = basename($file);
+ $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
+ echo '<strong>Processing '.$filename.'</strong><br />';
+
+// set the input file
+ $ok = $toolkit->setInputFile($file);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br /><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// set the output dimensions
+ $toolkit->setVideoOutputDimensions(320, 240);
+
+// set the video to be converted to flv
+ $toolkit->setFormatToFLV($samprate, $bitrate);
+
+// set the output details and overwrite if nessecary
+ $ok = $toolkit->setOutput($video_output_dir, $filename_minus_ext.'.flv', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br /><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// execute the ffmpeg command using multiple passes and log the calls and ffmpeg results
+ $result = $toolkit->execute(true, true);
+
+// get the last command given
+ $command = $toolkit->getLastCommand();
+// echo $command[0]."<br />\r\n";
+// echo $command[1]."<br />\r\n";
+
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.$filename_minus_ext.'.log');
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br /><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// get the process time of the file
+ $process_time = $toolkit->getLastProcessTime();
+ $total_process_time += $process_time;
+
+ $file = array_shift($toolkit->getLastOutput());
+ $filename = basename($file);
+ $filename_hash = md5($filename);
+
+// echo a report to the buffer
+ echo 'Video converted in '.$process_time.' seconds... <b>'.$file.'</b><br /><br />
+<div id="'.$filename_hash.'"></div>
+<script type="text/javascript" charset="utf-8">
+ PluginObject.embed("../working/processed/videos/'.$filename.'", {
+ width : 320,
+ height: 240,
+ force_plugin:PluginObject.Plugins.FlashMedia,
+ player: "../common/mediaplayer/player.swf",
+ force_into_id:"'.$filename_hash.'",
+ overstretch:true,
+ params: {
+ autoplay: false
+ }
+ });
+</script><br />'."\r\n";
+
+// reset
+ $toolkit->reset();
+ }
+
+ echo ''."\r\n".'The total time taken to process all '.($key+1).' file(s) is : <b>'.$total_process_time.'</b>';
+ echo '<br />'."\r\n".'The average time taken to process each file is : <b>'.($total_process_time/($key+1)).'</b>';
+ echo '</body></html>'; \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example02.php b/libraries/phpvideotoolkit/examples/php4/example02.php
new file mode 100644
index 0000000..345bcf4
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example02.php
@@ -0,0 +1,139 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to extract frames from a movie.</strong><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+ echo '<span class="alert"><strong>Note; </strong>This example should work correctly, however it\'s not. I don\'t currently understand why it\'s not producing the expected thumbnails. I\'m currently looking into it and the example will be updated when this process is fixed.</span><br /><br />';
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV00007.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'Video000.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'cat.mpeg'
+ );
+
+// output files dirname has to exist
+ $thumbnail_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'thumbnails'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// start PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// set PHPVideoToolkit class to run silently
+ $toolkit->on_error_die = FALSE;
+
+// the number of frames to extract per second
+ $extraction_frame_rate = 5;
+
+// start the timer collection
+ $total_process_time = 0;
+
+// loop through the files to process
+ foreach($files_to_process as $key=>$file)
+ {
+// get the filename parts
+ $filename = basename($file);
+ $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
+ echo '<strong>Extracting '.$filename.'</strong><br />';
+
+// set the input file
+ $ok = $toolkit->setInputFile($file, $extraction_frame_rate);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// set the output dimensions
+ $toolkit->setVideoOutputDimensions(160, 120);
+
+// extract thumbnails from the third second of the video, but we only want to limit the number of frames to 10
+ $info = $toolkit->getFileInfo();
+ echo 'We are extracting frames at a rate of '.$extraction_frame_rate.'/second so for this file we should have '.ceil($info['duration']['seconds']*$extraction_frame_rate).' frames below.<br />';
+ $toolkit->extractFrames('00:00:00', false, $extraction_frame_rate, false, '%hh:%mm:%ss');
+
+// set the output details
+ $ok = $toolkit->setOutput($thumbnail_output_dir, $filename_minus_ext.'[%timecode].jpg', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+// $ok = $toolkit->setOutput($thumbnail_output_dir, $filename_minus_ext.'[%12index].jpg', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// execute the ffmpeg command
+ $result = $toolkit->execute(false, true);
+
+// get the last command given
+// $command = $toolkit->getLastCommand();
+// echo $command."<br />\r\n";
+
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.$filename_minus_ext.'.log');
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// get the process time of the file
+ $process_time = $toolkit->getLastProcessTime();
+ $total_process_time += $process_time;
+
+ $files = $toolkit->getLastOutput();
+
+ echo 'Frames grabbed in '.$process_time.' seconds... <b>'.$thumbnail_output_dir.array_pop($files).'</b><br />'."\r\n";
+ foreach($files as $key=>$file)
+ {
+ echo '<img src="../working/processed/thumbnails/'.$file.'" alt="" border="0" /> ';
+ }
+ echo '<br /><br />';
+
+// reset
+ $toolkit->reset();
+
+ }
+
+ echo ''."\r\n".'The total time taken to process all '.($key+1).' file(s) is : <b>'.$total_process_time.'</b>';
+ echo '<br />'."\r\n".'The average time taken to process each file is : <b>'.($total_process_time/($key+1)).'</b>';
+ echo '</body></html>'; \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example03.php b/libraries/phpvideotoolkit/examples/php4/example03.php
new file mode 100644
index 0000000..8e38e75
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example03.php
@@ -0,0 +1,114 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to compile a movie from multiple jpegs.</strong><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// output files dirname has to exist
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-1.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-2.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-3.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-4.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-5.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-6.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-7.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-8.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-9.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-10.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-11.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-12.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-13.jpg',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'mov02596-14.jpg'
+ );
+
+ $sound = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'Ballad_of_the_Sneak.mp3';
+
+// output files dirname has to exist
+ $video_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'videos'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// output filename
+ $output_filename = 'my-picture-movie.gif';
+// $output_filename = 'my-picture-movie.mpeg';
+
+// init PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// compile the image to the tmp dir with an input frame rate of 2 per second
+ $ok = $toolkit->prepareImagesForConversionToVideo($files_to_process, 2);
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ exit;
+ }
+
+// set a different output size (this will shrink the images to a video that is smaller, the images are 320x240)
+ $toolkit->setVideoOutputDimensions(160, 120);
+
+// set endless looping
+ $toolkit->setGifLoops(0);
+// $toolkit->addAudio($sound);
+
+// set the output parameters
+ $ok = $toolkit->setOutput($video_output_dir, $output_filename, PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ exit;
+ }
+
+// execute the ffmpeg command
+ $result = $toolkit->execute(false, true);
+
+// get the last command given
+// $command = $toolkit->getLastCommand();
+// echo $command."<br />\r\n<br />\r\n";
+
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.'example03.log');
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ exit;
+ }
+ $toolkit->moveLog($log_dir.'example03.log');
+
+ $img = array_shift($toolkit->getLastOutput());
+ echo "Video created from images... <b>".basename($img)."</b><br />";
+ echo '<img src="../working/processed/videos/'.basename($img).'" border="0" /><br /><br />';
+ echo '</body></html>';
diff --git a/libraries/phpvideotoolkit/examples/php4/example04.php b/libraries/phpvideotoolkit/examples/php4/example04.php
new file mode 100644
index 0000000..36cb5a4
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example04.php
@@ -0,0 +1,171 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><script type="text/javascript" charset="utf-8" src="../common/pluginobject/pluginobject.js"></script><script>PO.Options.auto_load_prefix="../common/pluginobject/plugins/";</script><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to watermark a video. Please note; that in order to watermark a video FFmpeg has to have been compiled with vhooks enabled.</strong><br />';
+ echo '<span class="small">&bull; The media player is embedded using <a href="http://sourceforge.net/projects/pluginobject/">PluginObject</a> to embed the video examples. It is distributed under a BSD License.</span><br /><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// please replace xxxxx with the full absolute path to the files and folders
+// also please make the $thumbnail_output_dir read and writeable by the webserver
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $video_to_process = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'cat.mpeg';
+ $watermark = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'watermark.png';
+// $watermark = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'watermark.gif';
+
+// output files dirname has to exist
+ $video_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'videos'.DS;
+
+// output files dirname has to exist
+ $thumbnail_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'thumbnails'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// start PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+ $use_vhook = !isset($_GET['gd']) || $_GET['gd'] == '0';
+ if($use_vhook)
+ {
+// check to see if vhook support is enabled
+ echo '<strong>Testing for vhook support...</strong><br />';
+ if(!$toolkit->hasVHookSupport())
+ {
+ echo '<span class="alert">You FFmpeg binary has NOT been compiled with vhook support, you can not watermark video, you can however watermark image outputs.</span><br /><a href="?gd=1">Click here</a> to run the watermark demo on images only.<br />';
+ exit;
+//<- exits
+ }
+ echo 'You FFmpeg binary has been compiled with vhook support.<br /><br />';
+ }
+ else
+ {
+ echo '<strong>GD watermarking only...</strong><br />';
+ echo '<span class="alert">Your FFmpeg binary has NOT been compiled with vhook support and we are only testing automated watermarking of images via GD now.</span><br /><a href="?gd=0">Click here</a> to go back to the vhook watermarking demo.<br /><br />';
+ }
+
+// set ffmpeg class to run silently
+ $toolkit->on_error_die = FALSE;
+
+// get the filename parts
+ $filename = basename($video_to_process);
+ $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
+
+// set the input file
+ $ok = $toolkit->setInputFile($video_to_process);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ exit;
+ }
+
+// set the output dimensions
+ $toolkit->setVideoOutputDimensions(PHPVIDEOTOOLKIT_SIZE_SAS);
+
+// are we vhooking the videos?
+ if($use_vhook)
+ {
+ $toolkit->addWatermark($watermark);
+ $ok = $toolkit->setOutput($video_output_dir, $filename_minus_ext.'-watermarked.3gp', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+ }
+// or just outputting images with watermarks?
+ else
+ {
+ $toolkit->addGDWatermark($watermark, array('x-offset'=>-15, 'y-offset'=>-15, 'position'=>'center-middle'));
+// extract a single frame
+ $toolkit->extractFrame('00:00:03.5');
+ $ok = $toolkit->setOutput($thumbnail_output_dir, $filename_minus_ext.'-watermarked.jpeg', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+ }
+
+// set the output details
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ exit;
+ }
+
+// execute the ffmpeg command
+ $result = $toolkit->execute(false, true);
+
+// get the last command given
+// $command = $toolkit->getLastCommand();
+// echo $command."<br />\r\n";
+
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.$filename_minus_ext.'.log');
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ exit;
+ }
+
+ $file = array_shift($toolkit->getLastOutput());
+ $filename = basename($file);
+ if($use_vhook)
+ {
+ $filename_hash = md5($filename);
+
+ echo 'Video watermarked... <b>'.$filename.'</b><br /><br />
+<div id="'.$filename_hash.'"></div>
+<script type="text/javascript" charset="utf-8">
+ PluginObject.embed("../working/processed/videos/'.$filename.'", {
+ width : 320,
+ height: 240,
+ force_plugin:PluginObject.Plugins.Quicktime,
+ force_into_id:"'.$filename_hash.'",
+ params: {
+ autoplay: false
+ }
+ });
+</script><br />'."\r\n";
+ }
+ else
+ {
+ echo 'Frame watermarked... <b>'.$filename.'</b><br />'."\r\n";
+// $files = $toolkit->getLastOutput();
+// foreach($files as $key=>$file)
+// {
+// echo '<img src="../working/processed/thumbnails/'.$file.'" alt="" border="0" /> ';
+// }
+ echo '<img src="../working/processed/thumbnails/'.$filename.'" alt="" border="0" /> ';
+ }
+
+// reset
+ $toolkit->reset();
+
+ echo '</body></html>';
diff --git a/libraries/phpvideotoolkit/examples/php4/example05.php b/libraries/phpvideotoolkit/examples/php4/example05.php
new file mode 100644
index 0000000..46399e6
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example05.php
@@ -0,0 +1,84 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to access media metadata without using the ffmpeg-php library.</strong><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// please replace xxxxx with the full absolute path to the files and folders
+// also please make the $video_output_dir read and writeable by the webserver
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV00007.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'Video000.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'cat.mpeg'
+ );
+
+// output files dirname has to exist
+ $video_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'videos'.DS;
+
+// bit rate of audio (valid vaues are 16,32,64)
+ $bitrate = 64;
+
+// sampling rate (valid values are 11025, 22050, 44100)
+ $samprate = 44100;
+
+// start PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// set PHPVideoToolkit class to run silently
+ $toolkit->on_error_die = FALSE;
+
+// loop through the files to process
+ foreach($files_to_process as $file)
+ {
+ echo '<strong>Information for : '.$file."</strong><br />\r\n";
+// set the input file
+ $ok = $toolkit->setInputFile($file);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+ $data = $toolkit->getFileInfo();
+
+ echo '<pre>';
+ print_r($data);
+ echo '</pre>';
+
+// reset
+ $toolkit->reset();
+ }
+
+ echo '</body></html>'; \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example06.php b/libraries/phpvideotoolkit/examples/php4/example06.php
new file mode 100644
index 0000000..71f4822
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example06.php
@@ -0,0 +1,146 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><script type="text/javascript" charset="utf-8" src="../common/pluginobject/pluginobject.js"></script><script>PO.Options.auto_load_prefix="../common/pluginobject/plugins/";</script><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to extract audio from video.</strong><br />';
+ echo '<span class="small">&bull; The media player used below is Jeroen Wijering\'s excellent <a href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">Flash Media Player</a>. Although bundled with this package the Flash Media Player has a <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic</a> license.</span><br />';
+ echo '<span class="small">&bull; The media player is embedded using <a href="http://sourceforge.net/projects/pluginobject/">PluginObject</a> to embed the examples. It is distributed under a BSD License.</span><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV00007.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'cat.mpeg'
+ );
+
+// output files dirname has to exist
+ $audio_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'audio'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// bit rate of audio (valid vaues are 16,32,64)
+ $bitrate = 64;
+
+// sampling rate (valid values are 11025, 22050, 44100)
+ $samprate = 44100;
+
+// start PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// set PHPVideoToolkit class to run silently
+ $toolkit->on_error_die = FALSE;
+
+// start the timer collection
+ $total_process_time = 0;
+
+// loop through the files to process
+ foreach($files_to_process as $key=>$file)
+ {
+// get the filename parts
+ $filename = basename($file);
+ $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
+ echo '<strong>Processing '.$filename.'</strong><br />';
+
+// set the input file
+ $ok = $toolkit->setInputFile($file);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br /><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// set the audio extraction settings
+ $toolkit->extractAudio(PHPVIDEOTOOLKIT_FORMAT_MP3, $samprate, $bitrate);
+
+// set the output details and overwrite if nessecary
+ $ok = $toolkit->setOutput($audio_output_dir, $filename_minus_ext.'.mp3', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br /><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// execute the ffmpeg command and log the calls and ffmpeg results
+ $result = $toolkit->execute(false, true);
+
+// get the last command given
+// $command = $toolkit->getLastCommand();
+// echo $command[0]."<br />\r\n";
+// echo $command[1]."<br />\r\n";
+
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.$filename_minus_ext.'.log');
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br /><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// get the process time of the file
+ $process_time = $toolkit->getLastProcessTime();
+ $total_process_time += $process_time;
+
+ $file = array_shift($toolkit->getLastOutput());
+ $filename = basename($file);
+ $filename_hash = md5($filename);
+
+ echo 'Audio extracted in '.$process_time.' seconds...<br />
+<div id="'.$filename_hash.'"></div>
+<script type="text/javascript" charset="utf-8">
+ PluginObject.embed("../working/processed/audio/'.$filename.'", {
+ width : 350,
+ height: 20,
+ player: "../common/mediaplayer/player.swf",
+ force_plugin:PluginObject.Plugins.FlashMedia,
+ auto_adjust_height:false,
+ force_into_id:"'.$filename_hash.'",
+ params: {
+ autoplay: false
+ }
+ });
+</script><br />'."\r\n";
+
+// reset
+ $toolkit->reset();
+ }
+
+ echo "\r\n".'The total time taken to process all '.($key+1).' file(s) is : <b>'.$total_process_time.'</b>';
+ echo '<br />'."\r\n".'The average time taken to process each file is : <b>'.($total_process_time/($key+1)).'</b>';
+ echo '</body></html>'; \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example07.php b/libraries/phpvideotoolkit/examples/php4/example07.php
new file mode 100644
index 0000000..a091565
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example07.php
@@ -0,0 +1,120 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><script type="text/javascript" charset="utf-8" src="../common/pluginobject/pluginobject.js"></script><script>PO.Options.auto_load_prefix="../common/pluginobject/plugins/";</script><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to join multiple videos together.<br />Please note that this example while valid code does not work yet within the PHPVideoToolkit class.</strong><br />';
+ exit;
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV02820.MPG',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV02832.MPG'// ,
+ // PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV02820.MPG'
+ );
+
+// output files dirname has to exist
+ $video_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'videos'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// bit rate of audio (valid vaues are 16,32,64)
+ $bitrate = 64;
+
+// sampling rate (valid values are 11025, 22050, 44100)
+ $samprate = 44100;
+
+// start PHPVideoToolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// set PHPVideoToolkit class to run silently
+ $toolkit->on_error_die = FALSE;
+
+ $input_file = array_pop($files_to_process);
+// get the filename parts
+ $filename = basename($input_file);
+ $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
+
+// set the input file
+ $ok = $toolkit->setInputFile($input_file);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ $toolkit->reset();
+ exit;
+ }
+// $toolkit->setFormat(PHPVIDEOTOOLKIT_FORMAT_MPEGVIDEO);
+ $toolkit->setVideoOutputDimensions(PHPVIDEOTOOLKIT_SIZE_QVGA);
+
+// loop through the files to process
+ foreach($files_to_process as $file)
+ {
+ $toolkit->addVideo($file);
+ }
+
+// set the output details and overwrite if nessecary
+ $ok = $toolkit->setOutput($video_output_dir, $filename_minus_ext.'-joined.mpeg', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ $toolkit->reset();
+ exit;
+ }
+
+// execute the ffmpeg command and log the calls and PHPVideoToolkit results
+ $result = $toolkit->execute(false, true);
+
+// get the last command given
+// $command = $toolkit->getLastCommand();
+// echo $command[0]."<br />\r\n";
+// echo $command[1]."<br />\r\n";
+
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.$filename_minus_ext.'.log');
+// if there was an error then get it
+ echo $toolkit->getLastError()."<br />\r\n";
+ $toolkit->reset();
+ exit;
+ }
+
+ echo 'Videos joined... <b>'.array_shift($toolkit->getLastOutput()).'</b><br />'."\r\n";
+
+// reset
+ $toolkit->reset();
+
+ echo '</body></html>';
diff --git a/libraries/phpvideotoolkit/examples/php4/example08.php b/libraries/phpvideotoolkit/examples/php4/example08.php
new file mode 100644
index 0000000..116eab1
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example08.php
@@ -0,0 +1,32 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><script type="text/javascript" charset="utf-8" src="../common/pluginobject/pluginobject.js"></script><script>PO.Options.auto_load_prefix="../common/pluginobject/plugins/";</script><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to convert videos to common formats simply by using the simple adapters.</strong><br />';
+ echo '<span class="small">&bull; The flash media player used below is Jeroen Wijering\'s excellent <a href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">Flash Media Player</a>. Although bundled with this package the Flash Media Player has a <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic</a> license.</span><br />';
+ echo '<span class="small">&bull; The media is embedded using <a href="http://sourceforge.net/projects/pluginobject/">PluginObject</a> to embed the examples. It is distributed under a BSD License.</span><br /><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+ echo '<strong class="alert">You cannot use the VideoTo Adapter class in PHP4. I will NOT be offering a PHP4 alternative.</strong><br /><br />';
+ echo '</body></html>'; \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example09.php b/libraries/phpvideotoolkit/examples/php4/example09.php
new file mode 100644
index 0000000..93112b5
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example09.php
@@ -0,0 +1,78 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to access the information about your ffmpeg installation.</strong><br /><br />';
+ $ignore_demo_files = true;
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// start ffmpeg class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// get the ffmpeg info
+ $info = $toolkit->getFFmpegInfo();
+
+// determine the type of support for ffmpeg-php
+ echo '<strong>FFmpeg-PHP Support</strong><br />';
+
+// determine if ffmpeg-php is supported
+ $has_ffmpeg_php_support = $toolkit->hasFFmpegPHPSupport();
+// you can also determine if it has ffmpeg php support with below
+// $has_ffmpeg_php_support = $info['ffmpeg-php-support'];
+
+ switch($has_ffmpeg_php_support)
+ {
+ case 'module' :
+ echo 'Congratulations you have the FFmpeg-PHP module installed.<br />';
+ break;
+
+ case 'emulated' :
+ echo 'You haven\'t got the FFmpeg-PHP module installed, however you can use the PHPVideoToolkit\'s adapter\'s to emulate FFmpeg-PHP.<br />In order to make use of the FFmpeg-PHP adapter class all you need to do is add the following, replacing xxxx with the path to the files, then use FFmpeg-PHP as normal.
+<br /><pre> if(!class_exists(\'ffmpeg_movie\'))
+ {
+ require_once \'xxxx/adapters/ffmpeg-php/ffmpeg_movie.php\';
+ require_once \'xxxx/adapters/ffmpeg-php/ffmpeg_frame.php\';
+ require_once \'xxxx/adapters/ffmpeg-php/ffmpeg_animated_gif.php\';
+ }</pre><strong>Note:</strong> It is recommended that if you heavily use FFmpeg-PHP that you install the module. <br />
+';
+ break;
+
+ case false :
+ echo 'You have no support at all for FFmpeg-PHP.<br />';
+ break;
+ }
+
+ echo '<br /><strong>This is the information that is accessible about your install of FFmpeg.</strong><br />';
+ echo '<span class="small">You may also wish to see <a href="example14.php">example 14</a> which gives you an encode/decode lookup table.</span>';
+ echo '<pre>';
+ print_r($info);
+ echo '</pre>';
+ echo '</body></html>';
+ \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example10.php b/libraries/phpvideotoolkit/examples/php4/example10.php
new file mode 100644
index 0000000..76094cd
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example10.php
@@ -0,0 +1,128 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to extract a specific frame from a movie</strong>.<br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// please replace xxxxx with the full absolute path to the files and folders
+// also please make the $thumbnail_output_dir read and writeable by the webserver
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+// input movie files
+ $files_to_process = array(
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'MOV00007.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'Video000.3gp',
+ PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'cat.mpeg'
+ );
+
+// output files dirname has to exist
+ $thumbnail_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'thumbnails'.DS;
+
+// log dir
+ $log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'logs'.DS;
+
+// start phpvideotoolkit class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+// set phpvideotoolkit class to run silently
+ $toolkit->on_error_die = FALSE;
+
+// start the timer collection
+ $total_process_time = 0;
+
+// loop through the files to process
+ foreach($files_to_process as $key=>$file)
+ {
+// get the filename parts
+ $filename = basename($file);
+ $filename_minus_ext = substr($filename, 0, strrpos($filename, '.'));
+
+// set the input file
+ $ok = $toolkit->setInputFile($file);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// set the output dimensions
+ $toolkit->setVideoOutputDimensions(PHPVIDEOTOOLKIT_SIZE_SQCIF);
+
+// extract a thumbnail from the fifth frame two seconds into the video
+ $toolkit->extractFrame('00:00:02.5');
+
+// set the output details
+ $ok = $toolkit->setOutput($thumbnail_output_dir, $filename_minus_ext.'.jpg', PHPVIDEOTOOLKIT_OVERWRITE_EXISTING);
+// check the return value in-case of error
+ if(!$ok)
+ {
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// execute the ffmpeg command
+ $result = $toolkit->execute(false, true);
+
+// get the last command given
+// $command = $toolkit->getLastCommand();
+// echo $command."<br />\r\n";
+// check the return value in-case of error
+ if($result !== PHPVIDEOTOOLKIT_RESULT_OK)
+ {
+// move the log file to the log directory as something has gone wrong
+ $toolkit->moveLog($log_dir.$filename_minus_ext.'.log');
+// if there was an error then get it
+ echo '<b>'.$toolkit->getLastError()."</b><br />\r\n";
+ $toolkit->reset();
+ continue;
+ }
+
+// get the process time of the file
+ $process_time = $toolkit->getLastProcessTime();
+ $total_process_time += $process_time;
+
+ $file = array_shift($toolkit->getLastOutput());
+
+ echo 'Frame grabbed in '.$process_time.' seconds... <b>'.$thumbnail_output_dir.$file.'</b><br />'."\r\n";
+ echo '<img src="../working/processed/thumbnails/'.$file.'" alt="" border="0" /><br /><br />';
+
+// reset
+ $toolkit->reset();
+
+ }
+
+ echo '<br />'."\r\n".'The total time taken to process all '.($key+1).' file(s) is : <b>'.$total_process_time.'</b>';
+ echo '<br />'."\r\n".'The average time taken to process each file is : <b>'.($total_process_time/($key+1)).'</b><br /><br />';
+ echo '</body></html>';
diff --git a/libraries/phpvideotoolkit/examples/php4/example11.php b/libraries/phpvideotoolkit/examples/php4/example11.php
new file mode 100644
index 0000000..2c403e2
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example11.php
@@ -0,0 +1,33 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to use the ffmpeg-php adaptor scripts. NOTE: Please note whenever possible you should use ffmpeg-php as it is much more efficient than this pure PHP emulation.</strong><br />';
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+ echo '<strong class="alert">You cannot use the FFmpeg-PHP Adapter class in PHP4. I will NOT be offering a PHP4 alternative.</strong><br /><br />';
+ echo '</body></html>';
+
+
+
diff --git a/libraries/phpvideotoolkit/examples/php4/example12.php b/libraries/phpvideotoolkit/examples/php4/example12.php
new file mode 100644
index 0000000..8ada5fe
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example12.php
@@ -0,0 +1,236 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows you how to manipulate/format timecode strings.</strong><br /><br />';
+ $ignore_demo_files = true;
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+
+
+// set the time to examine / format
+ if(isset($_POST['hours']))
+ {
+// capture timecode and framerate
+ $timecode = str_pad(intval($_POST['hours']), 2, '0', STR_PAD_LEFT).':'.str_pad(intval($_POST['mins']), 2, '0', STR_PAD_LEFT).':'.str_pad(intval($_POST['secs']), 2, '0', STR_PAD_LEFT).'.'.str_pad(intval($_POST['millisecs']), 2, '0', STR_PAD_LEFT);
+ $frame_rate = intval($_POST['framerate']);
+ }
+ else
+ {
+// set the frame rate for the timecodes and default time
+ $timecode = '01:14:32.59';
+ $frame_rate = 25;
+ }
+ $timecode_format = '%hh:%mm:%ss.%ms';
+
+// * default '%hh:%mm:%ss'
+// * - %hh (hours) representative of hours
+// * - %mm (minutes) representative of minutes
+// * - %ss (seconds) representative of seconds
+// * - %fn (frame number) representative of frames (of the current second, not total frames)
+// * - %ms (milliseconds) representative of milliseconds (of the current second, not total milliseconds) (rounded to 3 decimal places)
+// * - %ft (frames total) representative of total frames (ie frame number)
+// * - %st (seconds total) representative of total seconds (rounded).
+// * - %sf (seconds floored) representative of total seconds (floored).
+// * - %sc (seconds ceiled) representative of total seconds (ceiled).
+// * - %mt (milliseconds total) representative of total milliseconds. (rounded to 3 decimal places)
+
+
+// start ffmpeg class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+ echo '<strong>Timecode Format Placeholders</strong><br />';
+ echo 'When you format a timecode or format a number of seconds into a timecode you can use the following placeholders to contain different time and frame values<br /><br />';
+ echo '<table border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td style="width:50px;border-bottom:1px solid #ccc;">
+ <strong>%hh</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ hours
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <strong>%mm</strong>
+ </td>
+ <td>
+ minutes
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ &nbsp;
+ </td>
+ <td class="light small" style="border-bottom:1px solid #ccc;">
+ NOTE: Smart Value Warning. By default if %hh (hours) aren\'t used in the format then this will give the total number of minutes.
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <strong>%ss</strong>
+ </td>
+ <td>
+ seconds
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ &nbsp;
+ </td>
+ <td class="light small" style="border-bottom:1px solid #ccc;">
+ NOTE: Smart Value Warning. By default if %hh (hours) or %mm (mins) aren\'t used in the format then this will give the total number of seconds.
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ <strong>%fn</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ frame number
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ <strong>%ms</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ milliseconds
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ <strong>%ft</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ frames total
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ <strong>%st</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ seconds total
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ <strong>%sf</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ seconds floored
+ </td>
+ </tr>
+ <tr>
+ <td style="border-bottom:1px solid #ccc;">
+ <strong>%sc</strong>
+ </td>
+ <td style="border-bottom:1px solid #ccc;">
+ seconds ceiled
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <strong>%mt</strong>
+ </td>
+ <td>
+ milliseconds total
+ </td>
+ </tr>
+ </table>';
+ echo '<br />';
+ echo 'With regards to the Smart Value Warnings, you can turn off smart values by setting the $use_smart_values argument to false when formatting a timecode.<br /><br />';
+
+ echo '<strong>Original Timecode</strong><br />';
+ echo $timecode.'<br /><br />';
+
+ echo '<strong>Timecode conversion to seconds</strong><br />';
+ echo 'Frame seconds (rounded) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%st', $frame_rate).'<br />';
+ echo 'Frame seconds (rounded down) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%sf', $frame_rate).'<br />';
+ echo 'Frame seconds (rounded up) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%sc', $frame_rate).'<br />';
+ echo 'Frame seconds -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%mt', $frame_rate).'<br /><br />';
+
+ echo '<strong>Timecode conversion to frames</strong><br />';
+ echo 'Frame number (in current second) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%fn', $frame_rate).'<br />';
+ echo 'Frame number (in video) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%ft', $frame_rate).'<br /><br />';
+
+ echo '<strong>Timecode conversion to other timecodes</strong><br />';
+ echo 'hh:mm -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%hh:%mm', $frame_rate).'<br />';
+ echo 'hh:mm:ss -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%hh:%mm:%ss', $frame_rate).'<br />';
+ echo 'hh:mm:ss.fn -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%hh:%mm:%ss.%fn', $frame_rate).'<br />';
+ echo 'hh:mm:ss.ms -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%hh:%mm:%ss.%ms', $frame_rate).'<br />';
+ echo 'mm:ss (smart minutes) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%mm:%ss', $frame_rate).'<br />';
+ echo 'mm:ss.fn (smart minutes) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%mm:%ss.%fn', $frame_rate).'<br />';
+ echo 'ss.ms (smart seconds) -> '.$toolkit->formatTimecode($timecode, $timecode_format, '%ss.%ms', $frame_rate).'<br /><br />';
+
+ // output the timecode form, remembering to disable smart values
+ $use_smart_values = false;
+ echo '<strong>Change Timecode</strong><br />';
+ echo '<form action="example12.php" method="post"><table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td class="small" style="padding-left:4px;">
+ Hours
+ </td>
+ <td class="small" style="padding-left:4px;">
+ Mins
+ </td>
+ <td class="small" style="padding-left:4px;">
+ Secs
+ </td>
+ <td class="small" style="padding-left:4px;">
+ Milli
+ </td>
+ <td class="small" style="padding-left:4px;" colspan="2">
+ Frame Rate
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="text" name="hours" value="'.$toolkit->formatTimecode($timecode, $timecode_format, '%hh', $frame_rate, $use_smart_values).'" id="hours" style="width:35px;margin-right:3px;" />:
+ </td>
+ <td>
+ <input type="text" name="mins" value="'.$toolkit->formatTimecode($timecode, $timecode_format, '%mm', $frame_rate, $use_smart_values).'" id="mins" style="width:35px;margin:0 3px 0 3px;" />:
+ </td>
+ <td>
+ <input type="text" name="secs" value="'.$toolkit->formatTimecode($timecode, $timecode_format, '%ss', $frame_rate, $use_smart_values).'" id="secs" style="width:35px;margin:0 3px 0 3px;" />:
+ </td>
+ <td>
+ <input type="text" name="millisecs" value="'.$toolkit->formatTimecode($timecode, $timecode_format, '%ms', $frame_rate, $use_smart_values).'" id="millisecs" style="width:35px;margin:0 3px 0 3px;" />/
+ </td>
+ <td>
+ <input type="text" name="framerate" value="'.$frame_rate.'" id="framerate" style="width:35px;margin:0 3px 0 3px;" />
+ </td>
+ <td>
+ <input type="submit" value="Update" style="margin:0 0 0 10px;" />
+ </td>
+ </tr>
+</table></form><br />';
+
+ echo '</body></html>';
diff --git a/libraries/phpvideotoolkit/examples/php4/example13.php b/libraries/phpvideotoolkit/examples/php4/example13.php
new file mode 100644
index 0000000..4e97e65
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example13.php
@@ -0,0 +1,111 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * @see JEROEN WIJERING Flash Media Player,
+ * - @link http://www.jeroenwijering.com/?item=JW_FLV_Media_Player
+ * - @author Jeroen Wijering.
+ */
+
+// set the packet details as we are restricting the bandwidth
+// the default details set here mean 5kb per second, ie dialup speed.
+ $packet_size = isset($_GET['packet_size']) ? intval($_GET['packet_size']) : (isset($_COOKIE['packet_size']) ? intval($_COOKIE['packet_size']) : 5);
+ $packet_interval = 1;
+ setcookie('packet_size', $packet_size, time()+7200, '/');
+
+ if(!isset($_GET['file']))
+ {
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><script type="text/javascript" charset="utf-8" src="../common/pluginobject/pluginobject.js"></script><script>PO.Options.auto_load_prefix="../common/pluginobject/plugins/";</script><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example shows how to simply create an FLV stream script.</strong><br />';
+ echo '<span class="small">&bull; The flash media player used below is Jeroen Wijering\'s excellent <a href="http://www.jeroenwijering.com/?item=JW_FLV_Media_Player">Flash Media Player</a>. Although bundled with this package the Flash Media Player has a <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic</a> license.</span><br />';
+ echo '<span class="small">&bull; The media is embedded using <a href="http://sourceforge.net/projects/pluginobject/">PluginObject</a> to embed the examples. It is distributed under a BSD License.</span><br /><br />';
+ }
+
+// load the examples configuration
+ $ignore_config_output = true;
+ require_once '../example-config.php';
+
+// set the flv file
+ $flv = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'to-be-processed'.DS.'rickroll.flv';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+// temp directory
+ $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS;
+// start ffmpeg class
+ $toolkit = new PHPVideoToolkit($tmp_dir);
+
+ if(isset($_GET['file']))
+ {
+// set the flv input
+ $toolkit->setInputFile($flv);
+// get the incoming stream position
+ $stream_pos = isset($_GET['pos']) ? $_GET['pos'] : 0;
+// in this example we will enable bandwidth limiting at the extreme and is not really practicle for live purposes
+// it will only release 100 bytes of the file every second, thus it should take roughly 5 minutes to release a 29Mb file
+// it will also prevent the browser cache from retaining the file.
+ $toolkit->flvStreamSeek($stream_pos, array('active'=>true, 'packet_size'=>$packet_size, 'packet_interval'=>$packet_interval), false);
+ exit;
+//<- exits
+ }
+
+ $size = filesize($flv);
+ echo '<strong>Bandwidth Restrictions and Download Rate.</strong><br />';
+ echo 'The flv media is '.$size.' bytes, using the bandwidth speed limit of '.$packet_size.' kb/s media should be completely loaded in roughly '.$toolkit->formatSeconds(round($size/($packet_interval*1024*$packet_size*2), 1), '%hh hours, %mm minutes, %ss.%ms seconds').'.<br />';
+ echo 'This may not appear to be the case in the player as the player will buffer the contents, You should notice that after a while the player will re-buffer the file. This is because the file was not loaded directly but through this script which buffered the release of the flv.<br />';
+ echo 'However you can test this better by downloading <a href="example13.php?file=../working/to-be-processed/rickroll.flv&pos=0&packet_size='.$packet_size.'">this link</a>.<br />';
+ echo 'You should notice that the file is downloading as a normal file off the internet, however the flv will download at a extremely slowed rate (more like dial-up speed than broadband or DSL) even if you are testing this script on your localhost.<br />';
+ echo '<br />';
+ echo '<strong>Change the example bandwidth restriction.</strong><br />';
+ echo '<select onchange="document.location.href=\''.$_SERVER['PHP_SELF'].'?packet_size=\'+this.value">
+<option label="5 kb/s (Dialup)" value="5"'.($packet_size == '5' ? ' selected' : '').'>5 kb/s (Dialup)</option>
+<option label="10 kb/s" value="10"'.($packet_size == '10' ? ' selected' : '').'>10 kb/s</option>
+<option label="20 kb/s" value="20"'.($packet_size == '20' ? ' selected' : '').'>20 kb/s</option>
+<option label="40 kb/s" value="40"'.($packet_size == '40' ? ' selected' : '').'>40 kb/s</option>
+<option label="80 kb/s" value="80"'.($packet_size == '80' ? ' selected' : '').'>80 kb/s</option>
+<option label="160 kb/s" value="160"'.($packet_size == '160' ? ' selected' : '').'>160 kb/s</option>
+</select><br />
+<br />
+<div id="embed-div"></div>
+<script type="text/javascript" charset="utf-8">
+PluginObject.embed("../../working/to-be-processed/rickroll.flv", {
+ width : 400,
+ height: 320,
+ force_plugin:PluginObject.Plugins.FlashMedia,
+ player: "../common/mediaplayer/player.swf",
+ force_into_id:"embed-div",
+ auto_fix_path:false,
+ variables: {
+ bufferlength : 3,
+ streamer: "../../php4/example13.php",
+ autostart: true
+ }
+});
+</script><br />
+</body></html>';
+
+
+
+// echo '<embed
+// src="mediaplayer/mediaplayer.swf"
+// width="400"
+// height="320"
+// allowfullscreen="true"
+// flashvars="width=400&height=320&autostart=true&file=example13.php?file=to-be-processed/rickroll.flv&searchbar=false&streamscript=../example13.php"
+// />';
diff --git a/libraries/phpvideotoolkit/examples/php4/example14.php b/libraries/phpvideotoolkit/examples/php4/example14.php
new file mode 100644
index 0000000..2d6c44c
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example14.php
@@ -0,0 +1,71 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example gives you an encode/decode lookup table so you can see which formats can be encoded and/or decoded with your version of FFmpeg, whilst showing you how to easily check for different codecs..</strong><br /><br />';
+ $ignore_demo_files = true;
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// start ffmpeg class
+ $toolkit = new PHPVideoToolkit();
+
+// get the ffmpeg info
+ $codecs = $toolkit->getAvailableCodecs();
+
+ echo '<table border="0" cellspacing="0" cellpadding="5">
+ <tr>
+ <td style="width:125px;">
+ Codec
+ </td>
+ <td style="width:75px;">
+ Encode
+ </td>
+ <td style="width:75px;">
+ Decode
+ </td>
+ </tr>';
+// loop and check availability
+ foreach ($codecs as $codec)
+ {
+ echo '<tr>
+ <td style="border-bottom:1px solid #ccc">
+ '.$codec.'
+ </td>
+ <td style="border-bottom:1px solid #ccc">
+ '.($toolkit->canCodecBeEncoded($codec) ? 'YES' : '&nbsp;').'
+ </td>
+ <td style="border-bottom:1px solid #ccc">
+ '.($toolkit->canCodecBeDecoded($codec) ? 'YES' : '&nbsp;').'
+ </td>
+ </tr>';
+ }
+ echo '</table>';
+
+// loop the codecs
+
+ echo '</body></html>';
+ \ No newline at end of file
diff --git a/libraries/phpvideotoolkit/examples/php4/example15.php b/libraries/phpvideotoolkit/examples/php4/example15.php
new file mode 100644
index 0000000..8f088cf
--- /dev/null
+++ b/libraries/phpvideotoolkit/examples/php4/example15.php
@@ -0,0 +1,42 @@
+<?php
+
+ /* SVN FILE: $Id$ */
+
+ /**
+ * @author Oliver Lillie (aka buggedcom) <publicmail@buggedcom.co.uk>
+ * @package PHPVideoToolkit
+ * @license BSD
+ * @copyright Copyright (c) 2008 Oliver Lillie <http://www.buggedcom.co.uk>
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+ * is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+ echo '<html><head><link type="text/css" rel="stylesheet" href="../common/styles.css"><meta name="author" content="Oliver Lillie"></head><body>';
+ echo '<a class="backtoexamples" href="../index.php#examples">&larr; Back to examples list</a><br /><br />';
+ echo '<strong>This example determines if FFmpeg is available at the location you specified in the example configs.</strong><br /><br />';
+ $ignore_demo_files = true;
+
+// load the examples configuration
+ require_once '../example-config.php';
+
+// require the library
+ require_once '../../phpvideotoolkit.'.$use_version.'.php';
+
+// get the ffmpeg info
+ $toolkit = new PHPVideoToolkit();
+ $toolkit->getFFmpegInfo();
+
+ echo $toolkit->ffmpeg_found === true ? 'FFmpeg is available' : 'FFmpeg is not available';
+
+// loop the codecs
+
+ echo '</body></html>';
+ \ No newline at end of file