From c10ad711f79a9dab1b42ab7492a2bfbbe145ab1b Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 9 Nov 2022 03:21:50 -0800 Subject: [PATCH 1/4] chmod on go-transcode --- lib/Command/VideoSetup.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Command/VideoSetup.php b/lib/Command/VideoSetup.php index 719d414a..e7daefd7 100644 --- a/lib/Command/VideoSetup.php +++ b/lib/Command/VideoSetup.php @@ -98,6 +98,7 @@ class VideoSetup extends Command $goTranscodePath = realpath(__DIR__."/../../exiftool-bin/go-transcode-{$arch}-{$libc}"); $output->writeln("Trying go-transcode from {$goTranscodePath}"); + chmod($goTranscodePath, 0755); $goTranscode = shell_exec($goTranscodePath.' --help'); if (!$goTranscode || false === strpos($goTranscode, 'Available Commands')) { From 9d5a431c0702a3ed2db599a892faeb4ea5766d96 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 9 Nov 2022 06:21:17 -0800 Subject: [PATCH 2/4] Add QSV env var --- lib/Command/VideoSetup.php | 24 ++++++++++++++++++------ lib/Controller/VideoController.php | 9 ++++++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/Command/VideoSetup.php b/lib/Command/VideoSetup.php index e7daefd7..752858c9 100644 --- a/lib/Command/VideoSetup.php +++ b/lib/Command/VideoSetup.php @@ -120,9 +120,7 @@ class VideoSetup extends Command $output->writeln(''); $output->writeln('Do you want to enable transcoding and HLS? [Y/n]'); - $handle = fopen('php://stdin', 'r'); - $line = fgets($handle); - if ('n' === trim($line)) { + if ('n' === trim(fgets(fopen('php://stdin', 'r')))) { $this->config->setSystemValue('memories.no_transcode', true); $output->writeln('Transcoding and HLS are now disabled'); @@ -136,6 +134,22 @@ class VideoSetup extends Command $this->config->setSystemValue('memories.no_transcode', false); $output->writeln('Transcoding and HLS are now enabled!'); + // Check for VAAPI + $output->writeln("\nChecking for QSV (/dev/dri/renderD128)"); + if (file_exists('/dev/dri/renderD128')) { + $output->writeln('QSV is available. Do you want to enable it? [Y/n]'); + + if ('n' === trim(fgets(fopen('php://stdin', 'r')))) { + $this->config->setSystemValue('memories.qsv', false); + $output->writeln('QSV is now disabled'); + } else { + $this->config->setSystemValue('memories.qsv', true); + } + } else { + $output->writeln('QSV is not available'); + $this->config->setSystemValue('memories.qsv', false); + } + return 0; } @@ -150,9 +164,7 @@ class VideoSetup extends Command { $output->writeln('Without transcoding, video playback may be slow and limited'); $output->writeln('Do you want to disable transcoding and HLS streaming? [y/N]'); - $handle = fopen('php://stdin', 'r'); - $line = fgets($handle); - if ('y' !== trim($line)) { + if ('y' !== trim(fgets(fopen('php://stdin', 'r')))) { $output->writeln('Aborting'); return 1; diff --git a/lib/Controller/VideoController.php b/lib/Controller/VideoController.php index 28f7b7d0..f1332cef 100644 --- a/lib/Controller/VideoController.php +++ b/lib/Controller/VideoController.php @@ -89,11 +89,18 @@ class VideoController extends ApiBase return new JSONResponse(['message' => 'Transcoder not configured'], Http::STATUS_INTERNAL_SERVER_ERROR); } + // Check for environment variables + $vaapi = $this->config->getSystemValue('memories.qsv', false); + $env = ''; + if ($vaapi) { + $env .= 'VAAPI=1 '; + } + // Check if already running exec('ps a | grep go-transcode | grep -v grep', $procs); if (0 === \count($procs)) { shell_exec("mkdir -p {$tmpDir}/transcoder"); // php func has some weird problems - shell_exec("nohup {$transcoder} serve --config {$tConfig} > {$tmpDir}/transcoder/run.log 2>&1 & > /dev/null"); + shell_exec("{$env} nohup {$transcoder} serve --config {$tConfig} > {$tmpDir}/transcoder/run.log 2>&1 & > /dev/null"); } // wait for 2s and try again From b4b461dd7658f3b825dc716330296f60c3d17de2 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 9 Nov 2022 06:25:22 -0800 Subject: [PATCH 3/4] Update transcoder --- scripts/get-exiftool.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/get-exiftool.sh b/scripts/get-exiftool.sh index 0ddac80f..3b0466eb 100755 --- a/scripts/get-exiftool.sh +++ b/scripts/get-exiftool.sh @@ -17,7 +17,7 @@ mv "exiftool-$exifver" exiftool rm -rf *.zip exiftool/t exiftool/html chmod 755 exiftool/exiftool -gotranscode="v0.0.1" +gotranscode="v0.0.2" wget -q "https://github.com/pulsejet/go-transcode/releases/download/$gotranscode/go-transcode-amd64-musl" wget -q "https://github.com/pulsejet/go-transcode/releases/download/$gotranscode/go-transcode-amd64-glibc" wget -q "https://github.com/pulsejet/go-transcode/releases/download/$gotranscode/go-transcode-aarch64-musl" From 2f5a14c431fef75eb210906d4b9a4a8be64cab78 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 9 Nov 2022 06:25:35 -0800 Subject: [PATCH 4/4] release: v4.7.0-alpha.1 --- appinfo/info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 4f15f99e..a589cea3 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -33,7 +33,7 @@ Memories is a *batteries-included* photo management solution for Nextcloud with 1. Run `php ./occ memories:index` to generate metadata indices for existing photos. 1. Open the 📷 Memories app in Nextcloud and set the directory containing your photos. ]]> - 4.7.0-alpha + 4.7.0-alpha.1 agpl Varun Patil Memories