So, I followed Apple's instructions to capture video session using AVCaptureSession
: http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html. One problem I'm facing is that even though the orientation of the camera / iPhone device is vertical (and the AVCaptureVideoPreviewLayer
shows a vertical camera stream), the output image seems to be in the landscape mode. I checked the width and height of imageBuffer inside imageFromSampleBuffer:
of the sample code, and I got 640px and 480px respectively. Does anyone know why this's the case?
Thanks!
Взгляните на заголовок AVCaptureSession.h. Существует определение перечисления AVCaptureVideoOrientation
, которое определяет различные ориентации видео. В объекте AVCaptureConnection есть свойство videoOrientation, которое является AVCaptureVideoOrientation
. Вы должны иметь возможность установить это, чтобы изменить ориентацию видео. Возможно, вам понадобится AVCaptureVideoOrientationLandscapeRight
или AVCaptureVideoOrientationLandscapeLeft
.
Вы можете найти AVCaptureConnections для сеанса, просмотрев выходные данные для сеанса. У выходов есть свойство connections, которое представляет собой массив соединений для этого выхода.