From a1c29b50e3589e362a73d359dc3560db98cc2fe5 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 26 May 2019 18:36:04 -0600 Subject: [PATCH] Update VideoPipeline --- app/Jobs/VideoPipeline/VideoThumbnail.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Jobs/VideoPipeline/VideoThumbnail.php b/app/Jobs/VideoPipeline/VideoThumbnail.php index c6000d222..882f57dd6 100644 --- a/app/Jobs/VideoPipeline/VideoThumbnail.php +++ b/app/Jobs/VideoPipeline/VideoThumbnail.php @@ -34,6 +34,9 @@ class VideoThumbnail implements ShouldQueue public function handle() { $media = $this->media; + if($media->mime != 'video/mp4') { + return; + } $base = $media->media_path; $path = explode('/', $base); $name = last($path); @@ -43,14 +46,11 @@ class VideoThumbnail implements ShouldQueue $i = count($path) - 1; $path[$i] = $t; $save = implode('/', $path); - $video = FFMpeg::open($base); - if($video->getDurationInSeconds() < 1) { - $video->getFrameFromSeconds(0); - } elseif($video->getDurationInSeconds() < 5) { - $video->getFrameFromSeconds(4); - } - $video->export() - ->save($save); + $video = FFMpeg::open($base) + ->getFrameFromSeconds(1) + ->export() + ->toDisk('local') + ->save($save); $media->thumbnail_path = $save; $media->save();