Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - Capture video in landscape while the device is in portrait mode

Is it possible to capture video in landscape while the device is in portrait mode?

something like this:
enter image description here

actually what i need is to capture in portrait but with width > height, i dont want the user to rotate the device, but i do want to capture a wider picture like in landscape mode.

just changing the preview layer frame to be wide (width>height) wont be enough of course.

i tried changing the video orientation of the preview layer, but that will rotate the picture, and thats not what i want.

previewLayer.connection.videoOrientation = .landscapeRight  

is that make any sense?

like image 285
Eyal Avatar asked Jul 16 '17 13:07

Eyal


1 Answers

No its not possible as you would have to physically rotate the camera.

You can CROP the output video to whatever aspect ratio you desire.

This will however make your vertical resolution be at most what your horizontal resolution currently is.

As well as decreasing your field of view.

If you still wanna crop the video to simulate this "smaller landscape mode" in real time i suggest you use the "GPUImageCropFilter" from the library GPUImage

like image 172
Pochi Avatar answered Oct 12 '22 03:10

Pochi