none
Metro ap how to achieve MediaCapture resolution change lead to preview size change

Answers

  • So from what I understand you are expecting the preview “window” height and width to change automatically when you set the resolution of the camera. I expect that you will need to do this in your code. I don’t expect that the preview window itself will change its resolution. I expect the rich compositor to automatically scale the video to fit in the predefined “window” size. To make this change happen you will have to change the size of the preview “window” yourself.

    I hope this helps,

    James

    • Marked as answer by 淡黄妹 Thursday, January 05, 2012 1:39 AM
    Thursday, January 05, 2012 12:21 AM

All replies

  • Hello,

    Unfortunately I don’t fully understand your question. Are you trying to get an event from the MediaCapture object when a dynamic format change occurs? I’m not sure that we have fully tested dynamic format change from a USB camera source. Theoretically this should work. Can you please give me more detail about what you are trying to do and I will do what I can to help.

    James,

    Windows Media SDK Technologies
    Microsoft Developer Services
    http://blogs.msdn.com/mediasdkstuff/

    Friday, December 30, 2011 11:28 PM
  • Hi James,

    USB camera support some diff resolution,eg:1920x1080 1280x720 640x480.w/h=16/9 or 4/3,I want different w/h,the preview size can change with it.

    Tuesday, January 03, 2012 1:46 AM
  • So from what I understand you are expecting the preview “window” height and width to change automatically when you set the resolution of the camera. I expect that you will need to do this in your code. I don’t expect that the preview window itself will change its resolution. I expect the rich compositor to automatically scale the video to fit in the predefined “window” size. To make this change happen you will have to change the size of the preview “window” yourself.

    I hope this helps,

    James

    • Marked as answer by 淡黄妹 Thursday, January 05, 2012 1:39 AM
    Thursday, January 05, 2012 12:21 AM
  • Thanks for your help.

    Thursday, January 05, 2012 1:39 AM
  • Dears,

    When you use MediaCapture to create a camera Metro ap,

    Do you know how to change the Resolution? 

    (Please provide me the source code.. Thanks!!!)

     

    Friday, February 24, 2012 4:46 AM
  • Hi all, does anyone know how to change the resolution of mediaCapture?

    The photos I take with my aplication comes with lower resolution then the ones I take with the camera app that comes with windows (wich I can set to a greater resolution).

    Thanks in advance!

    • Proposed as answer by Srta Bang Wednesday, May 16, 2012 7:35 PM
    • Unproposed as answer by Srta Bang Wednesday, May 16, 2012 7:35 PM
    Friday, May 11, 2012 6:49 PM
  • Hi, i just found the solution.

    The code bellow provides information about the resolution of camera. It gets the greater resolution available in YUY2 format. You can see on output windows the available resolutions.

    private MediaCapture mediaCapture_;
    bool DEBUG_ = true;
    ...
    this.mediaCapture_ = new MediaCapture();
    await this.mediaCapture_.InitializeAsync();
    ...
    
    public async Task SetResolution()
            {
                System.Collections.Generic.IReadOnlyList<IMediaEncodingProperties> res;
                res = this.mediaCapture_.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.VideoPreview);
                uint maxResolution = 0;
                int indexMaxResolution = 0;
                string s = "";
    
                if (res.Count >= 1)
                {
                    for (int i = 0; i < res.Count; i++)
                    {
                        VideoEncodingProperties vp = (VideoEncodingProperties)res[i];
                        var frameRate = (vp.FrameRate.Numerator / vp.FrameRate.Denominator);
                        
    
                        s = i + ") " + vp.Subtype + ", ";
                        s = s + vp.Width;
                        s = s + " x " + vp.Height;
                        s = s + " , Frame/s: " + frameRate;
                        
                        if (vp.Width > maxResolution && vp.Subtype.Equals("YUY2"))
                        {
                            indexMaxResolution = i;
                            maxResolution = vp.Width;
    
                        }
                        if (DEBUG_)
                        {
                            Debug.WriteLine(s);
                        }
                        s = "";
                    }
    
                    //setting resolution
                    await mediaCapture_.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.VideoPreview, res[maxResolution]);
    
    
                }
            }

    • Proposed as answer by Srta Bang Wednesday, May 16, 2012 7:44 PM
    Wednesday, May 16, 2012 7:43 PM
  • Thanks for your help.

       你好,我现在也想用MediaCapture拍摄,问题和你一样,也是没法调宽高比,不知道这个问题你解决了没呢。。。

       Hi,now I want to use MediaCapture ,the same problem come to me ,i can't reset the video's hight or width , i guess u have sovled the question ,can you help me?

    Wednesday, March 06, 2013 12:43 PM
  • Awesome, thanks. I have read much documentation on the MediaCapture class that claims it is not possible to alter the resolution, and I was getting quite discouraged. When I queried the available streams, I had 55 to choose from, and it was just a matter of selecting the correct one.

    Thanks.

    Monday, July 08, 2013 10:38 PM
  • Well Done!  This has been plaguing me for two days.  Thanks!

    Rob

    Friday, August 16, 2013 2:21 PM
  • I have also trouble with this problem.I have test your solution but not work.My project here:(https://github.com/79144876/ZXingStoreApp/blob/master/ZXingStoreApp/MainPage.xaml.cs)

    And i have ask here:http://stackoverflow.com/questions/23472248/how-to-adjust-zxing-on-windows-phone-store-app-8-1-camera-mediacapture-preview

    Monday, May 05, 2014 12:41 PM