From 4c3a864963b718e36eb7848fb1d1858a7c248b2a Mon Sep 17 00:00:00 2001 From: Aleksey Filippov Date: Wed, 25 Feb 2026 00:50:37 +0300 Subject: [PATCH] =?utf8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8?= =?utf8?q?=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC=D0=B8=D1=80=D0=BE=D0=B2=D0=B0?= =?utf8?q?=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20?= =?utf8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=BD=D0=B0=20=D1=83?= =?utf8?q?=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=BE=20?= =?utf8?q?=D0=BE=D0=B4=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BC=D0=B5=D1=81=D1=8F?= =?utf8?q?=D1=86=D0=B0.=20=D0=A1=D1=82=D0=B0=D1=80=D1=88=D0=B5=20=D0=BE?= =?utf8?q?=D0=B4=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BC=D0=B5=D1=81=D1=8F=D1=86?= =?utf8?q?=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D1=83=D0=B4=D0=B0?= =?utf8?q?=D0=BB=D1=8F=D1=8E=D1=82=D1=81=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/commands/ConvertVideoController.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erp24/commands/ConvertVideoController.php b/erp24/commands/ConvertVideoController.php index 4763489c..7c7ce17d 100644 --- a/erp24/commands/ConvertVideoController.php +++ b/erp24/commands/ConvertVideoController.php @@ -182,19 +182,22 @@ class ConvertVideoController extends Controller continue; } - // Конвертация + // Конвертация (вывод в лог-файл, чтобы не переполнять буфер exec) + $logFile = Yii::getAlias('@runtime') . '/ffmpeg_last.log'; $cmd = sprintf( - 'nice -n 19 timeout 600 ffmpeg -y -i %s -c:v libx264 -preset fast -crf 23 -c:a aac -movflags +faststart %s 2>&1', + 'nice -n 19 timeout 1800 ffmpeg -y -i %s -c:v libx264 -preset fast -crf 23 -c:a aac -movflags +faststart %s >%s 2>&1', escapeshellarg($sourcePath), - escapeshellarg($mp4Path) + escapeshellarg($mp4Path), + escapeshellarg($logFile) ); $startTime = microtime(true); - exec($cmd, $cmdOutput, $returnCode); + $returnCode = 0; + system($cmd, $returnCode); $elapsed = round(microtime(true) - $startTime, 1); if ($returnCode !== 0 || !file_exists($mp4Path)) { - $error = implode("\n", array_slice($cmdOutput, -5)); + $error = is_file($logFile) ? implode("\n", array_slice(file($logFile, FILE_IGNORE_NEW_LINES), -5)) : ''; $this->stderr(" — ОШИБКА ({$elapsed}s, code={$returnCode})\n"); Yii::error("ConvertVideo: ошибка #{$file->id}: {$error}", 'video'); if (file_exists($mp4Path)) { @@ -216,8 +219,6 @@ class ConvertVideoController extends Controller } } - $cmdOutput = []; - // Пауза между файлами if ($this->sleep > 0 && $i < $total - 1) { sleep($this->sleep); -- 2.39.5