CTheDark
CTheDark

Reputation: 2587

Capturing a portrait video on Windows Phone 8

I am building an app with fixed portrait orientation, and I need to implement video capture feature within the app.

I understand there is no video capture task similar to the photo capture task explained here (if there is, please advise!) , so I decided to make my own page that acts like it. I used this sample code as a guide, and I was able to capture video. However, the only problem is that the resulting video is always of landscape orientation. I couldn't see any method or property on the capture device class to alter the orientation. I tried changing "DesiredFormat" on VideoCaptureDevice instance, but it throws ArgumentException.

My code for trying to set DesiredFormat if this is even a way to do it.

videoCaptureDevice.DesiredFormat = new VideoFormat(PixelFormatType.Format32bppArgb, 480, 720, 30);

This line gives me ArgumentException.

I did apply the rotation transform on the viewFinderBrush, so when a user is recording, the video is in the correct orientation. However the result is always landscape.

Is what I'm trying to accomplish impossible? Any help would be greatly appreciated!

Upvotes: 2

Views: 1587

Answers (1)

Claus Jørgensen
Claus Jørgensen

Reputation: 26345

You can't change the orientation using the DesiredFormat, and I wouldn't recommend it as the resolution is specific to the individual devices, because the cameras are different, and not all devices supports 720p video.

The thing is, the camera on any Windows Phone is always in landscape mode. So to make it look correct, you'll need to turn the camera respectively 90 degrees for the back-facing camera, and 270 degrees for the front-facing camera.

And you'll also need to mirror the camera across the y-axis when using the front-camera.

Upvotes: 3

Related Questions