Add NTSC Support for FFmpegNativeEncoder

This commit is contained in:
copecone committed 2026-07-10 00:09:28 +09:00
1 parent 710789ee50
commit 6ff08f723d
3 files changed
+9 -3

No files matched your search

+1 -2
View File
@@ -1,6 +1,5 @@
using ADOFAIRenderer;
using ADOFAIRenderer.Core;
using ADOFAIRenderer.Patch.Engine;
using ADOFAIRenderer.Util;
using FFmpeg.AutoGen;
using MelonLoader;
@@ -8,7 +7,7 @@ using MelonLoader.Utils;
using UnityEngine;
using UnityEngine.EventSystems;
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.6-INDEV-AUDIO", "ADOFAI Editor Forum")]
[assembly: MelonInfo(typeof(RenderMod), "ADOFAI Renderer", "0.0.7-INDEV", "ADOFAI Editor Forum")]
[assembly: MelonGame("7th Beat Games", "A Dance of Fire and Ice")]
namespace ADOFAIRenderer
+1
View File
@@ -16,6 +16,7 @@ namespace ADOFAIRenderer.Util.Audio
_sampleRate = sampleRate;
_fpsRational = RationalUtil.Double2MaxPrecisionInt(fps);
// NTSC
if (Math.Abs(fps - 29.97) < 0.001) _fpsRational = (30000, 1001);
if (Math.Abs(fps - 59.94) < 0.001) _fpsRational = (60000, 1001);
if (Math.Abs(fps - 23.976) < 0.001 || Math.Abs(fps - 23.98) < 0.001) _fpsRational = (24000, 1001);
+7 -1
View File
@@ -436,6 +436,12 @@ namespace ADOFAIRenderer.Util.FFmpeg
//
// 참고: https://ffmpeg.org/doxygen/trunk/structAVCodecContext.html
var fpsRational = RationalUtil.Double2MaxPrecisionInt(_settings.FPS);
// NTSC
if (Math.Abs(_settings.FPS - 29.97) < 0.001) fpsRational = (30000, 1001);
if (Math.Abs(_settings.FPS - 59.94) < 0.001) fpsRational = (60000, 1001);
if (Math.Abs(_settings.FPS - 23.976) < 0.001 || Math.Abs(_settings.FPS - 23.98) < 0.001) fpsRational = (24000, 1001);
_pCodecContext->time_base = new AVRational
{ num = fpsRational.Denominator, den = fpsRational.Numerator };
_pCodecContext->framerate = new AVRational
@@ -519,7 +525,7 @@ namespace ADOFAIRenderer.Util.FFmpeg
var qsvReady = false;
int err;
bool isWindows = RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows);
var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
string childDeviceName = isWindows ? "d3d11va" : "vaapi";
AVHWDeviceType childDeviceType = isWindows ? AVHWDeviceType.AV_HWDEVICE_TYPE_D3D11VA : AVHWDeviceType.AV_HWDEVICE_TYPE_VAAPI;