Skip to content

Commit e1fcd6c

Browse files
authored
Merge pull request #53000 from nextcloud/fix/noid/stuck-ffmpeg
fix: unblock ffmpeg on some broken videos
2 parents eb9a621 + bdc6898 commit e1fcd6c

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

.reuse/dep5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Files: tests/data/integritycheck/htaccessWithValidModifiedContent/.htaccess
107107
Copyright: 2016 ownCloud, Inc., 2019 Nextcloud GmbH and Nextcloud contributors
108108
License: AGPL-3.0-only
109109

110-
Files: core/img/favicon*.* core/img/logo/logo*.* tests/data/testimage.webp apps/testing/img/logo.png core/img/apps/spreed.svg
110+
Files: core/img/favicon*.* core/img/logo/logo*.* tests/data/testimage.webp tests/data/broken-video.webm apps/testing/img/logo.png core/img/apps/spreed.svg
111111
Copyright: 2016-2024 Nextcloud GmbH
112112
License: LicenseRef-NextcloudTrademarks
113113

lib/private/Preview/Movie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ private function generateThumbNail(int $maxX, int $maxY, string $absPath, int $s
166166
$returnCode = -1;
167167
$output = '';
168168
if (is_resource($proc)) {
169-
$stdout = trim(stream_get_contents($pipes[1]));
170169
$stderr = trim(stream_get_contents($pipes[2]));
170+
$stdout = trim(stream_get_contents($pipes[1]));
171171
$returnCode = proc_close($proc);
172172
$output = $stdout . $stderr;
173173
}

tests/data/broken-video.webm

1.63 MB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
6+
* SPDX-License-Identifier: AGPL-3.0-or-later
7+
*/
8+
9+
namespace Test\Preview;
10+
11+
/**
12+
* Class MovieTest
13+
*
14+
* @group DB
15+
*
16+
* @package Test\Preview
17+
*/
18+
class MovieBrokenStuckFfmpegTest extends MovieTest {
19+
protected string $fileName = 'broken-video.webm';
20+
}

tests/lib/Preview/MovieTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
* @package Test\Preview
1919
*/
2020
class MovieTest extends Provider {
21+
protected string $fileName = 'testimage.mp4';
22+
protected int $width = 560;
23+
protected int $height = 320;
24+
2125
protected function setUp(): void {
2226
$binaryFinder = Server::get(IBinaryFinder::class);
2327
$movieBinary = $binaryFinder->findBinaryPath('avconv');
@@ -28,10 +32,7 @@ protected function setUp(): void {
2832
if (is_string($movieBinary)) {
2933
parent::setUp();
3034

31-
$fileName = 'testimage.mp4';
32-
$this->imgPath = $this->prepareTestFile($fileName, \OC::$SERVERROOT . '/tests/data/' . $fileName);
33-
$this->width = 560;
34-
$this->height = 320;
35+
$this->imgPath = $this->prepareTestFile($this->fileName, \OC::$SERVERROOT . '/tests/data/' . $this->fileName);
3536
$this->provider = new \OC\Preview\Movie(['movieBinary' => $movieBinary]);
3637
} else {
3738
$this->markTestSkipped('No Movie provider present');

0 commit comments

Comments
 (0)