diff --git a/app/Image/Handlers/GoogleMotionPictureHandler.php b/app/Image/Handlers/GoogleMotionPictureHandler.php index 41228b4e981..8240bf5e928 100644 --- a/app/Image/Handlers/GoogleMotionPictureHandler.php +++ b/app/Image/Handlers/GoogleMotionPictureHandler.php @@ -76,7 +76,10 @@ public function load(NativeLocalFile $file, int $videoLength = 0): void $this->workingCopy->write($readStream); $file->close(); - $ffmpeg = FFMpeg::create(); + $ffmpeg = FFMpeg::create([ + 'ffmpeg.binaries' => Configs::getValueAsString('ffmpeg_path'), + 'ffprobe.binaries' => Configs::getValueAsString('ffprobe_path'), + ]); $audioOrVideo = $ffmpeg->open($this->workingCopy->getRealPath()); if ($audioOrVideo instanceof Video) { $this->video = $audioOrVideo; diff --git a/app/Image/Handlers/VideoHandler.php b/app/Image/Handlers/VideoHandler.php index c95e3967a31..4c8efb5e972 100644 --- a/app/Image/Handlers/VideoHandler.php +++ b/app/Image/Handlers/VideoHandler.php @@ -43,7 +43,10 @@ public function load(NativeLocalFile $file): void throw new ConfigurationException('FFmpeg is disabled by configuration'); } try { - $ffmpeg = FFMpeg::create(); + $ffmpeg = FFMpeg::create([ + 'ffmpeg.binaries' => Configs::getValueAsString('ffmpeg_path'), + 'ffprobe.binaries' => Configs::getValueAsString('ffprobe_path'), + ]); $audioOrVideo = $ffmpeg->open($file->getRealPath()); if ($audioOrVideo instanceof Video) { $this->video = $audioOrVideo; diff --git a/database/migrations/2023_08_07_182802_add_config_ffmpeg_path.php b/database/migrations/2023_08_07_182802_add_config_ffmpeg_path.php new file mode 100644 index 00000000000..d8bd060d0b5 --- /dev/null +++ b/database/migrations/2023_08_07_182802_add_config_ffmpeg_path.php @@ -0,0 +1,64 @@ +insert([ + [ + 'key' => 'ffmpeg_path', + 'value' => $path_ffmpeg, + 'confidentiality' => 1, + 'cat' => 'Image Processing', + 'type_range' => 'string', + 'description' => 'Path to the binary of ffmpeg', + ], + [ + 'key' => 'ffprobe_path', + 'value' => $path_ffprobe, + 'confidentiality' => 1, + 'cat' => 'Image Processing', + 'type_range' => 'string', + 'description' => 'Path to the binary of ffprobe', + ], + ]); + } + + /** + * Reverse the migrations. + * + * @throws InvalidArgumentException + */ + public function down(): void + { + DB::table('configs') + ->where('key', '=', 'ffmpeg_path') + ->orWhere('key', '=', 'ffprobe_path') + ->delete(); + } +};