1
0
Fork 0
forked from mirror/pixelfed

Update hls pipeline, improve version check

This commit is contained in:
Daniel Supernault 2023-10-23 02:46:56 -06:00
parent 6ab7e37a48
commit 7edfea0951
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
2 changed files with 16 additions and 1 deletions

View file

@ -66,6 +66,21 @@ class VideoHlsPipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
*/
public function handle(): void
{
$depCheck = Cache::rememberForever('video-pipeline:hls:depcheck', function() {
$bin = config('laravel-ffmpeg.ffmpeg.binaries');
$output = shell_exec($bin . ' -version');
if($output && preg_match('/ffmpeg version ([^\s]+)/', $output, $matches)) {
$version = $matches[1];
return (version_compare($version, config('laravel-ffmpeg.min_hls_version')) >= 0) ? 'ok' : false;
} else {
return false;
}
});
if(!$depCheck || $depCheck !== 'ok') {
return;
}
$media = $this->media;
$bitrate = (new X264)->setKiloBitrate(config('media.hls.bitrate') ?? 1000);

View file

@ -18,5 +18,5 @@ return [
'temporary_files_encrypted_hls' => env('FFMPEG_TEMPORARY_ENCRYPTED_HLS', env('FFMPEG_TEMPORARY_FILES_ROOT', sys_get_temp_dir())),
'min_hls_version' => env('FFMPEG_MIN_HLS_VERSION', '4.4.0'),
'min_hls_version' => env('FFMPEG_MIN_HLS_VERSION', '4.3.0'),
];