Reputation: 1025
I have some code to obtain the highest quality video encoding properties for my Lumia 1020 when taking photos. It is as follows,
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 1280 x 720 resolutions available to me. When I take the photo I get weird green lines each side. I've attached the photos, any idea why this happens and how to avoid it?
Excuse my messy face lol!
Upvotes: 3
Views: 186
Reputation: 2260
On Windows Phones, you'll find three separate MediaStreamTypes
: VideoPreview
, Photo
and VideoRecord
. Think of these as three separate streams coming from the camera, for the viewfinder, for photographs, and for recording videos, respectively. The fact that these are separate streams means you can set the resolution (a.k.a. MediaStreamProperties) on each stream separately:
That way you don't run the device at 20 MP all the time.
Now, even though these are separate pins, there are some limitations, and you just ran into one: The aspect ratio for the capture streams (Photo, VideoRecord) needs to match the aspect ratio for the VideoPreview, otherwise you can get odd artifacts. This gives you two options:
Upvotes: 3
Reputation: 1025
Typical, just tried something and resolved the issue, I changed the type of encoding props to photo rather than videopreview,
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,
Upvotes: 0