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";