使用Microsoft Expression Encoder自定义捕获大小

时间:2014-03-10 13:08:12

标签: c# video-capture expression-encoder screen-recording expression-encoder-4

我有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();

提前致谢!

1 个答案:

答案 0 :(得分:0)

您需要做的是将_screenRectangle设置为自定义尺寸:

_screenCaptureJob.CaptureRectangle = new Rectangle(0, 0, 600, 400);

屏幕录制大小可以保留未分配状态。

问候, 尼古拉