// 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="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>';