config = $config; } public function process(string $path, bool $pretend = false): bool { $path_parts = explode('/', $path); $filename = $path_parts[count($path_parts) - 1]; $output_path = $this->config['output_path'] . '/' . rtrim($filename, "avi") . "mp4"; $ffmpeg_command = "ffmpeg -i \"$path\" -c:v libx264 -crf 26 -preset fast -c:a aac -b:a 128k \"$output_path\""; if ($pretend) { echo "`" . $ffmpeg_command . "`" . PHP_EOL; } else { exec($ffmpeg_command); } $archive_path = $this->config['archive_path'] . '/' . $filename; if ($pretend) { echo "rename($path, $archive_path)" . PHP_EOL; } else { rename($path, $archive_path); } return true; } }