diff --git a/src/Cli/Commands/LlodCommand.php b/src/Cli/Commands/LlodCommand.php index 4aeef1b76..326c33f4f 100644 --- a/src/Cli/Commands/LlodCommand.php +++ b/src/Cli/Commands/LlodCommand.php @@ -56,8 +56,8 @@ class LlodCommand implements CommandInterface { if (!defined('STREAMS_PATH')) define('STREAMS_PATH', MAIN_HOME . 'content/streams/'); if (!defined('CACHE_TMP_PATH')) define('CACHE_TMP_PATH', MAIN_HOME . 'tmp/cache/'); if (!defined('CONS_TMP_PATH')) define('CONS_TMP_PATH', MAIN_HOME . 'tmp/opened_cons/'); - if (!defined('FFMPEG')) define('FFMPEG', MAIN_HOME . 'bin/ffmpeg_bin/4.0/ffmpeg'); - if (!defined('FFPROBE')) define('FFPROBE', MAIN_HOME . 'bin/ffmpeg_bin/4.0/ffprobe'); + if (!defined('FFMPEG')) define('FFMPEG', \XcVm\Streaming\Codec\FfmpegPaths::cpu() ?: FFMPEG_BIN_40); + if (!defined('FFPROBE')) define('FFPROBE', \XcVm\Streaming\Codec\FfmpegPaths::probe() ?: FFPROBE_BIN_40); if (!defined('PACKET_SIZE')) define('PACKET_SIZE', 188); if (!defined('BUFFER_SIZE')) define('BUFFER_SIZE', 12032); if (!defined('TIMEOUT')) define('TIMEOUT', 20); diff --git a/src/Cli/Commands/LoopbackCommand.php b/src/Cli/Commands/LoopbackCommand.php index 9555fe8cb..e12f06c3e 100644 --- a/src/Cli/Commands/LoopbackCommand.php +++ b/src/Cli/Commands/LoopbackCommand.php @@ -44,8 +44,8 @@ class LoopbackCommand implements CommandInterface { if (!defined('MAIN_HOME')) define('MAIN_HOME', '/home/xc_vm/'); if (!defined('STREAMS_PATH')) define('STREAMS_PATH', MAIN_HOME . 'content/streams/'); - if (!defined('FFMPEG')) define('FFMPEG', MAIN_HOME . 'bin/ffmpeg_bin/4.0/ffmpeg'); - if (!defined('FFPROBE')) define('FFPROBE', MAIN_HOME . 'bin/ffmpeg_bin/4.0/ffprobe'); + if (!defined('FFMPEG')) define('FFMPEG', \XcVm\Streaming\Codec\FfmpegPaths::cpu() ?: FFMPEG_BIN_40); + if (!defined('FFPROBE')) define('FFPROBE', \XcVm\Streaming\Codec\FfmpegPaths::probe() ?: FFPROBE_BIN_40); if (!defined('CACHE_TMP_PATH')) define('CACHE_TMP_PATH', MAIN_HOME . 'tmp/cache/'); if (!defined('CONFIG_PATH')) define('CONFIG_PATH', MAIN_HOME . 'config/'); // PAT_HEADER restored to the real PAT header bytes (0xB0 0x0D) derived from the stream. diff --git a/src/Cli/Commands/RecordCommand.php b/src/Cli/Commands/RecordCommand.php index d09c3785e..c9e16b19a 100644 --- a/src/Cli/Commands/RecordCommand.php +++ b/src/Cli/Commands/RecordCommand.php @@ -186,7 +186,7 @@ class RecordCommand implements CommandInterface { } $rInsertID = $db->last_insert_id(); - shell_exec(FFMPEG_BIN_40 . " -i '" . ARCHIVE_PATH . $recordingID . '.ts' . "' -c:v copy -c:a copy '" . VOD_PATH . $rInsertID . '.mp4' . "'"); + shell_exec((\XcVm\Streaming\Codec\FfmpegPaths::cpu() ?: FFMPEG_BIN_40) . " -i '" . ARCHIVE_PATH . $recordingID . '.ts' . "' -c:v copy -c:a copy '" . VOD_PATH . $rInsertID . '.mp4' . "'"); @unlink(ARCHIVE_PATH . $recordingID . '.ts'); if (!file_exists(VOD_PATH . $rInsertID . '.mp4')) { diff --git a/src/Core/Config/Binaries.php b/src/Core/Config/Binaries.php index 637ea0857..e32a2be59 100644 --- a/src/Core/Config/Binaries.php +++ b/src/Core/Config/Binaries.php @@ -24,12 +24,11 @@ define('GEOLITE2_BIN', BIN_PATH . 'maxmind/GeoLite2-Country.mmdb'); define('GEOLITE2C_BIN', BIN_PATH . 'maxmind/GeoLite2-City.mmdb'); define('GEOISP_BIN', BIN_PATH . 'maxmind/GeoIP2-ISP.mmdb'); -// ── FFmpeg (по версиям) ─────────────────────────────────────── -define('FFMPEG_BIN_40', BIN_PATH . 'ffmpeg_bin/4.0/ffmpeg'); -define('FFMPEG_BIN_71', BIN_PATH . 'ffmpeg_bin/7.1/ffmpeg'); -define('FFMPEG_BIN_80', BIN_PATH . 'ffmpeg_bin/8.0/ffmpeg'); - -// ── FFprobe (по версиям) ────────────────────────────────────── +// ── FFmpeg/FFprobe — legacy 4.0 "DTS" build anchor ──────────── +// Only the 4.0 build is pinned as a constant: it is the legacy/DTS-safe binary +// (StreamProcess `-nofix_dts`, RecordCommand, and the FfmpegPaths fallback). Every +// other version is resolved dynamically from bin/ffmpeg_bin// by +// FfmpegPaths (paths) and FfmpegBinaries (discovery + capabilities) — no more +// per-version constants to keep in sync with what actually ships in the folder. +define('FFMPEG_BIN_40', BIN_PATH . 'ffmpeg_bin/4.0/ffmpeg'); define('FFPROBE_BIN_40', BIN_PATH . 'ffmpeg_bin/4.0/ffprobe'); -define('FFPROBE_BIN_71', BIN_PATH . 'ffmpeg_bin/7.1/ffprobe'); -define('FFPROBE_BIN_80', BIN_PATH . 'ffmpeg_bin/8.0/ffprobe'); diff --git a/src/Core/Init/LegacyInitializer.php b/src/Core/Init/LegacyInitializer.php index 4a016f913..a53704ec2 100644 --- a/src/Core/Init/LegacyInitializer.php +++ b/src/Core/Init/LegacyInitializer.php @@ -67,7 +67,7 @@ class LegacyInitializer { SettingsManager::update('on_demand_wait_time', 15); } - \XcVm\Streaming\Codec\FfmpegPaths::resolve(SettingsManager::get('ffmpeg_cpu')); + \XcVm\Streaming\Codec\FfmpegPaths::resolve(SettingsManager::get('ffmpeg_cpu'), SettingsManager::get('ffmpeg_gpu')); if (!$rUseCache) { \XcVm\Domain\Server\ServerRepository::getAll(); @@ -150,7 +150,7 @@ class LegacyInitializer { $GLOBALS['rSettings']['on_demand_wait_time'] = 15; } - \XcVm\Streaming\Codec\FfmpegPaths::resolve($GLOBALS['rSettings']['ffmpeg_cpu']); + \XcVm\Streaming\Codec\FfmpegPaths::resolve($GLOBALS['rSettings']['ffmpeg_cpu'], $GLOBALS['rSettings']['ffmpeg_gpu'] ?? null); $GLOBALS['rCached'] = \XcVm\Infrastructure\Cache\CacheReader::isReady($GLOBALS['rSettings']); $GLOBALS['rServers'] = \XcVm\Infrastructure\Cache\CacheReader::get('servers') ?: array(); diff --git a/src/Public/Views/admin/settings.php b/src/Public/Views/admin/settings.php index 10e9e3324..a6be088b6 100644 --- a/src/Public/Views/admin/settings.php +++ b/src/Public/Views/admin/settings.php @@ -6,7 +6,8 @@ use XcVm\Core\Config\SettingsManager; use XcVm\Core\GeoIP\MaxMindUpdater; use XcVm\Core\Localization\Translator; use XcVm\Core\Util\AdminHelpers; -use XcVm\Domain\Stream\StreamConfigRepository;// Code reconstruction by Squallp +use XcVm\Domain\Stream\StreamConfigRepository; +use XcVm\Streaming\Codec\FfmpegBinaries;// Code reconstruction by Squallp if (!isset($__settingsViewMode)): @@ -1954,16 +1955,43 @@ $isAjaxRequest = ( +
+
+ + + +
+