title: How to capture high resolution video and capture photo from it in windows 8.1. I am having a UI jumping effect while tried it
body: <p>Im my camera capturing application am used to take continuous photos using the Camera implemented in a view using <code>CaptureElement</code>. When it taks continuouly capturing the photos the UI is moving back and forth seems like a jump effect. That is the problem am facing.</p>
  
  <p>Codes used are the following</p>
  
  <pre><code>var cameras = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
  MediaCaptureInitializationSettings settings=new MediaCaptureInitializationSettings { VideoDeviceId = cameras[0].Id, StreamingCaptureMode = StreamingCaptureMode.Video };
  var_mediaCapture = new MediaCapture();
  await _mediaCapture.InitializeAsync(settings);
  if (null != videoCapture) videoCapture.Source = _mediaCapture;
              await _mediaCapture.StartPreviewAsync();
  </code></pre>
  
  <p>setting the high resolution</p>
  
  <pre><code>int max = 0;
  var resolutions = videoController.GetAvailableMediaStreamProperties(MediaStreamType.Photo);
              for (var i = 0; i &lt; resolutions.Count; i++)
              {
                  ImageEncodingProperties res = resolutions[i] as ImageEncodingProperties;
                  if (null == res) continue;
  
  
                  if (res.Width * res.Height &lt; max)
                  {
                      max = (int)(res.Width * res.Height);
                      _imageEncodingProperties = res;
                  }
              }
  
       await videoController.SetMediaStreamPropertiesAsync(MediaStreamType.Photo, _imageEncodingProperties);
  </code></pre>
  
  <p>And capturing the photo from video frame using </p>
  
  <pre><code>    using (var photoStream = new InMemoryRandomAccessStream())
                  {                        
                      await _mediaCapture.CapturePhotoToStreamAsync(_imageEncodingProperties, photoStream);
                      await photoStream.FlushAsync(); 
                  }
  </code></pre>
  
  <p>I tested capturing by setting different video resolutions.</p>
  
  <pre><code>var videoController = _mediaCapture.VideoDeviceController;
  </code></pre>
  
  <p>Firstly i set default <code>preview resolution [640x480]</code> for the videoController and capturing process is taking place without any issue. And after that i checked it by setting <code>High resolution [1200x800]</code> in Surface tablet , in this case a photo frame is appearing over the video control for a moment and and it is having some small width on each side. It feels like a zoom in / zoom out effect [back n forward jumping] in the camera view. </p>
  
  <p>Have anybody getting this problem when setting high resolution to the video media element video controller in windows 8.1? I t will be great if anybody can explain it's reason. </p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong>
  I analysed the situation and found the following things</p>
  
  <p>There many available resolutions
  640 x 360 , 1280x720 , 1280x800 , 640x480 etc</p>
  
  <p>And i found that this problem is not at all occurs at the resolutions where width to height ratio is 1.777778. All other resolutions where the rato is less than 1.777 have the issue.</p>
  
  <p>That is , The problem doesn't exists for 640x360 , 1280x720 resolutions and other two have the jumping effect. I think the last 2 one have the ratio 1.6 and 1.33 respectively.</p>
  
  <p>Also i checked with <code>default camera app</code> and captured photos by setting 1280x800 resolution, there i saw there is a black border both sides of the camera element in the window.</p>
  
  <p><strong>Conclusion:</strong></p>
  
  <blockquote>
    <p>The issue was with the aspect ratio. When i set High resolution
    [1280x800] from the available camera resolutions which is not
    maintaining the surface device's aspect ratio [1366x768], so that the
    Image is trying to fit in to the screen and an jumping effect felt by
    the user.  So i set the Highest resolution which maintains the device
    aspect ratio , which is 1280x720 and the problem solved.</p>
  </blockquote>