Allow specifying ff* path (fix #201)

pull/221/head
Varun Patil 2022-11-15 02:27:20 -08:00
parent e01b536f83
commit 220a685bf6
3 changed files with 20 additions and 16 deletions

View File

@ -50,16 +50,12 @@ class VideoSetup extends Command
protected function execute(InputInterface $input, OutputInterface $output): int protected function execute(InputInterface $input, OutputInterface $output): int
{ {
// Check nohup binary // Preset executables
$nohup = shell_exec('nohup --version'); $ffmpegPath = $this->config->getSystemValue('memories.ffmpeg_path', 'ffmpeg');
if (!$nohup || false === strpos($nohup, 'nohup')) { $ffprobePath = $this->config->getSystemValue('memories.ffprobe_path', 'ffprobe');
$output->writeln('<error>nohup binary not found. Please install nohup.</error>');
return $this->suggestDisable($output);
}
// Get ffmpeg version // Get ffmpeg version
$ffmpeg = shell_exec('ffmpeg -version'); $ffmpeg = shell_exec("$ffmpegPath -version");
if (false === strpos($ffmpeg, 'ffmpeg version')) { if (false === strpos($ffmpeg, 'ffmpeg version')) {
$ffmpeg = null; $ffmpeg = null;
$output->writeln('<error>ffmpeg is not installed</error>'); $output->writeln('<error>ffmpeg is not installed</error>');
@ -68,7 +64,7 @@ class VideoSetup extends Command
} }
// Get ffprobe version // Get ffprobe version
$ffprobe = shell_exec('ffprobe -version'); $ffprobe = shell_exec("$ffprobePath -version");
if (false === strpos($ffprobe, 'ffprobe version')) { if (false === strpos($ffprobe, 'ffprobe version')) {
$ffprobe = null; $ffprobe = null;
$output->writeln('<error>ffprobe is not installed</error>'); $output->writeln('<error>ffprobe is not installed</error>');
@ -129,6 +125,7 @@ class VideoSetup extends Command
$this->config->setSystemValue('memories.transcoder', $goVodPath); $this->config->setSystemValue('memories.transcoder', $goVodPath);
$this->config->setSystemValue('memories.no_transcode', false); $this->config->setSystemValue('memories.no_transcode', false);
$output->writeln('Transcoding and HLS are now enabled! Monitor the output at /tmp/go-vod.log for any errors'); $output->writeln('Transcoding and HLS are now enabled! Monitor the output at /tmp/go-vod.log for any errors');
$output->writeln('You should restart the server for changes to take effect');
// Check for VAAPI // Check for VAAPI
$output->writeln("\nChecking for QSV (/dev/dri/renderD128)"); $output->writeln("\nChecking for QSV (/dev/dri/renderD128)");
@ -171,6 +168,7 @@ class VideoSetup extends Command
$this->config->setSystemValue('memories.no_transcode', true); $this->config->setSystemValue('memories.no_transcode', true);
$output->writeln('<error>Transcoding and HLS are now disabled</error>'); $output->writeln('<error>Transcoding and HLS are now disabled</error>');
$output->writeln('You should restart the server for changes to take effect');
return 0; return 0;
} }

View File

@ -96,15 +96,21 @@ class VideoController extends ApiBase
} }
// Check for environment variables // Check for environment variables
$vaapi = $this->config->getSystemValue('memories.qsv', false);
$env = ''; $env = '';
if ($vaapi) {
$env .= 'VAAPI=1 '; // QSV with VAAPI
} $vaapi = $this->config->getSystemValue('memories.qsv', false);
if ($vaapi) $env .= 'VAAPI=1 ';
// Paths
$ffmpegPath = $this->config->getSystemValue('memories.ffmpeg_path', 'ffmpeg');
$ffprobePath = $this->config->getSystemValue('memories.ffprobe_path', 'ffprobe');
$tmpPath = $this->config->getSystemValue('memories.tmp_path', sys_get_temp_dir());
$env .= "FFMPEG='$ffmpegPath' FFPROBE='$ffprobePath' GOVOD_TEMPDIR='$tmpPath/go-vod' ";
// Check if already running // Check if already running
shell_exec("pkill {$transcoder}"); exec("pkill {$transcoder}");
shell_exec("{$env} nohup {$transcoder} > {$tmpDir}/go-vod.log 2>&1 & > /dev/null"); shell_exec("{$env} nohup {$transcoder} > {$tmpPath}/go-vod.log 2>&1 & > /dev/null");
// wait for 1s and try again // wait for 1s and try again
sleep(1); sleep(1);

View File

@ -17,7 +17,7 @@ mv "exiftool-$exifver" exiftool
rm -rf *.zip exiftool/t exiftool/html rm -rf *.zip exiftool/t exiftool/html
chmod 755 exiftool/exiftool chmod 755 exiftool/exiftool
govod="0.0.11" govod="0.0.12"
wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-amd64" wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-amd64"
wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-aarch64" wget -q "https://github.com/pulsejet/go-vod/releases/download/$govod/go-vod-aarch64"
chmod 755 go-vod-* chmod 755 go-vod-*