none
Problem with capturing second screen using Microsoft.Expression.Encoder.ScreenCapture.ScreenCaptureJob

    Question

  • Hi, I have following problem. I am using a Microsoft.Expression.Encoder.ScreenCapture.ScreenCaptureJob class to capture the screen video. When i'm recording my orimary screen everything is correct but when I'm trying to capture the secondary screen video the screen in the video file is smaller then the whole video size. Here is the code:

    Microsoft.Expression.Encoder.ScreenCapture.ScreenCaptureJob

                            job = new ScreenCaptureJob();
    
                            Rectangle Resolution = Screen.AllScreens[ScreenID].Bounds;
    
                            int offset = 0;
    
                            for (int i = 0; i < ScreenID; i++)
                            {
                                offset += Screen.AllScreens[i].Bounds.Width;
                            }
    
    
                            job.ScreenCaptureVideoProfile.Quality = this.Quality;
                            job.ScreenCaptureVideoProfile.FrameRate = this.FrameRate;
                            ConstantBitrate b = new ConstantBitrate(this.BitRate);
                            job.ScreenCaptureVideoProfile.Bitrate = b;
                         
                            
                            // Sets the top right coordinates of the capture rectangle
                            int topRightX = offset;
                            int topRightY = 0;
                            // Sets the bottom left coordinates of the capture rectangle
                            int BottomLeftX = topRightX + Resolution.Width;
                            int BottomLeftY = topRightY + Resolution.Height;
    
                            //job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
                            job.CaptureRectangle = new Rectangle(topRightX, topRightY, BottomLeftX, BottomLeftY);
    
                            job.ScreenCaptureVideoProfile.AutoFit = true;
                    
                            job.ShowFlashingBoundary = false;
    
                            
    
                            job.OutputScreenCaptureFileName = DirectoryPath + @"\" + FileNamePrefix + "_" + DateTime.Now.Year.ToString("0000") + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00") + "_" + DateTime.Now.Hour.ToString("00") + DateTime.Now.Minute.ToString("00") + DateTime.Now.Second.ToString("00") + ".xesc";
                            job.Start();

    

    What am I doing wrong?

    • Moved by Kristin Xie Tuesday, February 28, 2017 6:31 AM Expression Encoder related
    Friday, February 24, 2017 6:17 PM

All replies

  • Hi MaciejSz89,

    Based on your code, your case more related to Expression Encoder, I will move your case to Expression     >    Expression Encoder forum for better support.

    Best regards,

    Kristin


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 28, 2017 6:30 AM
  • I've recorded on a second screen manually and haven't had problems.  Both screens are the same pixel count.  I've used the SDK but I'm setting a specific rectangle when I do it.  I'm recording lectures.  Do you get the right rectangle size on the second monitor?  I've never used screenid.
    Tuesday, February 28, 2017 8:46 PM
  • Macie, I don't use this SDK, but I have seen replies here to similar questions that indicate that it is necessary that the CaptureRectangle dimensions each be an exact multiple of four (i.e. evenly divisible by four). You might want to add a check before calling the method to ensure that the dimensions meet those constraints, and if not, adjust them so that they do.

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.

    Wednesday, March 01, 2017 8:43 PM
  • I don't know why but it started working by itself. It had to be some kind of system issue. Thank you all for help
    Thursday, March 23, 2017 10:13 AM