1
0
Fork 0

Update VideoPipeline

This commit is contained in:
Daniel Supernault 2019-05-26 18:36:04 -06:00
parent 7f437d4714
commit a1c29b50e3
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 8 additions and 8 deletions

View File

@ -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,13 +46,10 @@ 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()
$video = FFMpeg::open($base)
->getFrameFromSeconds(1)
->export()
->toDisk('local')
->save($save);
$media->thumbnail_path = $save;