diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2023-03-03 13:35:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-03 13:35:06 +0100 |
commit | c5da4b8737a7463b1920ab20e5a73abd608f520e (patch) | |
tree | ba1d411460a49f75937cf8e24c4f594916fc0105 | |
parent | d5a16d8d92cabe135a3e0d8dfdd1e69f9fce179d (diff) | |
parent | 3bea7af7b7842af207ec973e83b5d87079c617af (diff) | |
download | nextcloud-server-c5da4b8737a7463b1920ab20e5a73abd608f520e.tar.gz nextcloud-server-c5da4b8737a7463b1920ab20e5a73abd608f520e.zip |
Merge pull request #36736 from Glandos/patch-2
-rw-r--r-- | lib/private/Preview/Movie.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/private/Preview/Movie.php b/lib/private/Preview/Movie.php index 486c301d987..13d868cd583 100644 --- a/lib/private/Preview/Movie.php +++ b/lib/private/Preview/Movie.php @@ -125,23 +125,30 @@ class Movie extends ProviderV2 { $binaryType = substr(strrchr($this->binary, '/'), 1); if ($binaryType === 'avconv') { - $cmd = $this->binary . ' -y -ss ' . escapeshellarg((string)$second) . - ' -i ' . escapeshellarg($absPath) . - ' -an -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) . - ' 2>&1'; + $cmd = [$this->binary, '-y', '-ss', (string)$second, + '-i', $absPath, + '-an', '-f', 'mjpeg', '-vframes', '1', '-vsync', '1', + $tmpPath]; } elseif ($binaryType === 'ffmpeg') { - $cmd = $this->binary . ' -y -ss ' . escapeshellarg((string)$second) . - ' -i ' . escapeshellarg($absPath) . - ' -f mjpeg -vframes 1' . - ' ' . escapeshellarg($tmpPath) . - ' 2>&1'; + $cmd = [$this->binary, '-y', '-ss', (string)$second, + '-i', $absPath, + '-f', 'mjpeg', '-vframes', '1', + $tmpPath]; } else { // Not supported unlink($tmpPath); return null; } - exec($cmd, $output, $returnCode); + $proc = proc_open($cmd, [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes); + $returnCode = -1; + $output = ""; + if (is_resource($proc)) { + $stdout = trim(stream_get_contents($pipes[1])); + $stderr = trim(stream_get_contents($pipes[2])); + $returnCode = proc_close($proc); + $output = $stdout . $stderr; + } if ($returnCode === 0) { $image = new \OCP\Image(); |