Add QSV env var
parent
c10ad711f7
commit
9d5a431c07
|
@ -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('<error>Transcoding and HLS are now disabled</error>');
|
||||
|
||||
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue