From 507e17ec14a301c2619ffb35a59e2195da471eaf Mon Sep 17 00:00:00 2001 From: Mercurio <47455213+NotLugozzi@users.noreply.github.com> Date: Thu, 19 Sep 2024 12:32:34 +0200 Subject: [PATCH] Code Cleanup --- 2dxAutoClip/iidxAutoClip.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/2dxAutoClip/iidxAutoClip.cs b/2dxAutoClip/iidxAutoClip.cs index 0e6efd3..30d2bf1 100644 --- a/2dxAutoClip/iidxAutoClip.cs +++ b/2dxAutoClip/iidxAutoClip.cs @@ -20,16 +20,18 @@ class Program private static WaveFileWriter _writer = null!; private static string _audioFilePath = null!; private static string _videoFilePath = null!; - private static string _resolution = "1920x1080"; // Default resolution - private static int _framerate = 60; // Default framerate - private static float _crf = 23; // Default CRF value - private static string _gameProcessName = "spice64"; // Default game process name + private static string _resolution = "1920x1080"; + private static int _framerate = 60; + private static float _crf = 23; + private static string _gameProcessName = "spice64"; + private static string _encoder = null!; + private static async Task Main(string[] args) { DownloadFFmpeg(); LoadSettingsFromPropFile(); - + _encoder = GetHardwareEncoder(); var gameProcesses = Process.GetProcessesByName(_gameProcessName); if (gameProcesses.Length > 0) { @@ -259,13 +261,11 @@ class Program private static void StartFfmpegRecording(string songName) { - var encoder = GetHardwareEncoder(); - var date = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss"); _videoFilePath = $"{_ffmpegFolderPath}\\{songName}_{date}.mkv"; var ffmpegArguments = $"-framerate {_framerate} " + $"-filter_complex \"ddagrab=framerate={_framerate},hwdownload,format=bgra\" " + - $"{encoder} -crf {_crf} -video_size {_resolution} -movflags +faststart -y \"{_videoFilePath}\""; + $"{_encoder} -crf {_crf} -video_size {_resolution} -draw_mouse 0 -movflags +faststart -y \"{_videoFilePath}\""; _ffmpegProcess = new Process { StartInfo = new ProcessStartInfo @@ -378,7 +378,7 @@ private static string GetHardwareEncoder() { var combinedOutputFilePath = $"{_ffmpegFolderPath}\\{songName}_combined_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.mp4"; var ffmpegArgs = - $"-y -i \"{videoFilePath}\" -i \"{audioFilePath}\" -c:v copy -c:a aac -strict experimental -shortest -hwaccel_output_format d3d11 \"{combinedOutputFilePath}\""; + $"-y -i \"{videoFilePath}\" -i \"{audioFilePath}\" -c:v copy -c:a aac -strict experimental -shortest \"{combinedOutputFilePath}\""; var processInfo = new ProcessStartInfo {