【发布时间】:2014-03-10 13:08:12
【问题描述】:
我有几行 C# 代码可以用来录制屏幕。 但我找不到解决方法来确定自定义视频输出大小。 我的屏幕分辨率是 1920x1080,虽然我尝试为记录分配新的大小它保持不变。 (库:Microsoft Expression Encoder,包含所有依赖项)
我在Button点击事件中使用的代码:
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();
提前致谢!
【问题讨论】:
标签: c# video-capture expression-encoder screen-recording expression-encoder-4