* @package PHPVideoToolkit * @license BSD * @copyright Copyright (c) 2008 Oliver Lillie * 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 ''; echo '← Back to examples list

'; echo 'This example shows you how to convert videos to common formats simply by using the simple adapters.
'; echo '• The flash media player used below is Jeroen Wijering\'s excellent Flash Media Player. Although bundled with this package the Flash Media Player has a Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic license.
'; echo '• The media is embedded using PluginObject to embed the examples. It is distributed under a BSD License.

'; // load the examples configuration require_once '../example-config.php'; // require the library require_once '../../phpvideotoolkit.'.$use_version.'.php'; require_once '../../adapters/videoto.php'; // temp directory $tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'tmp'.DS; // processed file output directory $output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_PATH.'working'.DS.'processed'.DS.'videos'.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' ); // loop through the files to process foreach($files_to_process as $file) { echo 'Processing '.basename($file).'
'; $info = PHPVideoToolkit::getFileInfo($file); // convert the video to a gif format $result = VideoTo::gif($file, array( 'width' => $info['video']['dimensions']['width'], 'height' => $info['video']['dimensions']['height'], 'temp_dir' => $tmp_dir, 'output_dir' => $output_dir, 'output_file' => '#filename-gif.#ext', 'die_on_error' => false, 'overwrite_mode' => PHPVideoToolkit::OVERWRITE_EXISTING )); // check for an error if($result !== PHPVideoToolkit::RESULT_OK) { echo VideoTo::getError().'
'."\r\n"; echo 'Please check the log file generated as additional debug info may be contained.
'."\r\n"; } else { $output = VideoTo::getOutput(); echo 'Coverted to Gif...


'."\r\n"; } // convert the video to a psp mp4 $result = VideoTo::PSP($file, array( 'width' => $info['video']['dimensions']['width'], 'height' => $info['video']['dimensions']['height'], 'temp_dir' => $tmp_dir, 'output_dir' => $output_dir, 'output_file' => '#filename-psp.#ext', 'die_on_error' => false, 'overwrite_mode' => PHPVideoToolkit::OVERWRITE_EXISTING )); // check for an error if($result !== PHPVideoToolkit::RESULT_OK) { echo VideoTo::getError().'
'."\r\n"; echo 'Please check the log file generated as additional debug info may be contained.
'."\r\n"; } else { $output = VideoTo::getOutput(); $filename = basename($output[0]); $filename_hash = md5($filename); echo 'Coverted to PSP mp4...

'."\r\n"; } // convert the video to flv $result = VideoTo::FLV($file, array( 'width' => $info['video']['dimensions']['width'], 'height' => $info['video']['dimensions']['height'], 'temp_dir' => $tmp_dir, 'output_dir' => $output_dir, 'die_on_error' => false, 'overwrite_mode' => PHPVideoToolkit::OVERWRITE_EXISTING )); // check for an error if($result !== PHPVideoToolkit::RESULT_OK) { echo VideoTo::getError().'
'."\r\n"; echo 'Please check the log file generated as additional debug info may be contained.
'."\r\n"; } else { $output = VideoTo::getOutput(); $filename = basename($output[0]); $filename_hash = md5($filename); echo 'Coverted to Flash Video (flv)...

'."\r\n"; } // convert the video to an ipod mp4 $result = VideoTo::iPod($file, array( 'width' => $info['video']['dimensions']['width'], 'height' => $info['video']['dimensions']['height'], 'temp_dir' => $tmp_dir, 'output_dir' => $output_dir, 'die_on_error' => false, 'output_file' => '#filename-ipod.#ext', 'overwrite_mode' => PHPVideoToolkit::OVERWRITE_EXISTING )); // check for an error if($result !== PHPVideoToolkit::RESULT_OK) { echo VideoTo::getError().'
'."\r\n"; echo 'Please check the log file generated as additional debug info may be contained.

'."\r\n"; } else { $output = VideoTo::getOutput(); $filename = basename($output[0]); $filename_hash = md5($filename); echo 'Coverted to iPod mp4...

'."\r\n"; } } echo '';