// 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) {