mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 09:37:29 -04:00
Merge pull request #36736 from Glandos/patch-2
This commit is contained in:
commit
c5da4b8737
1 changed files with 17 additions and 10 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue