0

を使用してビデオを録画してavfoundationおり、 で設定captureSessionしていAVCaptureSessionPreset640x480ます。しかし、録画後にビデオを見ると、サイズが 480x640 に変更されています。

編集:ポートレート モードを使用した録画の問題は、常に 480X640 になることです。デバイスの向きのため、向きのサイズに従ってビデオを回転させる必要があります。

私はこの問題を解決しましたが、まったく話題から外れていませんでした。

- (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;
}
4

2 に答える 2

1

電話を垂直に持っていましたか(ポートレートオリエンタティン)?

ビデオは、加速度計を使用して検出されたデバイスの向きでキャプチャされます。横向きを使用するように強制できます。

于 2012-11-21T13:54:36.833 に答える
1

縦向きモードを使用した録画の問題は、常に 480X640 になることです。デバイスの向きのため、向きのサイズに従ってビデオを回転させる必要があります。

私はこの問題を解決しましたが、まったく話題から外れていませんでした。

- (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;
}
于 2013-03-25T22:11:08.187 に答える