moshaorui 3 settimane fa
parent
commit
02e9670bb0
1 ha cambiato i file con 4 aggiunte e 5 eliminazioni
  1. 4 5
      app/Console/Commands/GeneratePreviewVideo.php

+ 4 - 5
app/Console/Commands/GeneratePreviewVideo.php

@@ -70,17 +70,15 @@ class GeneratePreviewVideo extends Command
                 $fileName = basename($video_oss_url);
                 $fileInfo = pathinfo($fileName);
 
-                $localFilePath = $localPreviewPath. '/'. $fileName;
                 //下载$video_url到本地
+                $localFilePath = $localPreviewPath. '/'. $fileName;
                 $this->saveLocal($video_oss_url, $localFilePath);
 
-                exit;
-
 
                 $previewName = $fileInfo['filename'] . '_preview.' . $fileInfo['extension'];
                 $previewPath = storage_path('tmp/previews/'.$previewName);
-                //下载$video_url到本地
-                //$this->generatePreview($video_url, $previewPath);
+                //截取视频前5秒
+                $this->generatePreview($localFilePath, $previewPath);
                 //上传到OSS
                 $uploadPath = 'videos/uploads/previews/'. date('Ym');
                 //$disk->putFile($uploadPath,$previewPath);
@@ -113,6 +111,7 @@ class GeneratePreviewVideo extends Command
         }
         fclose($remote);
         fclose($local);
+        return $localPath;
     }
 
     private function ossUrl($url)