MediaCapture: Photos have a color mailbox on Windows Phone

I have a code to get high quality video encoding properties for my Lumia 1020 while taking photos. It looks like this:

 IEnumerable<VideoEncodingProperties> pIEeAllRes = cMCeCapture.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.VideoPreview).Select(x => x as VideoEncodingProperties);
 VideoEncodingProperties pVEPBestRes = pIEeAllRes.OrderByDescending(x => x.Width * x.Height).ThenByDescending(x => x.FrameRate.Numerator / (double)x.FrameRate.Denominator).FirstOrDefault();

      

This returns one of the only available 1280 x 720 resolutions. When I photograph, I get strange green lines on each side. I have attached photos, any idea why this is happening and how to avoid it?

Sorry my dirty face lol!

Subtype: UnknownSubtype: NV12

+3


source to share


2 answers


In Windows, you will find three separate phones MediaStreamTypes

: VideoPreview

, Photo

and VideoRecord

. Think of it as three separate streams coming from the camera to the viewfinder for photos and for video recording respectively. The fact that they are separate streams means that you can set the resolution (aka MediaStreamProperties) for each stream separately:

  • You can start preview at screen resolution
  • You can take photos with 20MP resolution.
  • You can record videos at 1080p

So you don't run the 20 MP device all the time.



Now, although these are separate pins, there are some limitations and you just ran into one: The aspect ratio for the capture streams (Photo, VideoRecord) must match the aspect ratio for the VideoPreview , otherwise you might get odd artifacts. This gives you two options:

  • There are two shooting modes: Photo and Video. When switching between these modes, make sure you set the preview resolution to match the capture format you want to use.
  • Define the aspect ratio as the top-level decision. This means that you first decide if you want 16: 9 or 4: 3 as the capture resolution, then you set the preview based on that and then you can only allow capturing photos or videos in the same format. The advantage of this is that you don't have to switch "modes" to get a different kind of capture.
+3


source


Typically, just tried something and solved the problem, I changed the type of encoding props to photo, not video,

        IEnumerable<VideoEncodingProperties> pIEeAllRes = cMCeCapture.VideoDeviceController.GetAvailableMediaStreamProperties(MediaStreamType.Photo).Select(x => x as VideoEncodingProperties);
        VideoEncodingProperties pVEPBestRes = pIEeAllRes.OrderByDescending(x => x.Width * x.Height).ThenByDescending(x => x.FrameRate.Numerator / (double)x.FrameRate.Denominator).FirstOrDefault();

      



and

await cMCeCapture.VideoDeviceController.SetMediaStreamPropertiesAsync(MediaStreamType.Photo,

      

0


source







All Articles