我有几行可以用来录制屏幕的 C# 代码。但我找不到解决方法来确定自定义视频输出大小。我的屏幕分辨率是 1920x1080,虽然我尝试为记录分配新的大小它保持不变。(库:Microsoft Expression Encoder,包括所有依赖项)
我在按钮点击事件中使用的代码:
ScreenCaptureJob _screenCaptureJob = new ScreenCaptureJob();
Rectangle _screenRectangle = Screen.PrimaryScreen.Bounds;
_screenCaptureJob.CaptureRectangle = _screenRectangle;
_screenCaptureJob.ScreenCaptureVideoProfile.Size = new Size(600, 400); //By doing this Is it supposed to resize original size to 600x400 pixels?
_screenCaptureJob.ScreenCaptureVideoProfile.AutoFit = true;
_screenCaptureJob.ShowFlashingBoundary = false;
_screenCaptureJob.ScreenCaptureVideoProfile.FrameRate = 20;
_screenCaptureJob.CaptureMouseCursor = true;
_screenCaptureJob.ScreenCaptureVideoProfile.SmoothStreaming = true;
_screenCaptureJob.ScreenCaptureVideoProfile.Quality = 20;
_screenCaptureJob.OutputScreenCaptureFileName = string.Format(@"C:\test.wmv");
if (File.Exists(_screenCaptureJob.OutputScreenCaptureFileName))
{
File.Delete(_screenCaptureJob.OutputScreenCaptureFileName);
}
_screenCaptureJob.Start();
提前致谢!