feat: add Windows runtime support
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user