From a762b1f243577feb5d44f9f53f9c67ef45799566481866276c3cbe6970c7fb4d Mon Sep 17 00:00:00 2001 From: copecone Date: Sun, 14 Jun 2026 15:51:58 +0900 Subject: [PATCH] Add GOP Size Config to Encoder --- Util/FFmpeg/FFmpegNativeEncoder.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Util/FFmpeg/FFmpegNativeEncoder.cs b/Util/FFmpeg/FFmpegNativeEncoder.cs index c5a4282..2d4e53c 100644 --- a/Util/FFmpeg/FFmpegNativeEncoder.cs +++ b/Util/FFmpeg/FFmpegNativeEncoder.cs @@ -65,6 +65,9 @@ namespace ADOFAIRenderer.Util.FFmpeg /// VBR 모드의 최대 비트레이트 (kbps 단위). 피크 품질 한도를 결정합니다. public int MaxBitrate; // VBR + + /// GOP(Group of Pictures) 크기 (초). 키프레임 간격을 의미합니다. + public double GopSize; } // ────────────────────────────────────────────────────────────── @@ -359,15 +362,15 @@ namespace ADOFAIRenderer.Util.FFmpeg // GOP: 키프레임(I-frame) 간격. 예) gop_size=120, 60fps → 2초마다 키프레임. // 키프레임은 완전한 이미지를 담고 있어 탐색(seek) 지점이 됩니다. // 너무 크면 탐색 정밀도가 떨어지고, 너무 작으면 파일 크기가 증가합니다. + var calculatedGop = Math.Max(1, (int)Math.Round(_settings.FPS * _settings.GopSize)); if (encoderName == "libvvenc") { // libvvenc (VVenC) requires IntraPeriod (gop_size) to be a multiple of its GOPSize (typically 32). - var calculatedGop = (int)Math.Round(_settings.FPS * 2); _pCodecContext->gop_size = Math.Max(32, ((calculatedGop + 15) / 32) * 32); } else { - _pCodecContext->gop_size = (int)Math.Round(_settings.FPS * 2); + _pCodecContext->gop_size = calculatedGop; } // ── B-프레임 비활성화 ──