feat: add Windows runtime support

This commit is contained in:
emil28092005
2026-08-26 16:50:15 +03:00
parent 8e40d8c7a7
commit eec26d60f4
6 changed files with 103 additions and 7 deletions
+26 -5
View File
@@ -408,18 +408,39 @@ class Program
var w = window.Width;
var h = window.Height;
var ffmpegArgs = $"-y -f rawvideo -pixel_format bgra -video_size {w}x{h} -framerate 60 -i - -c:v libx264 -preset fast -crf 23 -pix_fmt yuv420p -vf fps=30 {recordingPath}";
var outputPath = recordingPath!;
// ArgumentList avoids shell-specific quoting rules and works
// for paths on both Windows and Linux.
var psi = new ProcessStartInfo
{
FileName = "ffmpeg",
Arguments = ffmpegArgs,
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true,
};
psi.ArgumentList.Add("-y");
psi.ArgumentList.Add("-f");
psi.ArgumentList.Add("rawvideo");
psi.ArgumentList.Add("-pixel_format");
psi.ArgumentList.Add("bgra");
psi.ArgumentList.Add("-video_size");
psi.ArgumentList.Add($"{w}x{h}");
psi.ArgumentList.Add("-framerate");
psi.ArgumentList.Add("60");
psi.ArgumentList.Add("-i");
psi.ArgumentList.Add("-");
psi.ArgumentList.Add("-c:v");
psi.ArgumentList.Add("libx264");
psi.ArgumentList.Add("-preset");
psi.ArgumentList.Add("fast");
psi.ArgumentList.Add("-crf");
psi.ArgumentList.Add("23");
psi.ArgumentList.Add("-pix_fmt");
psi.ArgumentList.Add("yuv420p");
psi.ArgumentList.Add("-vf");
psi.ArgumentList.Add("fps=30");
psi.ArgumentList.Add(outputPath);
try
{
@@ -431,7 +452,7 @@ class Program
catch (Exception ex)
{
Console.WriteLine($"[App] Failed to start FFmpeg: {ex.Message}");
Console.WriteLine("[App] Install FFmpeg: sudo apt install ffmpeg");
Console.WriteLine("[App] Install FFmpeg and ensure the ffmpeg executable is available on PATH.");
}
}
}