2

I have lines of C# code with which I am able to record screen. But I cannot find a workaround in order to determine custom video output size. My screen resolution is 1920x1080, although i try to assign new size for the record It remains unchanged. (Library: Microsoft Expression Encoder, all dependencies are included)

The code I used in Button click event:

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

Thanks in advance!

T.Y. Kucuk
  • 447
  • 8
  • 24

1 Answers1

0

What you need to do is to set the _screenRectangle to your custom dimensions:

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

The screen recording size can be left unassigned.

Greetings, Nikolay

navramov
  • 1
  • 1