forked from Mercury/2dxAutoClip
Code Cleanup
This commit is contained in:
parent
98fa171645
commit
507e17ec14
|
@ -20,16 +20,18 @@ class Program
|
||||||
private static WaveFileWriter _writer = null!;
|
private static WaveFileWriter _writer = null!;
|
||||||
private static string _audioFilePath = null!;
|
private static string _audioFilePath = null!;
|
||||||
private static string _videoFilePath = null!;
|
private static string _videoFilePath = null!;
|
||||||
private static string _resolution = "1920x1080"; // Default resolution
|
private static string _resolution = "1920x1080";
|
||||||
private static int _framerate = 60; // Default framerate
|
private static int _framerate = 60;
|
||||||
private static float _crf = 23; // Default CRF value
|
private static float _crf = 23;
|
||||||
private static string _gameProcessName = "spice64"; // Default game process name
|
private static string _gameProcessName = "spice64";
|
||||||
|
private static string _encoder = null!;
|
||||||
|
|
||||||
|
|
||||||
private static async Task Main(string[] args)
|
private static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
DownloadFFmpeg();
|
DownloadFFmpeg();
|
||||||
LoadSettingsFromPropFile();
|
LoadSettingsFromPropFile();
|
||||||
|
_encoder = GetHardwareEncoder();
|
||||||
var gameProcesses = Process.GetProcessesByName(_gameProcessName);
|
var gameProcesses = Process.GetProcessesByName(_gameProcessName);
|
||||||
if (gameProcesses.Length > 0)
|
if (gameProcesses.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -259,13 +261,11 @@ class Program
|
||||||
|
|
||||||
private static void StartFfmpegRecording(string songName)
|
private static void StartFfmpegRecording(string songName)
|
||||||
{
|
{
|
||||||
var encoder = GetHardwareEncoder();
|
|
||||||
|
|
||||||
var date = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
var date = DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss");
|
||||||
_videoFilePath = $"{_ffmpegFolderPath}\\{songName}_{date}.mkv";
|
_videoFilePath = $"{_ffmpegFolderPath}\\{songName}_{date}.mkv";
|
||||||
var ffmpegArguments = $"-framerate {_framerate} " +
|
var ffmpegArguments = $"-framerate {_framerate} " +
|
||||||
$"-filter_complex \"ddagrab=framerate={_framerate},hwdownload,format=bgra\" " +
|
$"-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
|
_ffmpegProcess = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
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 combinedOutputFilePath = $"{_ffmpegFolderPath}\\{songName}_combined_{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.mp4";
|
||||||
var ffmpegArgs =
|
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
|
var processInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue