I am recording video using avfoundation
and I set captureSession
with AVCaptureSessionPreset640x480
.
But after recording, when I see my video its dimensions are changed to 480x640.
Edit: Problem withe recording using portrait mode is that you will always get the 480X640. because of the orientation of the device, therefore need to rotate the video according to the orientation size.
I have solved this issue however it was not off-topic at all.
- (CGAffineTransform)transformFromCurrentVideoOrientationToOrientation:(AVCaptureVideoOrientation)orientation
{
CGAffineTransform transform = CGAffineTransformIdentity;
// Calculate offsets from an arbitrary reference orientation (portrait)
CGFloat orientationAngleOffset = [self angleOffsetFromPortraitOrientationToOrientation:orientation];
CGFloat videoOrientationAngleOffset = [self angleOffsetFromPortraitOrientationToOrientation:self.videoOrientation];
// Find the difference in angle between the passed in orientation and the current video orientation
CGFloat angleOffset = orientationAngleOffset - videoOrientationAngleOffset;
transform = CGAffineTransformMakeRotation(angleOffset);
return transform;
}