Add GOP Size Config to Encoder

This commit is contained in:
copecone committed 2026-06-14 15:51:58 +09:00
1 parent 78df5318ba
commit a762b1f243
1 file changed
+5 -2
+5 -2
View File
@@ -65,6 +65,9 @@ namespace ADOFAIRenderer.Util.FFmpeg
/// <summary>VBR 모드의 최대 비트레이트 (kbps 단위). 피크 품질 한도를 결정합니다.</summary> /// <summary>VBR 모드의 최대 비트레이트 (kbps 단위). 피크 품질 한도를 결정합니다.</summary>
public int MaxBitrate; // VBR public int MaxBitrate; // VBR
/// <summary>GOP(Group of Pictures) 크기 (초). 키프레임 간격을 의미합니다.</summary>
public double GopSize;
} }
// ────────────────────────────────────────────────────────────── // ──────────────────────────────────────────────────────────────
@@ -359,15 +362,15 @@ namespace ADOFAIRenderer.Util.FFmpeg
// GOP: 키프레임(I-frame) 간격. 예) gop_size=120, 60fps → 2초마다 키프레임. // GOP: 키프레임(I-frame) 간격. 예) gop_size=120, 60fps → 2초마다 키프레임.
// 키프레임은 완전한 이미지를 담고 있어 탐색(seek) 지점이 됩니다. // 키프레임은 완전한 이미지를 담고 있어 탐색(seek) 지점이 됩니다.
// 너무 크면 탐색 정밀도가 떨어지고, 너무 작으면 파일 크기가 증가합니다. // 너무 크면 탐색 정밀도가 떨어지고, 너무 작으면 파일 크기가 증가합니다.
var calculatedGop = Math.Max(1, (int)Math.Round(_settings.FPS * _settings.GopSize));
if (encoderName == "libvvenc") if (encoderName == "libvvenc")
{ {
// libvvenc (VVenC) requires IntraPeriod (gop_size) to be a multiple of its GOPSize (typically 32). // 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); _pCodecContext->gop_size = Math.Max(32, ((calculatedGop + 15) / 32) * 32);
} }
else else
{ {
_pCodecContext->gop_size = (int)Math.Round(_settings.FPS * 2); _pCodecContext->gop_size = calculatedGop;
} }
// ── B-프레임 비활성화 ── // ── B-프레임 비활성화 ──