Apply Formatted Video File Name

This commit is contained in:
copecone committed 2026-05-22 21:43:39 +09:00
1 parent acfb87f35f
commit 7d76cfeffd
1 file changed
+12 -8
+12 -8
View File
@@ -194,7 +194,7 @@ namespace ADOFAIRenderer.Component
return; return;
} }
if (_debugMonitorObj == null) if (!_debugMonitorObj)
{ {
_debugMonitorObj = new GameObject("DebugMonitorCanvas"); _debugMonitorObj = new GameObject("DebugMonitorCanvas");
_debugMonitorObj.AddComponent<DebugMonitorUI>(); _debugMonitorObj.AddComponent<DebugMonitorUI>();
@@ -216,8 +216,10 @@ namespace ADOFAIRenderer.Component
double targetFps = Configuration.TargetFPS; double targetFps = Configuration.TargetFPS;
double videoFps = Configuration.VideoFPS; double videoFps = Configuration.VideoFPS;
var targetFps = Configuration.TargetFPS;
var videoFps = Configuration.VideoFPS;
float bitrate = Configuration.Bitrate; float bitrate = Configuration.Bitrate;
string codecStr = Configuration.Codec; var codecStr = Configuration.Codec;
VideoFFmpeg.Codec selectedCodec = VideoFFmpeg.Codec.H264_Default; VideoFFmpeg.Codec selectedCodec = VideoFFmpeg.Codec.H264_Default;
if (Enum.TryParse<VideoFFmpeg.Codec>(codecStr, true, out var parsedCodec)) if (Enum.TryParse<VideoFFmpeg.Codec>(codecStr, true, out var parsedCodec))
@@ -225,7 +227,7 @@ namespace ADOFAIRenderer.Component
selectedCodec = parsedCodec; selectedCodec = parsedCodec;
} }
string ext = ".mp4"; var ext = ".mp4";
if (selectedCodec == VideoFFmpeg.Codec.AV1_Default || if (selectedCodec == VideoFFmpeg.Codec.AV1_Default ||
selectedCodec == VideoFFmpeg.Codec.AV1_NVIDIA || selectedCodec == VideoFFmpeg.Codec.AV1_NVIDIA ||
selectedCodec == VideoFFmpeg.Codec.AV1_QSV || selectedCodec == VideoFFmpeg.Codec.AV1_QSV ||
@@ -235,14 +237,17 @@ namespace ADOFAIRenderer.Component
ext = ".webm"; ext = ".webm";
} }
var startTime = DateTime.Now;
var fileName = startTime.ToString("yyyy-MM-dd HH_mm_ss") + ext;
RenderThread = new Thread(() => RenderThread = new Thread(() =>
{ {
try try
{ {
float workingFps = (float)(targetFps % videoFps == 0.0 ? videoFps : targetFps); var workingFps = (float)(targetFps % videoFps == 0.0 ? videoFps : targetFps);
VideoFFmpeg videoFFmpeg = new VideoFFmpeg(Configuration.RenderWidth, Configuration.RenderHeight, (int)workingFps, (int)videoFps, selectedCodec); var videoFFmpeg = new VideoFFmpeg(Configuration.RenderWidth, Configuration.RenderHeight, (int)workingFps, (int)videoFps, selectedCodec);
var outPath = Path.Combine(MelonEnvironment.GameRootDirectory, "Render", "out" + ext); var outPath = Path.Combine(MelonEnvironment.GameRootDirectory, "Render", fileName);
SetupCaptureDirectory(); SetupCaptureDirectory();
videoFFmpeg.Start(outPath, bitrate); videoFFmpeg.Start(outPath, bitrate);
@@ -270,7 +275,7 @@ namespace ADOFAIRenderer.Component
{ {
if (buffer.Length > 0) if (buffer.Length > 0)
{ {
int bufferSize = Configuration.RenderWidth * Configuration.RenderHeight * 4; var bufferSize = Configuration.RenderWidth * Configuration.RenderHeight * 4;
videoFFmpeg.SendDataFromBuffer(buffer, bufferSize); videoFFmpeg.SendDataFromBuffer(buffer, bufferSize);
System.Buffers.ArrayPool<byte>.Shared.Return(buffer); System.Buffers.ArrayPool<byte>.Shared.Return(buffer);
} }
@@ -337,6 +342,5 @@ namespace ADOFAIRenderer.Component
RDC.auto = false; RDC.auto = false;
ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "scnEditor"); ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "scnEditor");
} }
} }
} }