processDir($subDir); } else { $this->processVideo($subDir); } } } public function processVideo($pathFile) { $mime = mime_content_type($pathFile); // dump("file type", [$mime, $subPathFile]); // continue; if (strstr($mime, "video/")) { if (is_file($pathFile)) { $fileInfo = pathinfo($pathFile); dump("fileInfo", $fileInfo); if (ends_with($fileInfo["filename"], "-1")) { return; } if (is_file($fileInfo["dirname"] . '/' .$fileInfo["filename"] . '-1'. '.' . $fileInfo["extension"])) { unlink($pathFile); return; } $targetFile = $fileInfo["dirname"] . '/' .$fileInfo["filename"] . '-1'. '.' . $fileInfo["extension"]; dump("targetFile", [$targetFile]); // $result = shell_exec("handBrakeCli -Z 'Very Fast 720p30' -i '". $subPathFile ."' -o '". $targetFile . " && echo 'success'"); $result = shell_exec("handBrakeCli -Z 'Very Fast 720p30' -i '". $pathFile ."' -o '". $targetFile . "'"); dump($result); } } } }