From 926b274200d929af2d290d19202a5236c32c18bd Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 15 Nov 2013 01:46:51 +0100 Subject: Movie preview - use frame after 5 seconds --- lib/private/preview/movies.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php index 28f130f7506..276209a876a 100644 --- a/lib/private/preview/movies.php +++ b/lib/private/preview/movies.php @@ -50,13 +50,13 @@ if (!\OC_Util::runningOnWindows()) { file_put_contents($absPath, $firstmb); if (self::$avconvBinary) { - $cmd = self::$avconvBinary . ' -an -y -ss 1'. + $cmd = self::$avconvBinary . ' -an -y -ss 5'. ' -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1 ' . escapeshellarg($tmpPath) . ' > /dev/null 2>&1'; } else { - $cmd = self::$ffmpegBinary . ' -y -ss 1' . + $cmd = self::$ffmpegBinary . ' -y -ss 5' . ' -i ' . escapeshellarg($absPath) . ' -f mjpeg -vframes 1' . ' -s ' . escapeshellarg($maxX) . 'x' . escapeshellarg($maxY) . -- cgit v1.2.3 From c22019dec5629967a092c1a64159469ad8fef5d4 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 22 Nov 2013 12:20:06 +0100 Subject: Working on a chunked video can result in a broken frame index the option -vsync 1 can heal that --- lib/private/preview/movies.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php index 276209a876a..3cbbaa9d3be 100644 --- a/lib/private/preview/movies.php +++ b/lib/private/preview/movies.php @@ -52,7 +52,7 @@ if (!\OC_Util::runningOnWindows()) { if (self::$avconvBinary) { $cmd = self::$avconvBinary . ' -an -y -ss 5'. ' -i ' . escapeshellarg($absPath) . - ' -f mjpeg -vframes 1 ' . escapeshellarg($tmpPath) . + ' -f mjpeg -vframes 1 -vsync 1 ' . escapeshellarg($tmpPath) . ' > /dev/null 2>&1'; } else { -- cgit v1.2.3 From 14e707503052de95aa091d02d8cc229a05d77e95 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 22 Nov 2013 12:23:22 +0100 Subject: we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB. in some cases 1MB was no enough to generate thumbnail --- lib/private/preview/movies.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/private/preview/movies.php b/lib/private/preview/movies.php index 3cbbaa9d3be..ac771deb413 100644 --- a/lib/private/preview/movies.php +++ b/lib/private/preview/movies.php @@ -46,7 +46,9 @@ if (!\OC_Util::runningOnWindows()) { $handle = $fileview->fopen($path, 'rb'); - $firstmb = stream_get_contents($handle, 1048576); //1024 * 1024 = 1048576 + // we better use 5MB (1024 * 1024 * 5 = 5242880) instead of 1MB. + // in some cases 1MB was no enough to generate thumbnail + $firstmb = stream_get_contents($handle, 5242880); file_put_contents($absPath, $firstmb); if (self::$avconvBinary) { -- cgit v1.2.3