Ejemplo n.º 1
0
//	output files dirname has to exist
$tmp_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'tmp/';
//	input movie files
$files_to_process = array(PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-1.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-2.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-3.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-4.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-5.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-6.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-7.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-8.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-9.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-10.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-11.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-12.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-13.jpg', PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/mov02596-14.jpg');
$sound = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'to-be-processed/Ballad of the Sneak.mp3';
//	output files dirname has to exist
$video_output_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'processed/videos/';
//	log dir
$log_dir = PHPVIDEOTOOLKIT_EXAMPLE_ABSOLUTE_BATH . 'logs/';
// 	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";