diff --git a/app/Jobs/VideoPipeline/VideoPostProcess.php b/app/Jobs/VideoPipeline/VideoPostProcess.php new file mode 100644 index 000000000..ddb9249f8 --- /dev/null +++ b/app/Jobs/VideoPipeline/VideoPostProcess.php @@ -0,0 +1,34 @@ +media = $media; + } + + /** + * Execute the job. + * + * @return void + */ + public function handle() + { + $media = $this->media; + $base = $media->media_path; + $path = explode('/', $base); + $name = last($path); + try { + $t = explode('.', $name); + $t = $t[0].'_thumb.png'; + $i = count($path) - 1; + $path[$i] = $t; + $save = implode('/', $path); + $video = FFMpeg::open($base); + if($video->getDurationInSeconds() < 1) { + $video->getFrameFromSeconds(1); + } elseif($video->getDurationInSeconds() < 5) + $video->getFrameFromSeconds(4); + } + $video->export() + ->save($save); + + $media->thumbnail_path = $save; + $media->save(); + + } catch (Exception $e) { + + } + } +}