From 1409a7cc926b00674a9e2ada2d38d1cbbd0e91eb Mon Sep 17 00:00:00 2001 From: William Date: Wed, 18 Jan 2023 16:30:41 +0100 Subject: [PATCH 1/4] Update PreviewManager.php add a check in config.php for a configured movieBinary path. so now it first checks in config.php if preview_ffmpeg_path is configured. Signed-off-by: William --- lib/private/PreviewManager.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 87e709e9bcc..eac3f40efc2 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -417,11 +417,16 @@ class PreviewManager implements IPreview { // Video requires avconv or ffmpeg if (in_array(Preview\Movie::class, $this->getEnabledDefaultProvider())) { - $movieBinary = $this->binaryFinder->findBinaryPath('avconv'); - if (!is_string($movieBinary)) { - $movieBinary = $this->binaryFinder->findBinaryPath('ffmpeg'); + + $movieBinary = $this->config->getSystemValue('preview_ffmpeg_path', null); + if(!is_string($movieBinary)){ + $movieBinary = $this->binaryFinder->findBinaryPath('avconv'); + if (!is_string($movieBinary)) { + $movieBinary = $this->binaryFinder->findBinaryPath('ffmpeg'); + } } + if (is_string($movieBinary)) { $this->registerCoreProvider(Preview\Movie::class, '/video\/.*/', ["movieBinary" => $movieBinary]); } From 2c4afdcdd1e0be19557923ad8759693252b6db0e Mon Sep 17 00:00:00 2001 From: William Date: Wed, 18 Jan 2023 19:26:48 +0100 Subject: [PATCH 2/4] add documentation preview_ffmpeg_path add preview_ffmpeg_path documentation. document custom path for ffmpeg so it can be used by the previewprovider to create video previews with the snap package of nextcloud. Signed-off-by: William --- config/config.sample.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index 0267ae51c91..b9ed39d97a7 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1190,7 +1190,14 @@ $CONFIG = [ 'preview_office_cl_parameters' => ' --headless --nologo --nofirststartwizard --invisible --norestore '. '--convert-to png --outdir ', - + +/** + * custom path for ffmpeg binary + * + * Defaults to ``''`` (empty string) + */ +'preview_ffmpeg_path' => '/usr/bin/ffmpeg', + /** * Set the URL of the Imaginary service to send image previews to. * Also requires the ``OC\Preview\Imaginary`` provider to be enabled. From 81ec99ae33d637d4474ee31c41c3b771be4f59e8 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 18 Jan 2023 20:13:34 +0100 Subject: [PATCH 3/4] Update config/config.sample.php add better description Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com> Signed-off-by: William --- config/config.sample.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config.sample.php b/config/config.sample.php index b9ed39d97a7..d529661b81d 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -1194,7 +1194,7 @@ $CONFIG = [ /** * custom path for ffmpeg binary * - * Defaults to ``''`` (empty string) + * Defaults to ``null`` and falls back to searching ``avconv`` and ``ffmpeg`` in the configured ``PATH`` environment */ 'preview_ffmpeg_path' => '/usr/bin/ffmpeg', From fa12219629fb0bb18c5caef2e48e5b5d45296406 Mon Sep 17 00:00:00 2001 From: William Date: Wed, 18 Jan 2023 20:32:09 +0100 Subject: [PATCH 4/4] Update lib/private/PreviewManager.php fix lint issue Co-authored-by: Simon L. Signed-off-by: William --- lib/private/PreviewManager.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index eac3f40efc2..367f0c1c057 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -417,9 +417,8 @@ class PreviewManager implements IPreview { // Video requires avconv or ffmpeg if (in_array(Preview\Movie::class, $this->getEnabledDefaultProvider())) { - $movieBinary = $this->config->getSystemValue('preview_ffmpeg_path', null); - if(!is_string($movieBinary)){ + if (!is_string($movieBinary)) { $movieBinary = $this->binaryFinder->findBinaryPath('avconv'); if (!is_string($movieBinary)) { $movieBinary = $this->binaryFinder->findBinaryPath('ffmpeg');