Exemplo n.º 1
0
        public static async Task <bool> IsAcceleratorAvailable(RecorderOptions.HardwareAccel accel)
        {
            string codec = "h264" + accel.GetH264Suffix();

            var ffmpeg = new Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName        = "ffmpeg.exe",
                    Arguments       = $"-f lavfi -i color=s=640x480:d=0 -c:v {codec} -f ismv -",
                    UseShellExecute = false,
                    CreateNoWindow  = true
                }
            };

            ffmpeg.Start();
            await ffmpeg.WaitForExitAsync();

            return(ffmpeg.ExitCode == 0);
        }
Exemplo n.º 2
0
 public static string GetH264Suffix(this RecorderOptions.HardwareAccel accel)
 => accel == RecorderOptions.HardwareAccel.AMD ? "_amf" :
 accel == RecorderOptions.HardwareAccel.NVIDIA ? "_nvenc" : null;