diff --git a/src/Jobs/ProcessAnnotatedVideo.php b/src/Jobs/ProcessAnnotatedVideo.php index 4c937cc..34af1b1 100644 --- a/src/Jobs/ProcessAnnotatedVideo.php +++ b/src/Jobs/ProcessAnnotatedVideo.php @@ -112,7 +112,7 @@ protected function getVideo($path) * * @return \Jcupitt\Vips\Video */ - protected function getVideoFrame(Video $video, float $time, int $trySeek = 5) + protected function getVideoFrame(Video $video, float $time, int $trySeek = 30) { // Sometimes an annotation is near the end of the video (or exactly at the end). // FFMpeg often returns an empty buffer in this case. If there is an empty frame, @@ -122,7 +122,9 @@ protected function getVideoFrame(Video $video, float $time, int $trySeek = 5) $buffer = $video->frame(TimeCode::fromSeconds($time)) ->save(null, false, true); $trySeek -= 1; - $time = max(0, $time - 0.0333); // Roughly estimated framerate of 30 fps. + // Roughly estimated framerate of 30 fps. With 30 iterations, we seek back up + // to 1 s. + $time = max(0, $time - 0.033333333); } while (empty($buffer) && $trySeek > 0); return VipsImage::newFromBuffer($buffer);