c#奖章.Shell在控制台中过滤输出



我尝试用Medallion在控制台中过滤输出。壳牌

var command = Command.Run(
ffMpegBinaryPath,
args);
command.RedirectTo(Console.OpenStandardOutput());
command.RedirectFrom(Console.OpenStandardInput());
command.RedirectStandardErrorTo(Console.OpenStandardError());

这样我就不能过滤输出了…

在我直接使用ProcessInfo之前,是否有一种方法可以获得与该库奖章相同的结果?

using var FFmpegProcess = Process.Start(procStartInfo) ?? throw new InvalidOperationException("null process");
FFmpegProcess.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs received)
{
if (received?.Data is not null &&
received.Data.StartsWith("frame=", StringComparison.InvariantCulture))
{
Console.WriteLine(received.Data);
Console.SetCursorPosition(0, Console.CursorTop - 1);
}
};
var command = Command.Run("python", "./patool", "--verbose",
"--non-interactive", "extract", filePath, "--outdir", folderPath);

foreach (var line in command.GetOutputAndErrorLines())
{
Console.WriteLine(line);
}