|
|
|
@ -127,10 +127,14 @@ class FfmpegService |
|
|
|
|
|
|
|
public function processVideo($pathFile) |
|
|
|
{ |
|
|
|
while (date("H") >= 22 || date("H") < 8) { |
|
|
|
Log::info("now is " . date("Y-m-d H:i:s") . " sleep 5 minutes"); |
|
|
|
sleep(5 * 60); |
|
|
|
$slowFlag = false; |
|
|
|
if (date("H") >= 22 || date("H") < 8) { |
|
|
|
$slowFlag = true; |
|
|
|
} |
|
|
|
// while () {
|
|
|
|
// Log::info("now is " . date("Y-m-d H:i:s") . " sleep 5 minutes");
|
|
|
|
// sleep(5 * 60);
|
|
|
|
// }
|
|
|
|
Log::info("current process pathFile " . $pathFile); |
|
|
|
try { |
|
|
|
$mime = mime_content_type($pathFile); |
|
|
|
@ -189,11 +193,19 @@ class FfmpegService |
|
|
|
} |
|
|
|
dump("targetFile", [$targetFile]); |
|
|
|
Log::info("process target file : $targetFile"); |
|
|
|
if (filesize($pathFile) > 10 * 1024 * 1024 * 1024 || $this->getDimension($pathFile)->getWidth() > 1920) { |
|
|
|
if ($this->getDimension($pathFile)->getWidth() > 3840) { |
|
|
|
// $result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -threads 16 -i ". escapeshellarg($pathFile) ." -preset ultrafast -crf 25 -c:v libx265 -x265-params pools=8 -vtag hvc1 " . escapeshellarg($targetFile) . " && echo 'ok'");
|
|
|
|
$result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -i ". escapeshellarg($pathFile) ." -c:v libx265 -x265-params pools=8 -vtag hvc1 -vf \"scale=4096:-1\" " . escapeshellarg($targetFile) . " && echo 'ok'"); |
|
|
|
if ($slowFlag) { |
|
|
|
$result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -i ". escapeshellarg($pathFile) ." -c:v libx265 -x265-params pools=2 -vtag hvc1 -vf \"scale=4096:-1\" " . escapeshellarg($targetFile) . " && echo 'ok'"); |
|
|
|
} else { |
|
|
|
$result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -i ". escapeshellarg($pathFile) ." -c:v libx265 -x265-params pools=8 -vtag hvc1 -vf \"scale=4096:-1\" " . escapeshellarg($targetFile) . " && echo 'ok'"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
$result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -threads 16 -i ". escapeshellarg($pathFile) ." -preset fast -c:v libx265 -x265-params pools=8 -vtag hvc1 " . escapeshellarg($targetFile) . " && echo 'ok'"); |
|
|
|
if ($slowFlag) { |
|
|
|
$result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -threads 2 -i ". escapeshellarg($pathFile) ." -preset fast -c:v libx265 -x265-params pools=2 -vtag hvc1 " . escapeshellarg($targetFile) . " && echo 'ok'"); |
|
|
|
} else { |
|
|
|
$result = shell_exec("/Users/shixuesen/Downloads/ffmpeg -threads 8 -i ". escapeshellarg($pathFile) ." -preset fast -c:v libx265 -x265-params pools=8 -vtag hvc1 " . escapeshellarg($targetFile) . " && echo 'ok'"); |
|
|
|
} |
|
|
|
} |
|
|
|
// echo $result;
|
|
|
|
// return;
|
|
|
|
|